MATLAB Answers

pietro
0

Why confidence interval distributions overlap the distribution?

Asked by pietro
on 13 Jan 2016
Latest activity Answered by Tom Lane
on 15 Jan 2016
Hi all,
I've a series of data that were scaled to a percentage of maximum which I need to compute the 20th percentile of the lower confidence interval distribution at 50%. So I fitted the data with lognormal distribution, truncated it to 100% and computed the two confidence distributions. Here the result http://s23.postimg.org/sby72j67v/fitting2.jpg. I do not understand why the three distributions overlap each other. What's wrong in my code? Thanks
Here the code:
XGrid=linspace(0,100,1e3);
pd1 = fitdist(Neutral', 'Lognormal');
YPlot = cdf(pd1,XGrid);
pd1 = truncate(pd1,0,100);
pdci=paramci(pd1,'Alpha',0.1);
pdCI(1) = makedist('LogNormal',pdci(1),pdci(3));
pdCI(2) = makedist('LogNormal',pdci(2),pdci(4));
pdCI(1) = truncate(pdCI(1),0,100);
pdCI(2) = truncate(pdCI(2),0,100);
YPlotUB = cdf(pdCI(2),XGrid);
YPlotLB = cdf(pdCI(1),XGrid);
[f x]=ecdf(Neutral);
figure
plot(XGrid,YPlot,XGrid,YPlotLB,XGrid,YPlotUB,x,f)
legend('Fitted data','70% lower confidence bound','70% upper confidence bound','Empirical data','Location','Best')
ylabel('Probability','FontSize',14)
xlabel('Time [%]','FontSize',14)
set(gca,'FontSize',12)

  0 Comments

Sign in to comment.

1 Answer

Answer by Tom Lane
on 15 Jan 2016

A couple of things. First, take out your truncate statements and run the code. You'll see that the "LB" cdf is substantially below 1 and x=100. But when you truncate it, you force it up to 1 at x=100 and it looks a lot like the "UB" cdf.
Another thing is that it looks like you're using the lower limits of both parameters together, then the upper limits of both parameters together. That wouldn't necessarily give you a set of confidence bounds on the cdf.
I haven't quite got my head around what you'd like to do or how to do it.

  0 Comments

Sign in to comment.