# Choosing The Best Fitted Probability Distribution Model

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]

• 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". Commented Oct 9, 2014 at 22:43
• NonlinearModelFit provides AIC information. Commented Oct 9, 2014 at 22:52
• 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
– Momo
Commented Oct 9, 2014 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"]},
{"R^2", nlmw["RSquared"], nlme["RSquared"], nlmp["RSquared"]}}] //
TableForm[#, TableAlignments -> Center] &


• Kguler..you are the best..what about likelihood Ratio statistic?
– Momo
Commented Oct 9, 2014 at 23:25
• @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..
– kglr
Commented Oct 9, 2014 at 23:30

Using AIC you can rank the goodness-of-fit for each probability distribution but that doesn't mean any of the fits are good or bad. Just a relative ranking.

But you don't want to use regression (i.e., NonlinearModelFit) to fit probability distributions).

Here's how to obtain the AIC values:

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};

(* Get maximum likelihood estimates of parameters *)
mleExponential = FindDistributionParameters[R, ExponentialDistribution[a]]
(* {a -> 1.92131} *)
mleWeibull = FindDistributionParameters[R, WeibullDistribution[a, b]]
(* {a -> 1.52344, b -> 0.581222} *)
mlePareto = FindDistributionParameters[R, ParetoDistribution[a, b]]
(* {a -> 0.131098, b -> 0.886131} *)

(* Calculate AIC for each probability model *)
aicExponential = -2 LogLikelihood[ExponentialDistribution[a /. mleExponential], R] + 2*1
(* 15.8796 *)
aicWeibull = -2 LogLikelihood[WeibullDistribution[a, b] /. mleWeibull, R] + 2*2
(* 13.0082 *)
aicPareto = -2 LogLikelihood[ParetoDistribution[a, b] /. mlePareto, R] + 2*2
(* 12.7033 *)


If one uses the common yardstick of 2 AIC units, there's not much of any difference between the Pareto and Weibull distributions for your particular dataset.

With only 20 data points (and I'm sure that data was probably pretty expensive to obtain) and no theoretical basis for a particular distribution, you're really not going to get a definitive answer as to which probability distribution could have generated the data and which ones couldn't.

• You could get the number of variables using Length[dist] or Length[rules]. Commented Jun 14, 2022 at 8:28