2
$\begingroup$

is there a way to exclude MixtureDistribution from the set of fitted distributions when using FindDistribution?

I expected that TargetFunctions option within FindDistribution would resolve this, however MixtureDistribution still comes up as a proposed candidate - though the component distributions within the proposed MixtureDistribution are indeed restricted to those listed in TargetFunctions.

Cheers,

td

$\endgroup$

1 Answer 1

7
$\begingroup$

I am not aware of a method to exclude MixtureDistribution from FindDistribution. However, if you want to test individual distributions to your data then you may use EstimatedDistribution. This function does not return any statistics on the fit but you can use DistributionFitTest on its result to test for goodness of fit.

If there is some data,

dist = MixtureDistribution[{.7, .3}, 
        {ParetoDistribution[500, 20, 0], HalfNormalDistribution[.25]}];
SeedRandom[789];
data = RandomVariate[dist, 1000];

That results in a MixtureDistribution where you wish to exclude this form.

FindDistribution[data, 
 TargetFunctions -> {InverseGaussianDistribution, 
   HalfNormalDistribution, LevyDistribution, LogNormalDistribution}]
MixtureDistribution[{0.866903, 0.133097}, 
 {LogNormalDistribution[1.95719, 1.43364], 
  LogNormalDistribution[3.82415, 0.414689]}]

Then map EstimateDistribution and DistributionFitTest over the distributions

htd = DistributionFitTest[data, EstimatedDistribution[data, #], "HypothesisTestData"] & /@ 
  {InverseGaussianDistribution[a, b], 
   HalfNormalDistribution[a], 
   LevyDistribution[a, b], 
   LogNormalDistribution[a, b]}

Mathematica graphics

Goodness of fit statistics are available in each HypothesisTestData object. Use this information to select the best fit.

fitted = First@MaximalBy[Select[#["PValue"] >= 0.05 &]@htd, #["PValue"] &, 1];
fitted["TestConclusion"]
fitted["FittedDistribution"]
The null hypothesis that the data is distributed according to the 
 LogNormalDistribution[2.16635,1.39778] is not rejected at the 5 percent level 
 based on the Cramér-von Mises test.

LogNormalDistribution[2.16635, 1.39778]

Additional fitted properties are listed with fitted["Properties"].

Hope this helps.

$\endgroup$
2
  • $\begingroup$ I should really read the docs better. I'd never seen DistributionFitTest before, but have wanted it at many points in time. $\endgroup$
    – b3m2a1
    Commented Aug 6, 2017 at 5:41
  • $\begingroup$ Hi Edmund that does help - thanks for the work around. $\endgroup$
    – dusio
    Commented Aug 14, 2017 at 10:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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