The Kruskal-Wallis test (H test) is a nonparametric statistical test used to compare three or more independent groups to determine if there are statistically significant differences between them. It is an extension of the Mann-Whitney U test, which is used for comparing two groups.
Unlike the one-way ANOVA, which assumes normality in data distribution, the Kruskal-Wallis test does not require the data to be normally distributed. Instead, it ranks the data, making it suitable for ordinal or non-normally distributed continuous data.
Key Characteristics
- Nonparametric: Does not assume a normal distribution, making it useful for skewed or ordinal data.
- Rank-based: Converts data to ranks instead of using raw values.
- Independent groups: Assumes that observations in different groups are independent of each other.
When to Use the Kruskal-Wallis Test
This test is applicable in the following scenarios:
- When comparing three or more independent groups.
- When the data is ordinal or not normally distributed.
- When sample sizes are small or unequal across groups.
The Kruskal-Wallis test is useful when the assumptions for one-way ANOVA are not met. Some common examples include: Medical Research, Social Sciences, Psychology Studies.
Hypotheses in the Kruskal-Wallis Test
- Null Hypothesis (H₀): All groups have the same central tendency and come from the same population.
- Alternative Hypothesis (H₁): At least one group has a different central tendency from the others.
How the Kruskal-Wallis Test Works
Instead of analyzing means, the Kruskal-Wallis test examines differences in the rank sums of the groups. The procedure involves the following steps:
Step 1: Rank the Data
- Combine all data from different groups.
- Assign ranks to the data, with tied values receiving the average of their ranks.
Step 2: Compute the Rank Sum
- Sum up the ranks for each group.
Step 3: Calculate the Test Statistic (H)
The Kruskal-Wallis test statistic H is given by:
H = \left[ \frac{12}{n(n+1)} \sum \frac{R_i^2}{n_i} \right] - 3(n+1)
Where:
- n = Total number of observations.
- ni = Number of observations in group iii.
- Ri = Sum of ranks for group iii.
- k = Number of groups.
Step 4: Determine the Critical Value
- Compare H to the Chi-square distribution with k − 1 degrees of freedom.
- If H exceeds the critical value, reject the null hypothesis.
Interpretation of Results
- If the p-value is less than the significance level (e.g., 0.05), at least one group differs significantly.
- If the p-value is greater than the significance level, we fail to reject the null hypothesis, meaning there is no strong evidence of differences among the groups..
Example: Evaluating Training Methods
A university wants to evaluate the effectiveness of three different training methods on student performance. A sample of 20 students was divided into three groups based on their training method:
- Video Lectures
- Books and Articles
- Classroom Training
The students' examination scores are as follows:
| Video Lecture | Books and Articles | Class Room Training |
|---|
| 76 | 80 | 70 |
|---|
| 90 | 80 | 85 |
|---|
| 84 | 67 | 52 |
|---|
| 95 | 59 | 93 |
|---|
| 57 | 91 | 86 |
|---|
| 72 | 94 | 79 |
|---|
| - | 68 | 80 |
|---|
Step 1: Identify Variables
- Independent Variable: Training method (3 levels)
- Dependent Variable: Examination scores
Step 2: State Hypotheses
- H₀: The mean exam scores across all training methods are equal (μ₁ = μ₂ = μ₃).
- H₁: At least one training method leads to different exam scores.
Step 3: Rank the Data
The scores from all groups are combined, sorted in ascending order and assigned ranks. If there are ties, the average rank is assigned.
| Rank | Score | Training Method |
|---|
| 1 | 52 | Classroom Training |
|---|
| 2 | 57 | Video Lecture |
|---|
| 3 | 59 | Books and Articles |
|---|
| 4 | 67 | Books and Articles |
|---|
| 5 | 68 | Books and Articles |
|---|
| 6 | 70 | Classroom Training |
|---|
| 7 | 72 | Video Lecture |
|---|
| 8 | 76 | Video Lecture |
|---|
| 9 | 79 | Classroom Training |
|---|
| 10.5 | 80 | Books and Articles |
|---|
| 10.5 | 80 | Classroom Training |
|---|
| 10.5 | 80 | Books and Articles |
|---|
| 13 | 84 | Video Lecture |
|---|
| 14 | 85 | Classroom Training |
|---|
| 15 | 86 | Classroom Training |
|---|
| 16 | 90 | Video Lecture |
|---|
| 17 | 91 | Books and Articles |
|---|
| 18 | 93 | Classroom Training |
|---|
| 19 | 94 | Books and Articles |
|---|
| 20 | 95 | Video Lecture |
|---|
Step 4: Calculate Sum of Ranks
Each group’s ranks are summed:
| Training Method | Sum of Ranks (Rᵒ) |
|---|
| Video Lectures | 66 |
| Books and Articles | 70 |
| Classroom Training | 74 |
Step 5: Calculate H-Statistic
Using the formula:
H = \frac{12}{20(21)} \left[\frac{66^2}{6}+\frac{70^2}{7}+\frac{74^2}{7}\right] - 3(21)
H = 0.0938
Step 6: Determine Critical Value
- Degrees of freedom (df) = K - 1 = 3 - 1 = 2
- Significance Level (α) = 0.10
- From the chi-square table: X^2_{0.10,2} = 4.605
Step 7: Compare H with Critical Value
- If H_{calc} < X^2, fail to reject H₀ (no significant difference).
- If H_{calc} > X^2, reject H₀ (significant difference exists).
Since 0.0938 < 4.605, we fail to reject H₀, meaning there is no significant difference in students' performance across the three training methods.
Explore
DSA Fundamentals
Data Structures
Algorithms
Advanced
Interview Preparation
Practice Problem