Compare › Non-parametric

Kruskal-Wallis test

The Kruskal-Wallis H test compares k ≥ 2 independent groups on ranks — the non-parametric counterpart to one-way ANOVA.

What is Kruskal-Wallis test?

Pool all observations, rank them, then compare the per-group mean ranks via the H statistic, which is approximately χ²(k − 1) under H₀ (all groups have the same distribution).

Same caveat as Mann-Whitney: K-W is a test of stochastic dominance / location shift only when all groups share the same distributional shape; with unequal shapes a significant result can come from any difference.

Post-hoc Dunn's test is the standard pairwise follow-up — it operates on the same ranks and accepts BH / Bonferroni / Holm adjustment. Don't follow K-W with pairwise Mann-Whitneys on un-pooled ranks; that's a different test and the multiple-testing correction won't behave as you expect.

When should I use Kruskal-Wallis test?

  • Three or more independent groups with ordinal or non-normal data.
  • When ANOVA's residual normality assumption is clearly violated and n per group is small.

What data does it need?

Numeric response + categorical grouping column.

What does it report?

H statistic, df, p, ε² effect size. Optional post-hoc Dunn with adjusted p.

What does it assume?

  • Independent samples within and between groups.
  • Ordinal or continuous outcome.
  • Similar distributional shapes across groups (for the location-shift interpretation).

How do I interpret the result?

ε² ≈ (H − k + 1) / (n − k): proportion of rank variance explained by group. Same Cohen-style anchors as η² (0.01 small, 0.06 medium, 0.14 large).

See also