What is the Kruskal-Wallis test?
The Kruskal-Wallis test is often performed to test whether the difference between the medians of two or more groups are statistically significant. The Kruskal-Wallis test is a non-parametric equivalent of the one-way ANOVA test. This test is performed when the assumptions about the one-way ANOVA test are not met. For example, if the distribution of data is not normal, we cannot perform the one-way ANOVA test. We, in that case, perform the Kruskal Wallis test.
Let’s look at an example. Let’s say employees of a company work in three shifts. The company now wants to know whether there is any statistical difference between the median salaries of these three groups. To determine that, we can perform a Kruskal Wallis test.
Please note that the dependent variable, in this case, is the salary, which should be ordinal or continuous in the case of the Kruskal Wallis test. And the independent variable should consist of two or more categories or independent groups. Also, the observations should be independent of each other.
How to perform the Kruskal-Wallis test?
Let’s consider the above example. Let’s say we are given the salaries of three groups of employees related to three shifts of the company. We want to know whether there is any statistical difference between the median salaries of these three groups. To determine that, we can perform the Kruskal-Wallis test, which is the non-parametric equivalent of the one-way analysis of variance or one-way ANOVA test.
The Kruskal-Wallis test can be performed using the following steps:
1. We need to rank the salaries of the combined groups in ascending order.
2. If the salaries associated with two or more ranks are the same, we will replace the ranks with the average ranks. For example, if the salaries associated with ranks 2, 3, and 4 are the same, we will replace ranks 2, 3, and 4 with the average rank, i. e., 3.
3. Now, we will calculate the sum of ranks for each group.
4. Let’s say the sum of the ranks of group 1, group 2, and group 3 are R1, R2, and R3, respectively. Let’s also assume that N is the total number of observations and ni is the number of observations of the ith group. The test statistic H, in that case, is: …








































0 Comments