Skip to content
Statistics

What is the Kolmogorov-Smirnov test?

A nonparametric test of whether a sample follows a given distribution, or whether two samples come from the same one. Its statistic D is the largest vertical gap between the two cumulative distribution functions.

datasciencetrivia.com

Card 1 of 228. Answer: A nonparametric test of whether a sample follows a given distribution, or whether two samples come from the same one. Its statistic D is the largest vertical gap between the two cumulative distribution functions.

Created by santiviquez

About · Quizzes · History of AI · To suggest new questions or report an error send me a dm.

The longer answer

The one-sample Kolmogorov-Smirnov test compares a sample's empirical CDF with a reference distribution; the two-sample test compares two empirical CDFs. The statistic is D = max |F₁(x) − F₂(x)|, and for continuous data its distribution under the null hypothesis doesn't depend on what the underlying distribution is. It reacts to any difference: location, spread or shape.

Example: a drift check compares 10,000 transaction amounts from training with 10,000 from last week and gets D = 0.03. With samples that large, the 5% critical value is about 0.019, and the p-value is about 0.0002, so the shift is significant. Yet the two CDFs never differ by more than 3 percentage points, which may not matter at all to the model.

That is the point interviewers press: with big samples almost any difference is significant, so in monitoring, threshold on D itself or use a distance such as Wasserstein rather than the p-value. The test assumes continuous data (ties make it conservative), so use chi-squared for categorical features, and it is least sensitive in the tails, where Anderson-Darling does better. Andrey Kolmogorov published the one-sample test in 1933, Nikolai Smirnov the two-sample version in 1939.

All questions