SciPy

scipy.stats.kruskal

scipy.stats.kruskal(*args)[source]

Compute the Kruskal-Wallis H-test for independent samples

The Kruskal-Wallis H-test tests the null hypothesis that the population median of all of the groups are equal. It is a non-parametric version of ANOVA. The test works on 2 or more independent samples, which may have different sizes. Note that rejecting the null hypothesis does not indicate which of the groups differs. Post-hoc comparisons between groups are required to determine which groups are different.

Parameters :

sample1, sample2, ... : array_like

Two or more arrays with the sample measurements can be given as arguments.

Returns :

H-statistic : float

The Kruskal-Wallis H statistic, corrected for ties

p-value : float

The p-value for the test using the assumption that H has a chi square distribution

Notes

Due to the assumption that H has a chi square distribution, the number of samples in each group must not be too small. A typical rule is that each sample must have at least 5 measurements.

References

[R235]http://en.wikipedia.org/wiki/Kruskal-Wallis_one-way_analysis_of_variance