# find the best fit distribution that fits the data

2 views (last 30 days)
Amr Hashem on 30 Oct 2015
Edited: Amr Hashem on 30 Oct 2015
how could I find the best probability distribution that fits a failure rate data?
I try:
val=[0;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;]; % time
n=[4;7;9;7;14;12;18;29;25;30;39;40;33;46;46;59;62;60;62;] % failure rate
Exponential distribution
ex=expfit(n); % n estimate parameters maximum likelihood exponential
Ee=exppdf(n,ex); % exponential pdf
figure
plot(val,n/trapz(val,n),'ro');hold on %resize/scaling the data
plot(val,Ee,'-g')
Poisson distribution
[l,lci]=poissfit(n); % n estimate parameters maximum likelihood poisson
p=poisspdf(n,l); % poisson pdf
stem(val,p,'k-')
Normal distribution
pd = fitdist(n,'Normal')
ynormal = pdf(pd,n);
plot(val,ynormal,'m-','LineWidth',2)
axis([-1 19 0 0.12]);
grid on
AAY=legend('data','Exponential','poisson','normal'); %
which produce this figure:
NO BEST FIT in the figure.
How I can modify the code to find the best fit distribution?