FittingTest_BIC

FittingTest_BIC(*args)

Compute the Bayesian information criterion.

Parameters:

sample : 2-d sequence of float

Tested sample.

model : Distribution or DistributionFactory

Tested distribution.

n_parameters : int, 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:

BIC : float

The Bayesian information criterion.

Notes

The Bayesian information criterion is defined as follows:

{\rm BIC} = \frac{1}{m}
            \left(- 2 \log L(\vect{x}^{(i)}, i = 1, \ldots, m)
                  + k \log m\right)

where \log L denotes the log-likelihood of the sample with respect to the given distribution, and k denotes the number of estimated parameters in the distribution.

This is used for model selection.

Examples

>>> import openturns as ot
>>> ot.RandomGenerator.SetSeed(0)
>>> distribution = ot.Normal()
>>> sample = distribution.getSample(30)
>>> ot.FittingTest.BIC(sample, distribution)
2.7938693005063415
>>> ot.FittingTest.BIC(sample, distribution, 2)
3.0206157926171517
>>> ot.FittingTest.BIC(sample, ot.NormalFactory())
3.0108025506670955