Test sample normality using Anderson-Darling testΒΆ

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

In [1]:
from __future__ import print_function
import openturns as ot
In [2]:
# Generate a sample
sample = ot.Normal().getSample(200)
In [3]:
# Test normality
test_result = ot.NormalityTest.AndersonDarlingNormal(sample)
print('Component is normal?', test_result.getBinaryQualityMeasure(),
      'p-value=%.6g' % test_result.getPValue(),
      'threshold=%.6g' % test_result.getThreshold())
Component is normal? True p-value=0.829806 threshold=0.05