FittingTest_BIC¶
- FittingTest_BIC(*args)¶
Compute the Bayesian information criterion.
If a
Distribution
is used, the likelihood is evaluated on the sample. If aDistributionFactory
is used, itsbuild()
method is used to create the distribution, and the likelihood is then evaluated.Refer to Bayesian Information Criterion (BIC).
- Parameters
- sample2-d sequence of float
Tested sample.
- model
Distribution
orDistributionFactory
Tested distribution.
- n_parametersint, , optional
The number of parameters in the distribution that have been estimated from the sample. This parameter must not be provided if a
DistributionFactory
was provided as the second argument (it will internally be set to the number of parameters estimated by theDistributionFactory
). It can be specified if aDistribution
was provided as the second argument, but if it is not, it will be set equal to 0.
- Returns
- estimatedDist
Distribution
Estimated distribution (case factory as argument)
- BICfloat
The Bayesian information criterion.
- estimatedDist
Notes
This is used for model selection.
In case we set a factory argument, the method returns both the estimated distribution and BIC value. Otherwise it returns only the BIC value.
Examples
>>> import openturns as ot >>> ot.RandomGenerator.SetSeed(0) >>> distribution = ot.Normal() >>> sample = distribution.getSample(30) >>> ot.FittingTest.BIC(sample, distribution) 2.793869... >>> ot.FittingTest.BIC(sample, distribution, 2) # Assume that 2 parameters are estimated 3.020615... >>> fitted_dist, bic = ot.FittingTest.BIC(sample, ot.NormalFactory()) >>> bic 3.010802...