Learning Outcomes
By the end of this section, students will be able to:
- Explain the importance of the parametric assumptions and determine if they have been met
- Explain the basic principles of rank based non-parametric statistical tests
- Describe the use of a range of common non-parametric tests
- Conduct and interpret common non-parametric tests
You can download a copy of the slides here: B3.3 Kruskal-Wallis Test
B3.3 PRACTICAL: R
We can use the kruskal_test command for a comparison between more than two groups. As there is no constraint on the number of groups for the test, we only need to specify the data, followed by the dependent and independent variables in the same was as the previous module.
Question B3.3: Is there a significant difference between all three mouse strains on their BCS_baseline score?
Answer
The R code we use is:
> kruskal_test(mice, BCS_baseline ~ Strain)
The RStudio output looks like:

These results show that there is a significant difference (p<0.05) in the baseline body condition score when comparing all three strains.
B3.3 PRACTICAL: Stata
Following on from the previous practical (B3.2), you can use the Kruskal-Wallis Test to check for differences in baseline body condition score (BCS_baseline) between all three mouse strains.
The command is:
kwallis outcome_variable, by(grouping variable)
Question B3.3: Is there a significant difference between all three mouse strains on their BCS_baseline score?
Answer

We look at the chi-squared value with ties, which is p<0.05. The test indicates the median baseline body composition score of mice was not the same (X2=7.6, p=0.02). Therefore, there is a significant difference in the baseline body condition score when comparing all three groups.
B3.3 PRACTICAL: SPSS
Following on from the previous practical (B3.2), you can use the Kruskal-Wallis Test to check for differences in baseline body condition score (BCS_baseline) between all three mouse strains.
Select
Analyze >> Nonparametric Tests >> Legacy Dialogs >> K Independent Samples
Move the variable of interest (BCS_baseline) into the Test Variable List.
Assign ‘Strain_group’ as the grouping variable and then click ‘Define Range’. Here you need to add the numerical grouping value of the highest and lowest groups of the range you wish to test. As we only have 3 groups here, these values are 1 and 3, but in larger data sets this can be used to specify a subset of groups to compare.
Make sure ‘Kruskal-Wallis H’ is selected at the bottom of the box before you press ‘OK’ to run the test.

Answer


These results show that there is a significant difference in the baseline body condition score when comparing all three groups.
Enjoying the lessons