## 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.6 Spearman’s Rank Order Correlation

## B3.6 PRACTICAL: R

For the last practical in this module, you are going to perform a test of correlation on non-parametric data using the Spearmanâ€™s Rank Order Correlation.

This can be conducted using the cor.test command, which has the structure:

cor.test(data, variable 1, variable 2, method=””)

We can specify spearman as the method to conduct a Spearman’s rank test. If the method is not specified, the default is Pearson’s correlation.

__Question B3.6:__**What is the spearman correlation between Weight_end and BCS_end?**

**Answer**

We can use the cor.test command with the structure specified above:

> cor_test(data, Weight_end, BCS_end, method = “spearman”)

This gives the following RStudio output:

We can see that there is a significant (p<0.05) correlation between the body condition score and the weight of the mice at the end of the study and their correlation coefficient is 0.81.

## B3.6 PRACTICAL: Stata

For the last practical in this module, you are going to perform a test of correlation on non-parametric data using the Spearmanâ€™s Rank Order Correlation.

The command in Stata is

spearman [varlist] [if] [in] [, spearman_options]

We can put multiple variables on the command line where it states [varlist].

__Question B3.6:__**What is the spearman correlation between Weight_end and BCS_end?**

**Answer**

Here you would report an r_{s}Â value of 0.814 and a significant correlation with P<0.001.

## B3.6 PRACTICAL: SPSS

For the last practical in this module, you are going to perform a test of correlation on non-parametric data using the Spearmanâ€™s Rank Order Correlation.

Select

AnalyzeÂ >> Correlate >> Bivariate

Move the two variables you are interested in into the Test Variables box. Here we are going to look at BCS_end and Weight_end.

If you put more than two variables into the Test Variables box, SPSS will perform the selected test of correction on all possible combinations.

Make sure â€˜Spearmanâ€™ is selected at the bottom of the box before you press â€˜OKâ€™ to run the test.

**Answer**

Here you would report an r_{s} value of 0.814 and a significant correlation with P<0.001. SPSS automatically conducts all of the correlations both ways and the correlation of each variable against itself.

If this is confusing, you can get rid of this by clicking â€˜show only lower triangleâ€™ and then deselecting â€˜show diagonalâ€™ when setting up the test. Then your output will look like this.