FittingTest_BIC

FittingTest_BIC(*args)

Compute the Bayesian information criterion.

If a Distribution is used, the likelihood is evaluated on the sample. If a DistributionFactory is used, its build() 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.

modelDistribution or DistributionFactory

Tested distribution.

n_parametersint, 0 \leq k, 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 the DistributionFactory). It can be specified if a Distribution was provided as the second argument, but if it is not, it will be set equal to 0.

Returns
estimatedDistDistribution

Estimated distribution (case factory as argument)

BICfloat

The Bayesian information criterion.

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...