Skip to main content

Kruskal-Wallis test

The Kruskal-Wallis test is a non-parametric method that compares medians across three or more independent groups by ranking all observations together, used when ANOVA's normal-distribution assumption is not met.

ByHoang TruongUpdated

See it move

Loading infographic...

Three delivery teams' nine wait times are ranked together from 1 to 9, giving rank sums of 15, 24 and 6. The test statistic H = (12 ÷ 90) × (15²/3 + 24²/3 + 6²/3) − 30 works out to 7.2, which exceeds the chi-square critical value of 5.99 for 2 degrees of freedom, so the teams' distributions are not all equal.

Where it fits
SubjectData Analysis & StatisticsAdvancedTopicCommon Significance TestsAdvanced

The formula

LaTeX
H=12N(N+1)i=1kRi2ni3(N+1)H = \dfrac{12}{N(N+1)} \sum_{i=1}^{k}\dfrac{R_i^2}{n_i} - 3(N+1)

Variables

Total number of observations across all groups
Number of groups
Sum of ranks in group i
Number of observations in group i

Converts rank sums into a test statistic that follows a chi-square distribution with k − 1 degrees of freedom under the null hypothesis of equal distributions.

Kruskal-Wallis test — Edlintics Glossary