Skip to content
Omnikalc

Kruskal–Wallis H test: the non-parametric one-way ANOVA

Compare three or four independent groups from their rank sums and sizes: H statistic, degrees of freedom, p-value from the chi-square distribution and effect size.

Updated on
Your inputs

Value out of range

Value out of range

Value out of range

Value out of range

Value out of range

Value out of range

Value out of range

Value out of range

Results

p-value (chi-square approximation)

0.03444

Statistically significant: p is below α, so reject the null hypothesis
H statistic
6.737
Degrees of freedom (groups − 1)
2
Critical H at α
5.991
Total number of observations N
18
Sum of the rank sums entered
171.0
Rank sums are consistent with N
Expected total N(N + 1) ÷ 2
171.0
Effect size η²(H) = (H − k + 1) ÷ (N − k)
0.316

What the Kruskal–Wallis test does

The Kruskal–Wallis H test extends the Mann–Whitney test to three or more independent groups. It is the non-parametric counterpart of one-way ANOVA: instead of comparing means, it compares the average ranks of the groups after all observations have been pooled and ranked from 1 to N. Use it when the data are skewed, ordinal or contain outliers, or when group variances are very unequal.

The formula

H = 12 ÷ (N(N + 1)) × Σ (Rᵢ² ÷ nᵢ) − 3(N + 1)

  • Rᵢ is the rank sum of group i and nᵢ its size;
  • N is the total number of observations.

When every group has at least five observations, H follows approximately a chi-square distribution with k − 1 degrees of freedom, where k is the number of groups. The calculator also checks that your rank sums add up to N(N + 1) ÷ 2, a quick way to catch a ranking mistake.

Example

Three groups of 6 observations, with rank sums 33, 57 and 81:

  • N = 18, and the rank sums total 171 = 18 × 19 ÷ 2, as they should;
  • Σ Rᵢ² ÷ nᵢ = (1,089 + 3,249 + 6,561) ÷ 6 = 1,816.5;
  • H = 12 ÷ 342 × 1,816.5 − 57 ≈ 6.74, with 2 degrees of freedom;
  • p ≈ 0.034: significant at α = 0.05; the critical H is 5.99;
  • the effect size η²(H) ≈ 0.32 is large.

How to get the rank sums

  1. Pool all values and sort them.
  2. Give rank 1 to the smallest value. Tied values share the average of the ranks they would occupy.
  3. Add up the ranks of each group.

After a significant result

A significant H says that at least one group differs, not which one. Follow up with pairwise comparisons, such as Dunn’s test or Mann–Whitney tests, with a Bonferroni or Holm correction for the number of comparisons.

Limits

  • Groups must be independent. For repeated measurements on the same subjects, use the Friedman test.
  • Many ties call for a tie correction, which slightly increases H; the uncorrected value used here is conservative.
  • With very small groups (fewer than five each), use exact tables.
  • Effect size guidelines for η²(H) follow those of ANOVA: about 0.01 small, 0.06 medium and 0.14 large.

Frequently asked questions

What is the Kruskal–Wallis test?

A rank-based test of whether three or more independent groups come from the same distribution: the non-parametric one-way ANOVA.

How many degrees of freedom does the Kruskal–Wallis test have?

The number of groups minus 1.

What do I do after a significant Kruskal–Wallis test?

Run pairwise comparisons such as Dunn's test, with a Bonferroni or Holm correction.

What if my data are repeated measures?

Use the Friedman test, which handles the same subjects measured under several conditions.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.