0% found this document useful (0 votes)
121 views6 pages

MATLAB Distribution Fitting Errors

The document shows the results of fitting different probability distributions to data from a file using MATLAB. Several distributions are tested (Weibull, Lognormal, Normal, Gamma, Exponential, etc.) using the fitdist and chi-square goodness of fit tests. Errors are displayed for some invalid distribution names. Additional tests are performed to compare the fitted distributions to the data using the Anderson-Darling and Kolmogorov-Smirnov tests.

Uploaded by

Riya Katiyar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
121 views6 pages

MATLAB Distribution Fitting Errors

The document shows the results of fitting different probability distributions to data from a file using MATLAB. Several distributions are tested (Weibull, Lognormal, Normal, Gamma, Exponential, etc.) using the fitdist and chi-square goodness of fit tests. Errors are displayed for some invalid distribution names. Additional tests are performed to compare the fitted distributions to the data using the Anderson-Darling and Kolmogorov-Smirnov tests.

Uploaded by

Riya Katiyar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

31/1/20 6:01 PM MATLAB Command Window 1 of 6

>> T=readtable('[Link]');
x=T(:,2);
m=table2array(x);
pd=fitdist(m,'Weibull');
[h,p,stats]=chi2gof(m,'CDF',pd);
>> T=readtable('[Link]');
x=T(:,2);
m=table2array(x);
pd=fitdist(m,'Lognormal');
[h,p,stats]=chi2gof(m,'CDF',pd);
>> T=readtable('[Link]');
x=T(:,2);
m=table2array(x);
pd=fitdist(m,'Normal');
[h,p,stats]=chi2gof(m,'CDF',pd);
>> T=readtable('[Link]');
x=T(:,2);
m=table2array(x);
pd=fitdist(m,'GammaDistribution');
[h,p,stats]=chi2gof(m,'CDF',pd);
Error using fitdist (line 159)
Distribution name 'GammaDistribution' is unrecognized.

>> T=readtable('[Link]');
x=T(:,2);
m=table2array(x);
pd=fitdist(m,'Gamma');
[h,p,stats]=chi2gof(m,'CDF',pd);
>> T=readtable('[Link]');
x=T(:,2);
m=table2array(x);
pd=fitdist(m,'Exponential');
[h,p,stats]=chi2gof(m,'CDF',pd);
>> T=readtable('[Link]');
x=T(:,2);
m=table2array(x);
pd=fitdist(m,'Pears');
[h,p,stats]=chi2gof(m,'CDF',pd);
31/1/20 6:01 PM MATLAB Command Window 2 of 6

Error using fitdist (line 159)


Distribution name 'Pears' is unrecognized.

>> T=readtable('[Link]');
x=T(:,2);
m=table2array(x);
pd=fitdist(m,'Pearson');
[h,p,stats]=chi2gof(m,'CDF',pd);
Error using fitdist (line 159)
Distribution name 'Pearson' is unrecognized.

>> T=readtable('[Link]');
x=T(:,2);
m=table2array(x);
pd=fitdist(m,'Pearsons');
[h,p,stats]=chi2gof(m,'CDF',pd);
Error using fitdist (line 159)
Distribution name 'Pearsons' is unrecognized.

>> T=readtable('[Link]');
x=T(:,2);
m=table2array(x);
pd=fitdist(m,'Gumbel');
[h,p,stats]=chi2gof(m,'CDF',pd);
Error using fitdist (line 159)
Distribution name 'Gumbel' is unrecognized.

>> T=readtable('[Link]');
x=T(:,2);
m=table2array(x);
pd=fitdist(m,'ExtremeValue');
[h,p,stats]=chi2gof(m,'CDF',pd);
>> T=readtable('[Link]');
x=T(:,2);
m=table2array(x);
pd=fitdist(m,'Weibull');
[h,p,stats]=adtest(m,'CDF',pd);
Error using [Link] (line 42)
31/1/20 6:01 PM MATLAB Command Window 3 of 6

Invalid parameter name: CDF.

Error in adtest (line 79)


[Link](paramNames, dflts, varargin{:});

