Skip to main content
BetaLucidstat is in beta. Results are checked against R, but always verify them against your source data.Send feedback via EZY Research

Kruskal–Wallis test

The non-parametric alternative to one-way ANOVA, with Dunn's pairwise comparisons.

6 min read

Try it

One click opens the “Teaching-method study” sample dataset with this test selected and the variables filled in. Or use your own data.

The Kruskal–Wallis test is the non-parametric alternative to one-way ANOVA. It compares three or more groups using the ranks of the data, so it does not assume normality.

When to use it

  • You are comparing three or more independent groups, and
  • the outcome is ordinal, or
  • the outcome is numeric but not normal in groups of fewer than 30.

The idea

All values are ranked together, and the groups' mean ranks are compared. The statistic H measures how far apart the mean ranks are. When the groups do not differ, H roughly follows a χ² distribution with (number of groups − 1) degrees of freedom. Lucidstat applies the tie correction, as R kruskal.test does.

  • Effect size ε² = H ÷ (n − 1) (Tomczak & Tomczak, 2014), with the same benchmarks as η²: .01 small, .06 medium, .14 large.
  • Pairwise comparisons use Dunn's test with Bonferroni-adjusted p-values (multiplied by the number of pairs), as in SPSS.

Worked example

The "Teaching-method study" sample compares motivation (a single 1–5 item) across three teaching methods (89 usable cases).

Medians, quartiles and mean ranks of motivation
MethodnMdnQ1Q3Mean rank
Active learning303.003.004.0045.78
Flipped293.003.004.0037.29
Lecture304.002.754.0051.67

Result: H(2) = 5.15, p = .076, ε² = .06.

How to read it

  • p = .076 is above .05: motivation does not differ significantly by teaching method.
  • When the overall test is not significant, don't interpret the pairwise comparisons. In Dunn's test, lecture vs flipped has an unadjusted p of .024, but after the Bonferroni adjustment it is .072, which is not significant.
  • ε² = .06 is around "medium". A p close to .05 with a medium effect may mean the sample was too small to confirm the effect; discuss it cautiously.
Reporting example (APA 7)

A Kruskal–Wallis test showed no significant difference in Motivation across levels of Method, H(2) = 5.15, p = .076.

Reporting example (Thai thesis style)

ผลการทดสอบ Kruskal–Wallis พบว่า แรงจูงใจจำแนกตามวิธีสอนไม่แตกต่างกันอย่างมีนัยสำคัญทางสถิติ (H(2) = 5.15, p = .076)

Common mistakes

  • Running Mann–Whitney tests on every pair without adjustment, which inflates the Type I error rate. Use Dunn's test with adjusted p-values.
  • Calling a pair significant because its unadjusted p is below .05. Look at the adjusted p.
  • Using it for three or more repeated measurements on the same people. That needs the Friedman test, which Lucidstat does not offer yet.

References

  • Dunn, O. J. (1964). Multiple comparisons using rank sums. Technometrics, 6(3), 241–252.
  • Kruskal, W. H., & Wallis, W. A. (1952). Use of ranks in one-criterion variance analysis. Journal of the American Statistical Association, 47(260), 583–621.
  • Tomczak, M., & Tomczak, E. (2014). The need to report effect size estimates revisited. Trends in Sport Sciences, 21(1), 19–25.

Try it

One click opens the “Teaching-method study” sample dataset with this test selected and the variables filled in. Or use your own data.

Related lessons