# FindDistribution and parameters

If I generate some data using

data = RandomVariate[NormalDistribution[5, 3], 100]

Then find the distribution using

(1) FindDistribution[data]

Mathematica gives me an estimated distribution (correctly guesses a Normal) and values of that distributions parameters.

However, if I then do

(2) EstimatedDistribution[data, NormalDistribution[a, b]]

or

(3) FindDistributionParameters[data, NormalDistribution[a, b]]

Mathematica gives me different "best fit" parameter estimates. Using defaults, (2) and (3) give the same results, and (1) gives different results.

Looking at the documentation it looks like (2) and (3) might use a different method by default to (1). But I have been unable to get (1) to give the same results as (2) and (3). Is there a simple way (options) to make the results consistent.

A couple of more general questions:

Are there any "rules" as to when one should use (1), versus (2) or (3) to get parameter values. Obviously (1) finds a distribution, versus (2) and (3) finding best fit parameters of a specified distribution.

The three functions seem very related, so it seems confusing that by default they did not give the same best fit parameters.

• Weird, I thing this is a bug, notice that FindDistribution[data,PerformanceGoal->"Quality",TargetFunctions-> {NormalDistribution}] gives the same solution as other methods but not FindDistribution[data,PerformanceGoal->"Quality",TargetFunctions-> {NormalDistribution, WeibullDistribution}]. May 16, 2022 at 10:16
• As for the question "when one should use" each function, I think FindDistribution makes most sense only when you are exploring different hypotheses on what could be the underlying distribution, but not as the means to extract parameters of known distributions. However, given that there is a bug in that function, I would say it does not make sense to use FindDistribution at all until the scope of the bug is understood or fixed. May 16, 2022 at 10:20
• @rhermans: Let us increase the sample size. Then RandomSeeding[{1, 2, 3, 4}]; data = RandomVariate[NormalDistribution[5, 3], 200];FindDistribution[data, PerformanceGoal -> "Quality", TargetFunctions -> {NormalDistribution, WeibullDistribution}] results in NormalDistribution[5.36896, 3.09436] , whehereas FindDistributionParameters[data, NormalDistribution[a, b]] performs {a -> 5.36618, b -> 3.00919}. It should be noticed that FindDistribution is sensitive to a sample size. Don't hesitate to ask for further explanation in need. PS. A very similar result with with the size =150. May 16, 2022 at 11:18
• @user64494 Well, no surprise that increasing the number of points gives solutions that are closer. Still remains that the output changes depending on options that should NOT make any difference, like the number of alternative TargetFunctions. Circumventing a bug by tweaking options obviously doesn't give information about that bug, and does not constitute an answer to the question at hand, IMHO. May 16, 2022 at 12:13

Two quotes from the documentation shed light on it:

By default, FindDistributionParameters uses maximum likelihood to estimate distribution parameters for a fixed distribution. FindDistribution uses a full Bayesian approach by combining the Bayesian information criterion with priors over distributions to select both the best distribution and the best parameters for it.

The option TargetFunctions can be used if you want to find roughly the same parameters as FindDistributionParameters

data = RandomVariate[NormalDistribution[5, 3], 100];
FindDistribution[data, TargetFunctions -> {NormalDistribution}]


NormalDistribution[5.26867, 2.8738]

• I don't think this answers the question. May 16, 2022 at 12:14
• Why do you think so? May 16, 2022 at 14:28
• I elaborated more in a comment to the question. I do appreciate the effort and goodwill, but that is something else. May 16, 2022 at 14:30
• @rhermans You say that the answer should not depend on the TargetFunctions specified, but this answer actually explains that that's an invalid assumption. In a Bayesian setting, the results depend on your priors and setting different TargetFunctions changes the priors and hence the result. May 16, 2022 at 14:47
• This answer is correct and the only thing missing is the admonition: "Don't use FindDistribution until the documentation clearly explains exactly what "uses a Bayesian information criterion together with priors" means. There's nothing wrong with using a Bayesian approach (and it's probably what one should be using) but without knowing what's under the hood, one shouldn't use it at all. EstimatedDistribution and FindDistributionParameters are not completely innocent either: Neither produce estimates of precision. Estimates should always be paired with an estimate of precision.
– JimB
May 16, 2022 at 16:08