Test distribution fitting using KolmogorovΒΆ

In this example we are going to perform a Kolmogorov goodness-of-fit test for an 1-d continuous distribution.

In [1]:
from __future__ import print_function
import openturns as ot
In [2]:
# Create data
distribution = ot.Normal()
sample = distribution.getSample(50)
In [3]:
# Estimate the Spearman correlation
result = ot.FittingTest.Kolmogorov(sample, ot.NormalFactory(), 0.99)
print('Conclusion=', result.getBinaryQualityMeasure(), 'P-value=', result.getPValue())
Conclusion= True P-value= 0.7690205145607361
In [5]:
# Test succeeded ?
result.getBinaryQualityMeasure()
Out[5]:
True
In [7]:
# P-Value associated to the risk
result.getPValue()
Out[7]:
0.7690205145607361
In [9]:
# Threshold associated to the test
result.getThreshold()
Out[9]:
0.010000000000000009