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 is calculated as:
where is the total number of observations, is the number of groups, is the number of observations in group , and is the rank sum of group .
A correction is applied for ties:
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 () based on the H statistic:
| Effect Size | |
|---|---|
| Small | 0.01 |
| Medium | 0.06 |
| Large | 0.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.