Uni-Sine
Biology
+25XP
BiologyEcology and evolution

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

r_s=1-\frac{6\Sigma d^2}{n\left(n^2-1\right)}
  • 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

  1. Write a null hypothesis: there is no correlation between the two variables.
  2. Rank each variable separately, from smallest (rank 1) to largest. If values tie, give each the mean of the ranks they would have taken.
  3. For each pair, subtract one rank from the other to get d, then square it.
  4. Add up the d² values to get Σd².
  5. Put Σd² and n into the formula to find rₛ.
  6. 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.
  7. 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)RankBluebellsRankdd²
213100
4253−11
634211
849400
105126−11
12611511
14715700
168189−11
18917811

Σd² = 6 and n = 9, so:

r_s=1-\frac{6\times6}{9\times\left(81-1\right)}=1-\frac{36}{720}=0.95

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.05Two-tailed, p = 0.05
60.8290.886
70.7140.786
80.6430.738
90.6000.700
100.5640.648
110.5360.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.

practice
Pick an answer, then check it.
A test on 10 pairs of readings gives rₛ = −0.71. Using a two-tailed critical value of 0.648 at p = 0.05, what do you conclude?

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?
Whether two variables are correlated, how strongly, and in which direction, and, when compared with a critical value, whether the correlation is significant or could be down to chance.
What is the formula for Spearman's rank?
rₛ = 1 − 6Σd² ÷ n(n² − 1), where d is the difference in ranks for each pair and n is the number of pairs.
What is a good Spearman's rank value?
Values close to +1 or −1 show strong correlation. Whether it is significant depends on n: for 10 pairs, the two-tailed critical value at p = 0.05 is 0.648.
How many pairs do you need for Spearman's rank?
At least 5 for the test to work at all, but with so few only a perfect correlation is significant. Ten or more pairs is much better.
Is Spearman's rank on the AQA A-level Biology specification?
AQA's mathematical skill MS 1.9 asks you to select and use a statistical test, including the correlation coefficient. Spearman's rank is the correlation coefficient used for ranked data.

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
Read next
Biology · Ecology and evolutionIndex of diversity: Simpson's diversity index with examplesHow to calculate an index of diversity: the AQA formula and Simpson's diversity index, what the values mean, and worked examples with a free calculator.