Kolmogorov-Smirnov Test
Kolmogorov-Smirnov Goodness-of-Fit Test · Also known as: KS test, K-S test, one-sample KS test, Kolmogorov-Smirnov Testi
The Kolmogorov-Smirnov (KS) test is a nonparametric goodness-of-fit test that assesses whether a sample comes from a specified theoretical distribution, such as the normal or exponential. First formalised by Andrey Kolmogorov in 1933 and further developed by Nikolai Smirnov in 1948, it compares the empirical cumulative distribution function of the observed data against a target theoretical CDF and quantifies their maximum absolute deviation.
Read the full method
Sign in with a free account to read this section.
Method map
The neighbourhood of related methods — select a node to explore.
When to use it
Apply the KS test when you need to verify whether a continuous variable follows a specific theoretical distribution before proceeding with parametric methods that require normality or another distributional form. The variable must be continuous; the test is not suitable for discrete or ordinal data. A minimum sample size of around 20 is advisable, but the test loses power relative to Shapiro-Wilk for detecting departures from normality in large samples (roughly n ≥ 50). When the distribution parameters are estimated from the data rather than specified in advance, the Lilliefors correction should be applied, because standard KS critical values are too conservative in that situation.
Strengths & limitations
- Fully nonparametric: makes no assumptions about the shape of the underlying distribution.
- Works with the complete continuous CDF, so no arbitrary binning of data is required.
- Sensitive to differences in the entire distribution, including tails and location shifts.
- Conceptually transparent and easy to visualise as a gap between two CDF curves.
- Less powerful than Shapiro-Wilk for detecting non-normality, especially in larger samples.
- Not valid for discrete or ordinal variables.
- When distribution parameters are estimated from the sample, standard critical values are anticonservative unless the Lilliefors correction is applied.
- Equally sensitive across all parts of the distribution, so it may miss concentrated departures near the tails that specialised tests such as Anderson-Darling would detect.
Frequently asked
How does the KS test differ from the Shapiro-Wilk test for normality?
Both test whether data are normally distributed, but they differ in approach and power. Shapiro-Wilk is designed specifically for normality and is generally more powerful than the KS test, especially for small to moderate samples (n ≤ 50). The KS test is more general — it can test against any fully specified continuous distribution, not just normal — but this generality comes at the cost of lower power for the normality case.
Can I use the KS test when I estimated the mean and standard deviation from my data?
Not with the standard version. When you estimate the distribution parameters from the same sample you are testing, the critical values are too conservative (too lenient), meaning you will reject less often than you should. In this common situation, use the Lilliefors test, which adjusts the critical values specifically for estimated normal-distribution parameters.
What is the difference between the one-sample and two-sample KS test?
The one-sample KS test compares a single empirical CDF against a theoretical CDF that is fully specified in advance. The two-sample KS test compares the empirical CDFs of two independent samples against each other to decide whether they were drawn from the same population distribution, without specifying what that distribution is.
Does the KS test work for ordinal or count data?
No. The theoretical justification of the KS statistic relies on the data being continuously distributed, so the empirical CDF is a true staircase that can be compared point-by-point against a smooth theoretical curve. For ordinal or count data, the discreteness violates this assumption and the reported p-values will be incorrect; use chi-square goodness-of-fit or appropriate discrete tests instead.
Sources
- Kolmogorov, A. N. (1933). Sulla determinazione empirica di una legge di distribuzione. Giornale dell'Istituto Italiano degli Attuari, 4, 83–91. link ↗
- Smirnov, N. V. (1948). Table for estimating the goodness of fit of empirical distributions. Annals of Mathematical Statistics, 19(2), 279–281. DOI: 10.1214/aoms/1177730256 ↗
- Massey, F. J. (1951). The Kolmogorov-Smirnov test for goodness of fit. Journal of the American Statistical Association, 46(253), 68–78. DOI: 10.2307/2280095 ↗
- Conover, W. J. (1999). Practical Nonparametric Statistics (3rd ed.). Wiley. ISBN: 978-0471160687
How to cite this page
ScholarGate. (2026, June 1). Kolmogorov-Smirnov Goodness-of-Fit Test. ScholarGate. https://scholargate.app/en/statistics/kolmogorov-smirnov
Which method?
Set this method beside its closest kin and read them side by side — the library lays the books on the table; the choice is yours.
- Lilliefors TestStatistics↔ compare
- Two-Sample Kolmogorov-Smirnov TestStatistics↔ compare