The following Example 20 Obs and i used Goodness of fit test with Exponential distribution, another time with Weibull distribution and third time with Pareto distribution .All of them are significant but the question which of them are the best fitted model?? so i want compare between them by Akaike information criterion and likelihood ratio test statistic and so on

R={0.742089, 1.30406, 0.662704, 0.387884, 0.131098, 0.168853, 0.181532, 0.336997,
   0.163182, 0.14527, 0.781211, 0.533697, 1.22093, 0.343433,  0.332585, 0.179971, 
   0.487594, 1.14555, 0.402918, 0.757988}

first: with respect to Exponential Distribution

H = DistributionFitTest[R, ExponentialDistribution[a], "HypothesisTestData"]
H["TestDataTable", All]

Second:with respect to Weibull Distribution

H = DistributionFitTest[R, WeibullDistribution[a, b], "HypothesisTestData"] 
H["TestDataTable", All]

Third with respect to pareto distribution

H = DistributionFitTest[R, ParetoDistribution[a, b], "HypothesisTestData"]
H["TestDataTable", All]
  • 1
    $\begingroup$ Thanks for your interest I formatted it $\endgroup$ – Momo Oct 9 '14 at 22:11
  • $\begingroup$ When I run the DistributionFitTest only the ParetoDistribution shows any promise to predict the sample - it has enough small values to be fit, the other two really don't. What do you mean by that they are all "significant". $\endgroup$ – SEngstrom Oct 9 '14 at 22:43
  • $\begingroup$ NonlinearModelFit provides AIC information. $\endgroup$ – bobthechemist Oct 9 '14 at 22:52
  • $\begingroup$ Dear @SEngstrom look at the P-value of K-Smirnov statistic all of distribution are greater than 0.01 so all of them are significant at significance level 0.01 $\endgroup$ – Momo Oct 9 '14 at 23:16
edistdata = Table[{x, CDF[EmpiricalDistribution[R], x]}, {x, R}];

cdfw[a_, b_, x_] := Simplify[CDF[WeibullDistribution[a, b], x], x > 0];
cdfe[a_, x_] := Simplify[CDF[ExponentialDistribution[a], x], x > 0];
cdfp[a_, b_, x_] := Simplify[CDF[ParetoDistribution[a, b], x], x > 0];
nlmw = NonlinearModelFit[edistdata, cdfw[a, b, x], {a, b}, x];
nlme = NonlinearModelFit[edistdata, cdfe[a, x], {a}, x];
nlmp = NonlinearModelFit[edistdata, cdfp[a, b, x], {a, b}, x];

Transpose[{{"", Weibull, Exponential, Pareto}, {"AIC", nlmw["AIC"], nlme["AIC"], nlmp["AIC"]},
  {"BIC", nlmw["BIC"], nlme["BIC"], nlmp["BIC"]}, 
  {"Adj-R^2", nlmw["AdjustedRSquared"], nlme["AdjustedRSquared"], nlmp["AdjustedRSquared"]},
  {"R^2", nlmw["RSquared"], nlme["RSquared"], nlmp["RSquared"]}}] // 
                            TableForm[#, TableAlignments -> Center] &

enter image description here

| improve this answer | |
  • $\begingroup$ Kguler..you are the best..what about likelihood Ratio statistic? $\endgroup$ – Momo Oct 9 '14 at 23:25
  • 1
    $\begingroup$ @Momo, unfortunately, LR statistics is not available for NonlinearModelFit. I used all goodness-of-fit measures available for NonlinearModelFit. LR is available for only GeneralizedLinearModelFit, and, although it may be possible to use GLM after some data transformations, haven't had time to think about the right approach for that.. $\endgroup$ – kglr Oct 9 '14 at 23:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.