Do two groups of measurements follow the same distribution, or does a sample fit a theoretical curve? The Kolmogorov-Smirnov test calculator takes the type of test, the sample sizes, the maximum distance D and the significance level, and gives the asymptotic p-value with a verdict, the effective sample size, the critical value of D and the ratio of the observed D to the critical value.
How the calculation works
- Choose the type of test: one sample compared with a reference distribution, or two samples compared with each other.
- Enter the sample sizes and the maximum distance D between the two cumulative distribution curves, from your software or your plot.
- The calculator computes the effective sample size (n for one sample, n₁n₂/(n₁ + n₂) for two) and the critical value D = c(α) / √n, where c(α) = √(−ln(α/2)/2).
- Read the asymptotic p-value and compare it with the significance level. If D is above the critical value, the p-value is below α and the distributions differ.
Example
Two samples of 50 and 40 points have a maximum distance D = 0.30 between their cumulative curves. The effective sample size is 50 × 40 / 90 = 22.2. At α = 0.05, the critical value is 1.358 / √22.2 = 0.288. The observed D is 1.04 times the critical value, and the p-value is about 0.029, which is below 0.05, so the two distributions differ significantly.
Why it matters
The K-S test is a standard check in data science, quality control and the natural sciences. It tells you whether a model fits data, whether a process has drifted between two periods or whether a new batch behaves like a reference batch, without assuming a normal distribution.
Good to know
The calculator does not compute D from raw data, so you need it from another tool or a plot. The p-value is asymptotic and approximate for very small samples, and it assumes continuous data and a fully specified reference distribution. A significant result says the distributions differ, but not how. Combine the test with a plot of the two curves.
Related tools
The ANOVA calculator compares group means, the chi-square goodness of fit calculator compares counts with a model, the confidence interval calculator measures uncertainty, and the correlation significance calculator tests a linear link.