Image by Christo Anestev from Pixabay

Kolmogorov-Smirnov(K-S) Test

Comparing Distributions

Seyma Tas
4 min readMar 30, 2021

Kolmogorov-Smirnov(K-S) test

In statistics, Kolmogorov-Smirnov(K-S) test is a non-parametric test of the equality of the continuous, one-dimensional (univariate) probability distributions.

K-S test compares the two cumulative distributions and returns the maximum difference between them.

One-sample K-S test or goodness of fit test was developed by Andrey Nikolayevich Kolmogorov in 1933. Its purpose is to compare the overall shapes of two sample distributions.

Two-sample K-S test was developed by Nikolai Smirnov in 1939. Its purpose is to compare one sample to a known statistical distribution.

Parametric and non-parametric statistics

We can separate the statistical tests into two: Parametric and non-parametric tests.

Parametric tests are suitable for normally distributed data and they have more statistical power than nonparametric ones.

  • Independent samples t-test and paired samples t-test
  • Regression

Nonparametric tests or distribution-free tests are suitable for any continuous data. They can be used with a very small sample size and outliers.

  • Kolmogorov-Smirnov test
  • Mann-Whitney-U test
  • Kruskal-Wallis test

Null Hypothesis

One-sample K-S test:

If we are comparing one sample distribution with a known sample, the null hypothesis is:

The sample does not come from a different distribution

Two-sample K-S test:

If we are comparing two sample distributions, the null hypothesis is:

Two samples are from the same distribution.


Probability Density Function(PDF)is a relative likelihood that the value of the random variable would equal that sample.

Cumulative Distribution Function(CDF): A hypothetical model of a distribution



Seyma Tas