statsmodels.stats.diagnostic.kstest_normal¶

statsmodels.stats.diagnostic.
kstest_normal
(x, dist='norm', pvalmethod='approx')¶ Lilliefors test for normality or an exponential distribution.
Kolmogorov Smirnov test with estimated mean and variance
Parameters:  x (array_like, 1d) – data series, sample
 dist ({'norm', 'exp'}, optional) – Distribution to test in set.
 pvalmethod ({'approx', 'table'}, optional) –
‘approx’ is only valid for normality. if dist = ‘exp’, table is returned. ‘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
For normality: ‘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. For exponential: ‘table’ uses the table from Lilliefors 1967, available for pvalues between 0.01 and 0.2. Values outside the range will be returned as bounds, 0.2 for large and 0.01 for small pvalues.
Returns:  ksstat (float) – KolmogorovSmirnov 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 AndersonDarling test.
could be vectorized