CHAPTER 08 · TOPIC 03
Kruskal–Wallis Test
Compare three or more independent groups with pooled ranks, a chi-square approximation, tie correction, and post hoc procedures.
On this page
The Kruskal–Wallis test is a rank-based method that compares three or more independent groups and is a rank-based analogue of one-way ANOVA. We combine and rank all observations and measure how far the group mean rank deviates from the common center.
Study Design and Hypotheses#
- The outcome is at least ordinal
- Observations between groups are independent and each observation belongs to only one group.
- The test is not appropriate for repeated measurements
- If interpreted as a median difference, the group distributions have approximately the same shape.
Pool and Rank All Observations#
Assign the average of the occupied ranks to tied values. The sum of all ranks is N(N+1)/2, and their common center is (N+1)/2. Under H₀, each group’s mean rank should lie near this value.
Kruskal–Wallis Statistic#
Chi-square approximation and degrees of freedom#
Because the total rank sum across k groups is fixed, only k−1 rank sums can vary freely. For small samples or severe imbalance, consider exact or permutation methods. Having roughly five observations per group is only a guideline for the chi-square approximation and is unrelated to the expected-cell-count rule used for contingency tables.
Tie correction#
Post Hoc Comparisons after a Significant Test#
The significance of the overall test only indicates that at least one group is different. Use Dunn’s test or planned rank contrasts, and adjust multiplicity using Holm, Bonferroni, etc.
- Perform the overall Kruskal–Wallis test
- If significant, perform Dunn’s test or planned rank contrasts
- Adjust for multiple comparisons
- Report each group’s n, median, IQR, and mean rank, together with H, df, p value, and an effect size
| Item | One-way ANOVA | Kruskal–Wallis |
| Input | Raw values | Pooled ranks |
| Comparison | Means | Mean ranks / distributions |
| Statistic | F | H |
| Reference distribution | F | χ²(k−1) |
| Post hoc | Tukey and related methods | Dunn and related methods |