Spearman's rank correlation coefficient: how to calculate and interpret it
Spearman's rank correlation coefficient, rₛ, measures how strongly two variables are correlated using the ranks of the data rather than the raw values. It runs from −1 (perfect negative correlation) through 0 (none) to +1 (perfect positive correlation). You calculate it with rₛ = 1 − 6Σd² ÷ n(n² − 1), then compare it with a critical value to decide whether the correlation is significant.
When to use Spearman's rank
AQA's A-level Biology specification (mathematical skill MS 1.9) expects you to select and use a statistical test, naming the chi-squared test, the Student's t-test and the correlation coefficient. Spearman's rank is the correlation test you use when you want to know whether two measured variables are related, for example:
- distance from a hedge and the number of a plant species in quadrats
- light intensity and the percentage cover of moss
- body mass and heart rate across a group of animals
It works on ranks, so it suits data that aren't normally distributed or are only ordinal. It tests for a relationship where one variable consistently rises (or falls) as the other rises, not only a straight-line one. Use the chi-squared test for counts in categories, and the t-test to compare two means.
The Spearman's rank formula
- d is how far apart the two ranks of a pair are (one rank minus the other).
- Σd² is the sum of the squared differences.
- n is the number of pairs of readings.
How to do a Spearman's rank test
- Write a null hypothesis: there is no correlation between the two variables.
- Rank each variable separately, from smallest (rank 1) to largest. If values tie, give each the mean of the ranks they would have taken.
- For each pair, subtract one rank from the other to get d, then square it.
- Add up the d² values to get Σd².
- Put Σd² and n into the formula to find rₛ.
- Compare rₛ with the critical value for your n at p = 0.05. If rₛ (ignoring its sign) is equal to or greater than the critical value, reject the null hypothesis: the correlation is significant.
- Write the conclusion in context, saying whether the correlation is positive or negative.
Worked example
A student counts bluebells in quadrats at increasing distances from a tree. Null hypothesis: there is no correlation between distance from the tree and the number of bluebells.
| Distance (m) | Rank | Bluebells | Rank | d | d² |
|---|---|---|---|---|---|
| 2 | 1 | 3 | 1 | 0 | 0 |
| 4 | 2 | 5 | 3 | −1 | 1 |
| 6 | 3 | 4 | 2 | 1 | 1 |
| 8 | 4 | 9 | 4 | 0 | 0 |
| 10 | 5 | 12 | 6 | −1 | 1 |
| 12 | 6 | 11 | 5 | 1 | 1 |
| 14 | 7 | 15 | 7 | 0 | 0 |
| 16 | 8 | 18 | 9 | −1 | 1 |
| 18 | 9 | 17 | 8 | 1 | 1 |
Σd² = 6 and n = 9, so:
The two-tailed critical value for n = 9 at p = 0.05 is 0.700. Since 0.95 is greater, the student rejects the null hypothesis: there is a significant positive correlation between distance from the tree and the number of bluebells. That doesn't prove distance causes the change; light reaching the ground may be the real factor.
Ranking tied values
If two readings tie, give both the mean of the ranks they would share. For example, if the 4th and 5th smallest values are both 7, each gets rank (4 + 5) ÷ 2 = 4.5, and the next value gets rank 6. With many ties the simple formula is only approximate, but it is the method A-level questions expect.
Critical values for Spearman's rank
These are the exact critical values at p = 0.05, worked out from every possible ranking for each n. Your exam paper gives you the table you need.
| n (pairs) | One-tailed, p = 0.05 | Two-tailed, p = 0.05 |
|---|---|---|
| 6 | 0.829 | 0.886 |
| 7 | 0.714 | 0.786 |
| 8 | 0.643 | 0.738 |
| 9 | 0.600 | 0.700 |
| 10 | 0.564 | 0.648 |
| 11 | 0.536 | 0.618 |
Use a two-tailed value when you are testing for any correlation, and a one-tailed value only when you predicted the direction in advance. With 5 pairs, only a perfect correlation is significant in a two-tailed test, so aim for at least 10 pairs of readings.
Writing the conclusion
A full conclusion states the test result, the comparison and the meaning in context: "rₛ = 0.95, which is greater than the critical value of 0.700 at p = 0.05, so we reject the null hypothesis. There is a significant positive correlation between distance from the tree and the number of bluebells." If rₛ is below the critical value, say you accept the null hypothesis: there is no significant correlation, and any pattern could be due to chance.
Common mistakes
- Ranking both variables together. Rank each variable on its own.
- Forgetting to square d, or squaring Σd instead of adding the d² values.
- Using n² instead of n² − 1 in the formula.
- Saying the correlation proves cause. A significant correlation shows a relationship, not what causes it.
- Ignoring the sign. Check the magnitude of rₛ against the table, then use the sign to say positive or negative.
Common questions
What does Spearman's rank tell you?
What is the formula for Spearman's rank?
What is a good Spearman's rank value?
How many pairs do you need for Spearman's rank?
Is Spearman's rank on the AQA A-level Biology specification?
Revision cards
Say the answer first, then flip the card to check it.
Practise with a short timed paper
Statistical tests come up in A-level Biology papers. The daily A-level Biology: Year 1 paper is a short timed paper of 8 questions, with a new one every day.
Where to go next
- Test it
A-level Biology: Year 1
A new exam-style paper every day, with instant marking and a mark scheme
Start today's paper