PickMyTest

Kruskal-Wallis Test

Nonparametric comparison of three or more independent groups

Kruskal-Wallis Test#

The Kruskal-Wallis test (also: H-test) is the nonparametric alternative to one-way analysis of variance (ANOVA). It tests whether the central tendency of three or more independent groups differs significantly.

When to Use#

Use the Kruskal-Wallis test when you want to:

  • Compare three or more independent groups
  • The dependent variable is at least ordinally scaled
  • The assumptions of ANOVA (normality, homogeneity of variance) are not met
  • The samples are small

Assumptions#

  • Independence of observations
  • At least ordinal scale of measurement for the dependent variable
  • Similar distribution shape across all groups (for interpretation as median comparison)
  • Random sampling

Formula#

All observations are ranked together. The test statistic HH is calculated as:

H=12N(N+1)βˆ‘j=1kRj2njβˆ’3(N+1)H = \frac{12}{N(N+1)} \sum_{j=1}^{k} \frac{R_j^2}{n_j} - 3(N+1)

where NN is the total number of observations, kk is the number of groups, njn_j is the number of observations in group jj, and RjR_j is the rank sum of group jj.

A correction is applied for ties:

Hcorr=H1βˆ’βˆ‘(ti3βˆ’ti)N3βˆ’NH_{\text{corr}} = \frac{H}{1 - \frac{\sum (t_i^3 - t_i)}{N^3 - N}}

Example#

Practical Example: Customer Satisfaction

A company wants to compare customer satisfaction (scale 1–5) across three different store locations:

  • Store A (n=25): City center
  • Store B (n=30): Shopping mall
  • Store C (n=22): Suburb

Since the satisfaction scale is ordinal and the normality assumption is not tenable, the Kruskal-Wallis test is used. If the result is significant, pairwise comparisons follow (e.g., Dunn's test).

Effect Size#

Eta-squared (Ξ·2\eta^2) based on the H statistic:

Ξ·H2=Hβˆ’k+1Nβˆ’k\eta^2_H = \frac{H - k + 1}{N - k}
Effect SizeΞ·2\eta^2
Small0.01
Medium0.06
Large0.14

Further Reading

  • 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.
  • Field, A. (2018). Discovering Statistics Using IBM SPSS Statistics (5th ed.). SAGE.