## Kolmogorov-Smirnov test.

Distribution free criterion for homogeneity testing.
Let assume that we have N = m + n observations x1...xm and y1...yn
Suppose:

1. All N observations X and Y are mutually independent.
2. All X derived from the entire assembly Π1.
3. All Y derived from the entire assembly Π2.

#### Method

Will test hypothesis that both populations Π1 and Π2 are identical, i.e.
both samples were derived from the single population. It can be rewrited:
H0: F(x) = G(x) ∀x.
To test our hypothesis we:

1. Arrange our observations X and Y: x1<x2<…<xm; y1<y2<…<yn.
2. Evaluate Kolmogorov-Smirnov statistic, which measures difference
   between empirical distribution functions, obtained with respect to
   samples X and Y:
   where Dm,n=max|Fn(x)-G(x)m|
3. When m and n tend to ∞, distribution of this statistic upon condition,
   that H0 hypothesis is true, tends to Kolmogorov distribution function:
4. So P-value = 1 - K(SCM).