Two-sample Kolmogorov-Smirnov test (source code)

= Two-sample Kolmogorov-Smirnov test
{title2=$D_{n,m}=\sup_x|F_n(x)-G_m(x)|$}

The <two-sample Kolmogorov-Smirnov test> compares two <empirical distribution functions> from <independent> samples, each internally <independent and identically distributed>, under the <null hypothesis> that their underlying <probability distributions> coincide. Both curves are estimated from data, so calibration depends on both <sample sizes>; the usual asymptotic scaling is $\sqrt{nm/(n+m)}D_{n,m}$. Tied data can be handled by an appropriate <permutation test> under the required <exchangeability>, rather than by assuming the untied continuous-null law.<Kolmogorov-Smirnov Tests (ks.test, R stats documentation)>{ref}