Kolmogorov-Smirnov test
From Wikipedia, the free encyclopedia
In statistics, the Kolmogorov – Smirnov test (often called the K-S test) is used to determine whether two underlying one-dimensional probability distributions differ, or whether an underlying probability distribution differs from a hypothesized distribution, in either case based on finite samples.
The one-sample KS test compares the empirical distribution function with the cumulative distribution function specified by the null hypothesis. The main applications are testing goodness of fit with the normal and uniform distributions. For normality testing, minor improvements made by Lilliefors lead to the Lilliefors test. In general the Shapiro-Wilk test or Anderson-Darling test are more powerful alternatives to the Lilliefors test for testing normality.
The two-sample KS test is one of the most useful and general nonparametric methods for comparing two samples, as it is sensitive to differences in both location and shape of the empirical cumulative distribution functions of the two samples.
Contents |
[edit] Mathematical statistics
The empirical distribution function Fn for n observations yi is defined as
The two one-sided Kolmogorov-Smirnov test statistics are given by
where F(x) is the hypothesized distribution or another empirical distribution. The probability distributions of these two statistics, given that the null hypothesis of equality of distributions is true, does not depend on what the hypothesized distribution is, as long as it is continuous.
Knuth gives a detailed description of how to analyze the significance of this pair of statistics.[1] Many people use max(Dn+, Dn−) instead, but the distribution of this statistic is more difficult to deal with.
[edit] Miscellaneous
When the underlying independent variable is cyclic, as with day of the year or day of the week, then Kuiper's test is more appropriate. Numerical Recipes is a good source of information on this.
Furthermore, the Kolmogorov-Smirnov test is more sensitive at points near the median of the distribution than at its tails. The Anderson-Darling test provides equal sensitivity at the tails.
[edit] See also
- Andrey Kolmogorov
- Lilliefors test
- Jarque-Bera test
- Shapiro-Wilk test
- Anderson-Darling test
- Cramer-von-Mises test
[edit] Notes
- ^ Donald E. Knuth, The Art of Computer Programming, vol. 2, third edition, p. 48–55.
[edit] External links
- One-sided KS test explanation
- JavaScript implementation of one- and two-sided tests
- Numerical Recipes (ISBN 0-521-43108-5) is a prime resource for this sort of thing (see http://www.nr.com/nronline_switcher.html for a discussion).
- The Legacy of Andrei Nikolaevich Kolmogorov
- Short introduction
- Online calculator with the K-S test