Cramer-Von Mises normality testΒΆ

In this example we are going to evaluate whether a sample follows a normal distribution.

from __future__ import print_function
import openturns as ot
import openturns.viewer as viewer
from matplotlib import pylab as plt
ot.Log.Show(ot.Log.NONE)

Generate a sample

sample = ot.Normal().getSample(200)

Test normality

test_result = ot.NormalityTest.CramerVonMisesNormal(sample)
print('Component is normal?', test_result.getBinaryQualityMeasure(),
      'p-value=%.6g' % test_result.getPValue(),
      'threshold=%.6g' % test_result.getThreshold())

Out:

Component is normal? True p-value=0.778876 threshold=0.05

Total running time of the script: ( 0 minutes 0.001 seconds)

Gallery generated by Sphinx-Gallery