Kruskal-Wallis Test
What you'll learn: How to extend rank-based comparison from two groups (Mann-Whitney) to three or more independent groups simultaneously.
The Core Idea
The Kruskal-Wallis test is the nonparametric cousin of one-way ANOVA. Just as the Mann-Whitney U test compares two independent groups without assuming normality, the Kruskal-Wallis test lets you compare three or more independent groups using ranks instead of raw values.
Think of it this way: You have multiple independent samples (say, test scores from four different teaching methods). Instead of assuming the data are normally distributed—which ANOVA requires—you rank all observations together from smallest to largest, then check whether the ranks are distributed similarly across groups.
How It Works
- Pool and rank: Combine all observations from all groups and assign ranks (1 = smallest, n = largest).
- Sum ranks per group: Calculate the sum of ranks for each group separately.
- Compute the H-statistic: A formula (similar in spirit to the F-statistic) measures whether rank sums differ more than chance would predict. Large differences in rank sums produce large H values.
- Compare to chi-squared distribution: Under the null hypothesis (all groups come from identical distributions), H approximately follows a chi-squared distribution with k − 1 degrees of freedom (k = number of groups).
If the H-statistic exceeds the critical value, you reject the null hypothesis—at least one group differs from the others.
When to Use It
- You have three or more independent groups
- Data are ordinal or continuous but violate normality assumptions
- You want a robust alternative to one-way ANOVA
Key Takeaway: The Kruskal-Wallis test generalizes the Mann-Whitney U test to compare three or more independent groups using rank-based methods, offering a distribution-free alternative to one-way ANOVA.