Logo

statsmodels.stats.diagnostic.kstest_normal

statsmodels.stats.diagnostic.kstest_normal(x, pvalmethod='approx')

Lillifors test for normality,

Kolmogorov Smirnov test with estimated mean and variance

Parameters:

x : array_like, 1d

data series, sample

pvalmethod : ‘approx’, ‘table’

‘approx’ uses the approximation formula of Dalal and Wilkinson, valid for pvalues < 0.1. If the pvalue is larger than 0.1, then the result of table is returned ‘table’ uses the table from Dalal and Wilkinson, which is available for pvalues between 0.001 and 0.2, and the formula of Lilliefors for large n (n>900). Values in the table are linearly interpolated. Values outside the range will be returned as bounds, 0.2 for large and 0.001 for small pvalues.

Returns:

ksstat : float

Kolmogorov-Smirnov test statistic with estimated mean and variance.

pvalue : float

If the pvalue is lower than some threshold, e.g. 0.05, then we can reject the Null hypothesis that the sample comes from a normal distribution

Notes

Reported power to distinguish normal from some other distributions is lower than with the Anderson-Darling test.

could be vectorized

Previous topic

statsmodels.stats.diagnostic.normal_ad

Next topic

statsmodels.stats.diagnostic.lillifors

This Page