Kolmogorov–Smirnov test

The Kolmogorov -Smirnov test (KS test) (after Andrei Nikolaevich Kolmogorov and Nikolai Vasilyevich Smirnov ) is a statistical test for agreement of two probability distributions.

With its help can be checked on the basis of random sampling, if

  • Two random variables have the same distribution or
  • A random variable of a probability distribution previously adopted follows.

As part of the latter ( One-Sample ) application problem, it also speaks of the Kolmogorov - Smirnov goodness of fit test (KSA test).

Conception

The concept will be explained on the basis of goodness of fit tests, the comparison of two features is to be understood analogously. One considers a statistical feature X, its distribution in the population is unknown. The two sides formulated hypotheses are then:

Null hypothesis:

( The random variable X has the probability distribution F0. )

Alternative hypothesis:

( The random variable X has a different probability distribution as F0. )

The Kolmogorov -Smirnov test compares the empirical distribution function, using the test statistic

Where sup denotes the supremum.

After Gliwenko - Cantelli theorem, the empirical distribution strives uniformly to the distribution function of X ( ie under H0 against F0). Under H1 should therefore get larger values ​​than under H0. The test statistic is independent of the hypothetical distribution F0. Is the value of the test statistic is larger than the corresponding tabulated critical value, the null hypothesis is rejected.

Procedure for one-sample problem ( fit test )

Are from a real random variables observed values ​​() before, going where it is assumed that they are already sorted in ascending order. From these observations, the relative cumulative function (sum frequency, empirical distribution function ) is determined. This empirical distribution is compared with the corresponding hypothetical distribution of the Universe: The value of the probability distribution at point xi is determined: F0 ( xi). If X actually obeys this distribution, would the observed frequency S ( xi) and the expected frequency F0 ( xi) be about the same.

If it is continuous, the test statistic can be calculated in the following manner: It can be the absolute differences for each

And

Calculated, which is set. It is from all the differences, then determines the absolute biggest difference. When exceeding a critical value, the hypothesis is rejected at a level of significance.

Until the critical values ​​are tabulated. For larger they are approximated using a simple formula:

Here the confidence intervals in ( for ):

Procedure for two-sample problem

If, then, in addition to the above random variables corresponding random variable before ( with parent values ​​), it can be verified by the two-sample test whether the same distribution function follow. From both observations the relative sum functions or be determined. These are then compared to the analogous one-sample test based on their absolute differences:

And

The null hypothesis is rejected at a significance level, if the critical value exceeds. For small values ​​of and the critical values ​​are tabulated. For large values ​​of n and m, the null hypothesis is rejected if

Which can be calculated for large and approximated as.

Application Examples

  • The Kolmogorov -Smirnov test can be used for testing of random numbers, for example, to check whether the random numbers of a certain distribution (eg uniform distribution ) follow.
  • Some (parametric ) statistical procedures assume that the studied variables are normally distributed in the population. The KSA test can be used to test whether this assumption must be discarded or can be retained (subject to error ).

Numerical example

In a company that makes high-quality perfumes, was the quantity filled for n = 8 bottles measured at a bottling plant in the framework of quality assurance. There is the feature x: quantity filled in ml

It should be considered whether to add the known parameters of the distribution of X are.

First, at a significance level α = 0.05 is to be tested whether the characteristic X in the population is at all normally distributed with known parameters and, hence,

With Φ as a normal distribution symbol. It results in the following table:

Xi here denote the ith observation, S (x ) to the value of the sum function of the i th observation, and F0 (x ), the value of the normal distribution function at the location xi of the above-mentioned parameters. The next columns show the above-mentioned differences. The critical value which resulted in the rejection and would be the amount of 0,457. The largest absolute deviation in the table is 0.459 in the 3rd line. This value is greater than the critical value, therefore, the hypothesis is rejected just. It is also supposed that the distribution hypothesis is false. This may mean that the quantity filled is no longer normally distributed, that the average filling quantity has shifted or that the variance of the batch quantity has changed.

Properties of the KS tests

In the one-sample problem of the KS test in contrast to the χ ² test is also suitable for small samples.

The Kolmogorov -Smirnov test is a nonparametric test very stable and insensitive. Originally, the test for continuously distributed metric characteristics has been developed; but it can also be used for discrete and even wrestled scaled features. In these cases, the test is somewhat less clear-cut, ie the null hypothesis is rejected less frequently than in the continuous case.

A great advantage is that the underlying random variable has not follow normal distribution. The distribution of the test statistic dn is the same for all ( continuous ) distributions. This makes the test very versatile, but also due to its disadvantage, because the KS test generally has a low statistical power. The Lilliefors test is an adaptation of the Kolmogorov -Smirnov test for testing for normal distribution. Possible alternatives to the KS test is the Cramer- von Mises test that is suitable for both applications, as well as the Anderson -Darling test for the comparison of a sample with a hypothetical probability distribution.

458935
de