statsmodels.stats.diagnostic.kstest_normal¶
-
statsmodels.stats.diagnostic.
kstest_normal
(x, dist='norm', pvalmethod=None)¶ Lilliefors test for normality or an exponential distribution
Lilliefors test is a Kolmogorov-Smirnov test with estimated parameters
- Parameters
- xarray_like, 1d
Data to test
- dist{‘norm’, ‘exp’},
optional
Assumed distribution
- pvalmethod{‘approx’, ‘table’},
optional
The method used to compute the p-value of the test statistic. In general, ‘table’ is preferred and makes use of a very large simulation. ‘approx’ is only valid for normality. if dist = ‘exp’ table is always used. ‘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
- Returns
Notes
‘table’ uses an improved table based on 10,000,000 simulations. The critical values are approximated using log(cv_alpha) = b_alpha + c[0] log(n) + c[1] log(n)**2 where cv_alpha is the critical value for a test with size alpha, b_alpha is an alpha-specific intercept term and c[1] and c[2] are coefficients that are shared all alphas. Values in the table are linearly interpolated. Values outside the range are be returned as bounds, 0.990 for large and 0.001 for small pvalues.
For implementation details, see lilliefors_critical_value_simulation.py in the test directory.