# Kolmogorov - Smirnov test


## KS

Quantify distance between expected and observed CDF

. . .

KS statistic:

$$
  D_N = \text{sup}_x |F_N(x) - F(x)|
$$

- $F(x)$ is the expected CDF
- $F_N(x)$ is the empirical CDF of $N$ sampled points
  - sort points in ascending order
  - number of points preceding the point normalized by $N$


## KS

$H_0$: points sampled according to $F(x)$

. . .

If $H_0$ is true:

- $\sqrt{N}D_N \xrightarrow{N \rightarrow + \infty} K$

Kolmogorov distribution with CDF:

$$
  P(K \leqslant K_0) = 1 - p = \frac{\sqrt{2 \pi}}{K_0}
  \sum_{j = 1}^{+ \infty} e^{-(2j - 1)^2 \pi^2 / 8 K_0^2}
$$

. . .

a $p$-value can be computed

- At 95% confidence level, $H_0$ cannot be disproved if $p > 0.05$