>> T=readtable('[Link]');
x=T(:,2);
m=table2array(x);
pd=fitdist(m,'Weibull');
[h,p,adstat,cv]=adtest(m,'CDF',pd);
Error using [Link] (line 42)
Invalid parameter name: CDF.

Error in adtest (line 79)


[Link](paramNames, dflts, varargin{:});

>> T=readtable('[Link]');
x=T(:,2);
m=table2array(x);
pd=fitdist(m,'Weibull');
[h,p,adstat,cv]=adtest(m,'Distribution',pd);
>> T=readtable('[Link]');
x=T(:,2);
m=table2array(x);
pd=fitdist(m,'Normal');
[h,p,adstat,cv]=adtest(m,'Distribution',pd);
>> T=readtable('[Link]');
x=T(:,2);
m=table2array(x);
pd=fitdist(m,'ExtremeValue');
[h,p,adstat,cv]=adtest(m,'Distribution',pd);
>> T=readtable('[Link]');
x=T(:,2);
m=table2array(x);
pd=fitdist(m,'Gamma');
[h,p,adstat,cv]=adtest(m,'Distribution',pd);
>> T=readtable('[Link]');
x=T(:,2);
31/1/20 6:01 PM MATLAB Command Window 4 of 6

m=table2array(x);
pd=fitdist(m,'Lognormal');
[h,p,adstat,cv]=adtest(m,'Distribution',pd);
>> T=readtable('[Link]');
x=T(:,2);
m=table2array(x);
pd=fitdist(m,'Exponential');
[h,p,adstat,cv]=adtest(m,'Distribution',pd);
>> pd=fitdist(m,'Lognormal');
>> [h,p,ksstat,cv]=kstest(m,'CDF',pd);
>> pd=fitdist(m,'Exponential');
[h,p,ksstat,cv]=kstest(m,'CDF',pd);
>> pd=fitdist(m,'Gamma');
[h,p,ksstat,cv]=kstest(m,'CDF',pd);
>> pd=fitdist(m,'Normal');
[h,p,ksstat,cv]=kstest(m,'CDF',pd);
>> pd=fitdist(m,'ExtremeValue');
[h,p,ksstat,cv]=kstest(m,'CDF',pd);
>> pd=fitdist(m,'Normal');
[h,p,ksstat,cv]=kstest(m,'CDF',pd);
>>
>> pd=fitdist(m,'Lognormal');
[h,p,ksstat,cv]=kstest(m,'CDF',pd);
>>
>> pd=fitdist(m,'Normal');
[h,p,ksstat,cv]=kstest(m,'CDF',pd);
>> pd=fitdist(m,'ExtremeValue');
[h,p,ksstat,cv]=kstest(m,'CDF',pd);
>> pd=fitdist(m,'Exponential');
[h,p,adstat,cv]=adtest(m,'Distribution',pd);
>> pd

pd =

ExponentialDistribution

Exponential distribution
mu = 2641.84 [2191.87, 3246.94]
31/1/20 6:01 PM MATLAB Command Window 5 of 6

>> pd=fitdist(m,'Normal');
[h,p,ksstat,cv]=kstest(m,'CDF',pd);
>>
>>
>> pd

pd =

NormalDistribution

Normal distribution
mu = 2641.84 [2463.15, 2820.53]
sigma = 900.574 [790.71, 1046.17]

>> T=readtable('[Link]');
x=T(:,6);
m=table2array(x);
pd=fitdist(m,'Normal');
>> pd

pd =

NormalDistribution

Normal distribution
mu = 2458.11 [2304.93, 2611.3]
sigma = 772.01 [677.83, 896.824]

>> pd=fitdist(m,'Normal');
[h,p,ksstat,cv]=kstest(m,'CDF',pd);
>>
>> pd=fitdist(m,'Exponential');
[h,p,adstat,cv]=adtest(m,'Distribution',pd);
>> pd=fitdist(m,'ExtremeValue');
[h,p,ksstat,cv]=kstest(m,'CDF',pd);
>>
>> pd=fitdist(m,'Exponential');
31/1/20 6:01 PM MATLAB Command Window 6 of 6

[h,p,ksstat,cv]=kstest(m,'CDF',pd);
>>
>>

You might also like