## 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.2 Mann-Whitney U Test

## B3.2 PRACTICAL: R

The Mann-Whitney U test is also sometimes called the Wilcoxon Rank-Sum test.

When first examining your data, you may want to check the distribution of the variables of interest and calculate appropriate summary statistics for them.

We will use the wilcox_test command to perform this. We must specify the data, and the variables to be considered in the form dependent variable ~ grouping variable.

We want to use the Mann-Whitney U Test to determine if there is a significant difference in body condition score between the wild type mice and the Cdkn1a knockout mice at the start of the study (BCS_baseline).

This test can only have two groups so we need to use the comparisons argument in the function so that it specifies the two groups being compared:

> wilcox_test(mice, BCS_baseline ~ Strain, comparisons = list(c(“KO Cdkn1a”, “Wild”)))

The RStudio output looks like this:

There is no significant difference (p>0.05) in body condition score between the wild type mice and the Cdkn1a knockout mice at the baseline.

We can see that there is no significant difference (p>0.05) in body condition score between the wild type mice and the Cdkn1a knockout mice at the baseline.

__Question B3.2: __**Is there a significant difference in body condition score between the two different knockout strainsat the end of the trial?**

**Answer**

We can run this comparison by specifying these two strains in the comparison argument of the function:

> wilcox_test(mice, BCS_end ~ Strain, comparisons = list(c(“KO Cdkn1a”, “KO N-ras”)))

The RStudio output looks like this:

We can see that the two knockout strains are significantly different (p<0.05) in body condition score at the end of the study.

## B3.2 PRACTICAL: Stata

The Mann-Whitney U test is also sometimes called the Wilcoxon Rank-Sum test.

When first examining your data, you may want to check the distribution of the variables of interest and calculate appropriate summary statistics for them. To calculate the median, there is a function under the egen command that you can look up. You can calculate the IQR by hand from the display of the summarise, detail command; or you can type egen iqr=iqr(var1) and then tab iqr.

For Mann-Whitney U test (or Wilcoxon rank-sum test), the Stata code is:

ranksum var1, by(var2)

Use the Mann-Whitney U Test to determine if there is a significant difference in body condition score between the wild type mice and the Cdkn1a knockout mice at the start of the study (BCS_baseline).

This test can only have two groups so we need to recode our strain variable so that it specifies the two groups being compared:

recode Strain_group (1=1 “Wild”) (2=2 “Cdkn1a”) (3=.), gen(strain1_2) label(strain12)

tab strain1_2, m

ranksum BCS_baseline,by( strain1_2)

When using small sample sizes (N<200) Stata will report the exact significance alongside the asymptotic significance, so we can report P=0.18 in this case. There is no significant difference in BCS between these groups at baseline.

__Question B3.2: __**Is there a significant differences in body condition score between the two different knockout strains (strains 2 and 3) at the end of the trial?**

**Answer**

recode Strain_group (1=.) (2=2 “Cdkn1a”) (3=3 “N-ras”), gen(strain2_3) label(strain23)

Here P<0.001, so there is a significant difference in BCS between these two groups at the end of the trial.

## B3.2 PRACTICAL: SPSS

**Use the Mann-Whitney U Test to determine if there is a significant difference in body condition score between the wild type mice and the Cdkn1a knockout mice at the start of the study (BCS_baseline).**

Select

Analyze >> Nonparametric Tests >> Legacy Dialogs >> 2 Independent Samples

SPSS assumes that each row is a separate participant or case, so for all independent tests it requires the dependant variable to be all in one column, and for there to be a separate grouping variable.

Move the dependant variable of interest (BCS_baseline) into the Test Variable List.

Assign ‘Strain_group’ as the grouping variable and then click ‘Define Groups’. Here you need to add the numerical grouping value of the two groups you wish to test, in this case 1 for wild type and 2 for Cdkn1a knockout.

Make sure Mann-Whitney U is selected at the bottom of the box before you press ‘OK’ to run the test.

**Now use the same process to test for any significant differences in body condition score between the two different knockout strains at the end of the trial.**

**Answer**

When using small sample sizes such as this SPSS will report the exact significance alongside the asymptotic significance, so we can report P=0.289 in this case. There is no significant difference in BCS between these groups at baseline.

Here P<0.001, so there is a significant difference in BCS between these two groups at the end of the trial.