Kruskal-Wallis Test
The non-parametric analogue of one-way ANOVA — comparing three or more groups using ranks rather than raw values.
The Kruskal-Wallis test is the nonparametric analog of one-way ANOVA. It tests whether independent groups have the same distribution, without assuming normality.
Null hypothesis: all groups have the same distribution (or equivalently, the same population median).
Procedure:
- Pool all observations and assign ranks (smallest = 1, handle ties by averaging)
- Compute the mean rank for each group:
- Test statistic:
- Under , for large samples
- Reduces to the Mann-Whitney U test exactly when groups
- Uses only rank information, so it's robust to outliers and doesn't require normality
- Tests equality of entire distributions, not just medians — differences in spread or shape can also trigger rejection
- is always non-negative, with larger values indicating more uneven rank distribution across groups
- Interpreting a significant result as "the medians differ": the null hypothesis is equality of distributions — groups with equal medians but different variances or shapes can still trigger rejection
- Skipping multiplicity correction for post-hoc comparisons: a significant omnibus result only says some group differs; pairwise follow-ups need correction (Dunn's test or Bonferroni-adjusted Mann-Whitney)
Three groups of students (same size , total ). After pooling and ranking:
- Method A: ranks ,
- Method B: ranks ,
- Method C: ranks ,
Compare to (): , reject .
The Kruskal-Wallis test tells you some groups differ. What must you do to determine which groups differ?
Solution
Run post-hoc tests — pairwise Mann-Whitney U tests between groups. But with groups, there are pairs, leading to multiple testing concerns. You must apply a correction such as Bonferroni (adjust by dividing by number of comparisons) or Dunn's test (a procedure specifically designed for post-hoc comparisons after Kruskal-Wallis, using the original ranks).
Dunn's test is preferred because it uses the pooled variance from the full Kruskal-Wallis ranking, making it more powerful than separate Mann-Whitney tests with Bonferroni correction.