Kruskal-Wallis H Test using SPSS
Overview
The Kruskal-Wallis Test is the nonparametric test equivalent to the one-way ANOVA and an extension of the Mann-Whitney Test to allow the comparison of more than two independent groups. It is used when we wish to compare three or more sets of scores that come from different groups.
Common Uses
As the Kruskal-Wallis Test does not assume normality in the data and is much less sensitive to outliers it can be used when these assumption have been violated and the use of the one-way ANOVA is inappropriate. In addition, if your data is ordinal then you cannot use a one-way ANOVA but you can use this test.
Example
A medical researcher has heard anecdotal evidence that certain anti-depressive drugs can have the positive side-effect of lowering neurological pain in those individuals with chronic, neurological back pain when administered in doses lower than those prescribed for depression. The medical researcher would like to investigate this anecdotal evidence with a study. The researcher identifies 3 well-known, anti-depressive drugs which might have this positive side-effect and labels them Drug A, Drug B and Drug C. The researcher then recruits a group of 60 individuals with a similar level of back pain and randomly assigns them to one of three groups - Drug A, Drug B or Drug C treatment groups and prescribes the relevant drug for a 4 week period. At the end of the 4 week period, the researcher asks the participants to rate their back pain on a scale of 1 to 10 with 10 indicating the greatest level of pain. The researcher wishes to compare the levels of pain experienced by the different groups at the end of the drug treatment period. The researcher runs a Kruskal-Wallis Test to compare this ordinal, dependent measure (Pain Score) between the three drug treatments (independent variable is the type of drug, with more than two groups).
Assumptions
- One dependent variable that is ordinal, interval or ratio (see our guide on types of variable).
- One independent variable that consists of three or more independent groups.
Test Procedure in SPSS
- Click Analyze > Nonparametric Tests > Legacy Dialogs > K Independent Samples... on the top menu as shown below:
- You will be presented with the following:
- Transfer the dependent variable that you are interested in analyzing into the "Test Variable List:" box. In our example, we need to transfer the variable Pain_Score into this box. The independent variable needs to be transfered into the "Grouping Variable:" box. There are two ways transfer your variables. You can either highlight drag-and-drop each variable into the respective boxes or you highlight the variable by using the cursor and clicking the
button. Make sure that the "Kruskal-Wallis H" checkbox is ticked in the "Test Type" box.
You will end up with a screen similar to the one below: - You will be presented with the following:
- Transfer the dependent variable that you are interested in analyzing into the "Test Variable List:" box. In our example, we need to transfer the variable Pain_Score into this box. The independent variable needs to be transfered into the "Grouping Variable:" box. There are two ways transfer your variables. In this case, this means transfering the Drug Treatment Group variable into this box. You can either drag-and-drop each variable into the respective boxes or you can highlight the variable by using the cursor and clicking the
button. Make sure that the "Kruskal-Wallis H" checkbox is ticked in the "Test Type" box.
You will end up with a screen similar to the one below: - Press the
button and type "1" into the "Minimum" box and "3" into the "Maximum" box. This is defining the range of the values for the categories of the independent variables. In this case there are 3 groups/categories called Drug A, Drug B and Drug C. If there had been 4 groups but you did not want to include the first group in the analysis then you would have entered "2" and "4" into the "Minimum" and "Maximum" boxes, respectively (assuming you ordered the groups numerically).
Click the
button. - Click the
button. Tick the "Descriptive" checkbox if you want descriptives and/or "Quartiles" if you want quartiles. You will be presented with the following if you select Descriptives:
Click the
button.
SPSS Output for the Kruskal-Wallis H Test
You will be presented with the following output (Descriptives excluded):
The Ranks table shows the mean rank of the Pain_Score for each drug group. The Test Statistics table presents the Chi-square value (Kruskal-Wallis H), the degrees of freedom and the significance level.
Reporting the Output of the Kruskal-Wallis H Test
In our example, we can report that there was a statistically significant difference between the different drug treatments (H(2) = 8.520, P = 0.014) with a mean rank of 35.33 for Drug A, 34.83 for Drug B and 21.35 for Drug C.









