Skip to content

Home / Shared Math Details / Shared Estimators and Tests / Kolmogorov-Smirnov Test

Kolmogorov-Smirnov Test

This page defines the Kolmogorov-Smirnov normality test that Quantum XL uses, including the sample-size modification applied because the normal parameters are estimated from the same data. It is one of the selectable goodness-of-fit methods wherever a normality check is offered.

Notation

Term Description
\(n\) number of data values
\(x_{(1)} \le x_{(2)} \le \cdots \le x_{(n)}\) the data sorted in ascending order
\(\bar{x}\) sample mean
\(s\) sample standard deviation (\(n - 1\) denominator)
\(F_n\) empirical cumulative distribution function
\(\Phi\) standard normal cumulative distribution function
\(z_{(i)}\) standardized sorted value, \((x_{(i)} - \bar{x})/s\)
\(D\) Kolmogorov-Smirnov statistic
\(D^{*}\) sample-size modified statistic used for the p-value

Test statistic

\[ D^{+} = \max_i\left(F_n(x_{(i)}) - \Phi(z_{(i)})\right), \qquad D^{-} = \max_i\left(\Phi(z_{(i)}) - F_n(x_{(i-1)})\right), \qquad D = \max(D^{+}, D^{-}) \]

\(F_n\) is the empirical cumulative distribution function of the sorted data, and \(z_{(i)} = (x_{(i)} - \bar{x})/s\) standardizes each value with the sample mean and sample standard deviation. \(D\) is the largest vertical distance between the empirical CDF and the fitted normal CDF.

p-value

Because the mean and standard deviation are estimated from the same sample, the classical Kolmogorov-Smirnov distribution does not apply. Quantum XL forms a sample-size modified statistic:

\[ D^{*} = D\left(\sqrt{n} - 0.01 + \frac{0.85}{\sqrt{n}}\right) \]

and reads the p-value from tabulated critical values for the case where the mean and variance are estimated from the sample, interpolating linearly within each bracket:

Modified statistic Reported p-value
\(D^{*} < 0.775\) \(0.15\), printed with a greater-than prefix
\(0.775 \le D^{*} < 0.819\) \(0.10 + 0.05\left(1 - \dfrac{D^{*} - 0.775}{0.044}\right)\)
\(0.819 \le D^{*} < 0.895\) \(0.05 + 0.05\left(1 - \dfrac{D^{*} - 0.819}{0.076}\right)\)
\(0.895 \le D^{*} < 0.995\) \(0.025 + 0.025\left(1 - \dfrac{D^{*} - 0.895}{0.100}\right)\)
\(0.995 \le D^{*} < 1.035\) \(0.01 + 0.015\left(1 - \dfrac{D^{*} - 0.995}{0.040}\right)\)
\(D^{*} \ge 1.035\) \(0.01\), printed with a less-than prefix

So the reportable p-value range is exactly \(0.01\) to \(0.15\). Outside the table the value is pinned to the nearer endpoint and printed with a prefix, for example > 0.15 for a sample that agrees closely with the normal model.

Kolmogorov-Smirnov also requires variation in the data: when the standard deviation is zero, no statistic and no p-value are reported.

Used by

See Also

References

  1. Massey, F. J. (1951). The Kolmogorov-Smirnov test for goodness of fit. Journal of the American Statistical Association, 46(253), 68-78.
  2. Lilliefors, H. W. (1967). On the Kolmogorov-Smirnov test for normality with mean and variance unknown. Journal of the American Statistical Association, 62(318), 399-402.
  3. Stephens, M. A. (1974). EDF statistics for goodness of fit and some comparisons. Journal of the American Statistical Association, 69(347), 730-737.
  4. D'Agostino, R. B., and Stephens, M. A. (1986). Goodness-of-Fit Techniques. Marcel Dekker.