Kruskal–Wallis test
A rank-based alternative to one-way ANOVA that tests whether k independent groups come from the same distribution.
- Mean rank of group i in the pooled sample (average ranks for ties).
- Group size, total size, number of groups.
- Size of each group of tied values.
- The Kruskal–Wallis statistic.
When to use
Three or more independent groups with an ordinal outcome or skewed quantitative data with small groups (e.g. delays by airline).
Assumptions
Independent observations; ordinal or continuous outcome. Interpreting it as comparing medians requires similarly shaped distributions. The χ² approximation is rough when groups have fewer than about 5 observations.
How to interpret
A small p-value is evidence that at least one group tends to have larger values than another. Follow up with pairwise Mann–Whitney tests (or Dunn's test) with a multiple-comparison adjustment.
Common mistakes
- Calling it "ANOVA on medians" without checking shapes.
- Forgetting the follow-up adjustment for pairwise comparisons.
Example
Groups (2.1, 3.4, 2.8, 3.0), (4.2, 3.9, 4.8, 3.6), (3.1, 2.5, 3.3, 2.7). Mean ranks 4.5, 10.5, 4.5 (overall mean rank 6.5). on 2 df, ; . The second group tends to be higher (approximation rough with 4 per group).