Skip to content

Kruskal-Wallis Test

Compare three or more independent groups' distributions using ranks, without assuming a normal model.

One group per line, comma-separated values. At least 3 groups required.

What this answers

This test answers "do three or more independent groups come from the same underlying distribution, or does at least one differ, using only the rank order of the combined data?" It is the rank-based counterpart to One-Way ANOVA, used when your data is skewed, ordinal, or too small to trust a normal-distribution assumption.

When to use it, and when not to

Use this when comparing three or more independent groups on data that is not roughly normal, has extreme values, or is ordinal rather than genuinely numeric. If your data looks reasonably normal with comparable spread across groups, One-Way ANOVA uses more information and is generally preferred.

How it is calculated

Every observation across all groups combined is ranked, with tied values receiving the average of their tied rank positions. The H statistic compares each group's rank sum against what would be expected if group membership had no effect, then applies a correction for ties. Under the null hypothesis, H approximately follows a chi-square distribution with degrees of freedom equal to the number of groups minus 1.

Worked example

For three ordered groups (1, 2), (3, 4), and (5, 6), where every value in one group is smaller than every value in the next: the combined ranks are 1 through 6 in exact group order, giving an H statistic of about 4.57 on 2 degrees of freedom, evidence of a real difference in location between these clearly separated groups.

Assumption audit

Calculated from your data: each group's rank sum, the total sample size, and whether any tied values exist (which triggers the tie-correction adjustment).
Evidence to review: whether groups have roughly similar distribution shapes. If shapes differ substantially, a significant result is best described as evidence of a distributional difference, not necessarily a difference in a specific statistic like the median.
You must verify: that groups are genuinely independent (not repeated measurements on the same subjects, which would need the Friedman test instead).

What this result does not mean

A significant omnibus result means the data provide evidence that at least one group's distribution differs from the others; it does not identify which specific groups differ, which requires a dedicated post-hoc rank-based comparison, never assumed from the omnibus result alone.

Limitations

This test only detects a difference somewhere among the groups, never which pair or pairs actually differ. With very small groups, its power to detect a real but modest difference is limited.