Two-Sample Kolmogorov-Smirnov Test
Also known as: KS two-sample test, two-sample KS test, İki Örneklem Kolmogorov-Smirnov Testi
The two-sample Kolmogorov-Smirnov test is a nonparametric procedure that asks whether two independent groups are drawn from the same continuous distribution. Building on Smirnov's 1948 tables, it compares the empirical cumulative distribution functions (CDFs) of the two samples and uses their maximum absolute distance as the test statistic.
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
Use it to compare two independent groups on a continuous measurement when you do not want to assume normality and you care about any difference in the whole distribution — not just the mean. It suits data that are continuous, split into two independent groups, with a reasonable sample size (around 20 or more per the StatWise default). Note that tied (repeated) values can affect the result, since the test is built for genuinely continuous data.
Strengths & limitations
- Distribution-free: it makes no normality assumption and works on any continuous data.
- Detects differences in shape, location, and scale simultaneously, not just a shift in the mean.
- Simple and easy to apply, with a single interpretable statistic — the maximum CDF gap.
- Statistical power is low in very small samples (n < 10); a permutation test is preferred there.
- With fewer than 5 observations a comparison of empirical CDFs is essentially meaningless.
- Tied values violate the continuity assumption and can distort the statistic and its p-value.
Frequently asked
How is the two-sample KS test different from a t-test or Mann-Whitney test?
A t-test compares means and a Mann-Whitney test compares ranks (a stochastic shift). The KS test compares the entire distributions, so it can flag differences in spread or shape even when the central tendencies match.
What does the D statistic actually measure?
D is the largest vertical distance between the two empirical cumulative distribution functions. The bigger this maximum gap, the stronger the evidence that the two samples come from different distributions.
Do tied values cause problems?
Yes. The test assumes continuous data, so repeated (tied) values can affect the statistic and the p-value. If your data are heavily tied or discrete, treat the result cautiously.
What should I do with very small samples?
With n below 10 the KS test has little power, and below 5 the CDF comparison is meaningless. A permutation test (or bootstrap inference for tiny samples) is the better choice.
Sources
- 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 ↗
- Conover, W. J. (1999). Practical Nonparametric Statistics (3rd ed.). Wiley. ISBN: 978-0471160687
How to cite this page
ScholarGate. (2026, June 1). Two-Sample Kolmogorov-Smirnov Test. ScholarGate. https://scholargate.app/en/statistics/kolmogorov-smirnov-2sample
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.
- Levene and Brown-Forsythe TestStatistics↔ compare
- Mann-Whitney U testStatistics↔ compare
- Permutation TestStatistics↔ compare