Português

Kolmogorov-Smirnov test

Goodness of fit and normality · reference distribution: D (Kolmogorov)

When to use it

Compare a sample with a fully specified theoretical distribution.

Null hypothesis

The data follow the distribution F₀.

Assumptions

Test statistic

D = \sup_x \left| F_n(x) - F_0(x) \right|

How to report it

D = 0.12, p = .43

In R and Python

R
ks.test(x, "pnorm", mean = 0, sd = 1)
Python
stats.kstest(x, "norm", args=(0, 1))

In Python, stats is scipy.stats and np is numpy.

Variants and alternatives

Where it sits in the catalog

Goodness of fit and normality. Goodness of fit: do the data follow the expected distribution? Normality tests are the most common case and check an assumption of parametric tests.

In the decision tree

  1. What do you want to do? Check an assumption or the distribution of the data
  2. What do you want to check? Whether the data follow another continuous distribution
  3. Are the parameters of the distribution known in advance? Yes

Open the decision tree