The Kruskal-Wallis test calculator is designed to compare the medians of three or more independent treatments (groups).
The following formula is used to compute the Kruskal-Wallis H-statistic:
H = |
|
Σ |
|
- B(N + 1) |
Where,
N = Total number of data points,
Ri = Sum of ranks of the ith group,
ni = Number of data points (observations) in the ith group.
Let's understand the step-by-step calculation with an example.
Compute the H-statistic and P-value for the following groups:
Step 1: Rank the data:
First, assign ranks to all the values from all the groups.
Group | Value | Rank |
---|---|---|
Group 3 | 5 | 1 |
Group 3 | 6 | 2 |
Group 1 | 10 | 3 |
Group 2 | 12 | 4 |
Group 3 | 14 | 5 |
Group 1 | 15 | 6 |
Group 1 | 23 | 7 |
Group 2 | 26 | 8 |
Group 2 | 32 | 9 |
Step 2: Find the sum of ranks for each group:
R1 = 3 + 6 + 7 = 16.
R2 = 4 + 8 + 9 = 21.
R3 = 1 + 2 + 5 = 8.
N = 9 (Total number of observations).
Step 3: Substitute values into the formula:
H = |
|
Σ |
|
- B(N + 1) |
= |
|
( |
|
+ |
|
+ |
|
) | - 3(9 + 1) |
= |
|
( |
|
+ |
|
+ |
|
) | - 30 |
H = 3.82222
Also, you can find the P-value using the P-value from Chi-Square Score Calculator by entering the Chi-Square Score (H) = 3.82222 and the Degrees of Freedom (DF) = k - 1 = 3 - 1 = 2. Where, k = number of groups.
As a result, we get:
P-value = 0.1479