FittingTest_Kolmogorov¶

FittingTest_Kolmogorov
(*args)¶ Perform a Kolmogorov goodnessoffit test for 1d continuous distributions.
Refer to KolmogorovSmirnov fitting test.
 Parameters
 sample2d sequence of float
Tested sample.
 model
Distribution
orDistributionFactory
Tested distribution.
 levelfloat, , optional
This is the risk of committing a Type I error, that is an incorrect rejection of a true null hypothesis.
 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
 fitted_dist
Distribution
Estilmated distribution (if model is of type
DistributionFactory
). test_result
TestResult
Test result.
 fitted_dist
 Raises
 TypeErrorIf the distribution is not continuous or if the sample is
multivariate.
Notes
The present implementation of the Kolmogorov goodnessoffit test is twosided. This uses an external C implementation of the Kolmogorov cumulative distribution function by [simard2011]. If it is called with a distribution, it is supposed to be fully specified ie no parameter has been estimated from the given sample. Otherwise, the distribution is estimated using the given factory based on the given sample and the distribution of the test statistics is estimated using a Monte Carlo approach (see the FittingTestKolmogorovSamplingSize key in
ResourceMap
).Examples
>>> import openturns as ot >>> ot.RandomGenerator.SetSeed(0) >>> distribution = ot.Normal() >>> sample = distribution.getSample(30) >>> fitted_dist, test_result = ot.FittingTest.Kolmogorov(sample, ot.NormalFactory(), 0.01) >>> test_result class=TestResult name=Unnamed type=Kolmogorov Normal binaryQualityMeasure=true pvalue threshold=0.01 pvalue=0.7 statistic=0.106933 description=[Normal(mu = 0.0944924, sigma = 0.989808) vs sample Normal]