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.

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