4.10 Spearman's rank correlation
Studying this course? Keep your progress in one place.
Key facts
- Spearman's measures how well the ranks of two variables agree: a monotonic relationship.
- Rank both variables the same way, then find Pearson's of the ranks on the GDC.
- Tied values share the average of the ranks they occupy.
- for any perfectly increasing relationship, even a curve; Pearson's tests linearity only.
- is less sensitive to outliers than Pearson's .
Ranking data
Rank each variable the same way, then find Pearson's coefficient of the two lists of ranks.
Pearson's measures closeness to a straight line. Spearman's rank correlation coefficient measures how well the ranks agree, so it tests for a monotonic relationship: always increasing or always decreasing.
Rank each variable separately (rank 1 for the highest, for both). Then find Pearson's coefficient of the ranks on the GDC. , read like .
Maths marks and physics marks give .
- 1
Rank variable 1
rank 1 for the highest
- 2
Rank variable 2
the same way
- 3
GDC
Pearson's of the two rank lists
- 4
Interpret
direction and strength, in context
Worked example
Maths marks and physics marks . Find .
- 1
Rank maths from the highest: .
- 2
Rank physics from the highest: .
- 3
Enter the two lists of ranks into the GDC and find Pearson's .
Both variables are ranked from the highest. means...
Tied values
Tied values share the average of the ranks they would have taken.
When two or more items are equal, they share the ranks they would have taken, and each gets the average of those ranks.
Scores ranked from the highest: the two 5s would take ranks 5 and 6, so each gets . The next value, 4, takes rank 7. Three equal values taking ranks 2, 3, 4 would each get 3.
Then use the GDC on the two lists of ranks as before.
- Score
- Rank
| Score | Rank | |
|---|---|---|
| A | 8 | 1 |
| B | 7 | 2 |
| C | 5 | 4 |
| D | 5 | 4 |
| E | 5 | 4 |
| F | 4 | 6 |
Score
- A:
- 8
- B:
- 7
- C:
- 5
- D:
- 5
- E:
- 5
- F:
- 4
Rank
- A:
- 1
- B:
- 2
- C:
- 4
- D:
- 4
- E:
- 4
- F:
- 6
Worked example
Scores are ranked from the highest. Give the ranks.
- 1
take ranks .
- 2
The two 5s would take ranks 5 and 6, so each gets .
- 3
The score 4 takes rank 7.
Three equal scores would have taken ranks 4, 5 and 6. What rank does each get?
Pearson's or Spearman's?
Pearson's tests linearity; Spearman's tests any monotonic relationship.
Pearson's is suitable when the scatter diagram is close to a straight line. Spearman's tests any monotonic relationship, linear or curved.
Bacteria counts at hours to always rise. The ranks are identical, so . But the growth is curved, so Pearson's gives only .
So does not mean the variables are unrelated; it may mean the relationship is not linear. Look at the scatter diagram first. A relationship that rises then falls is not monotonic.
| Pearson's | Spearman's | |
|---|---|---|
| Tests for | A linear relationship | Any monotonic relationship |
| Uses | Actual values | Ranks only |
| Sensitive to outliers | More | Less |
Pearson's
- Tests for:
- A linear relationship
- Uses:
- Actual values
- Sensitive to outliers:
- More
Spearman's
- Tests for:
- Any monotonic relationship
- Uses:
- Ranks only
- Sensitive to outliers:
- Less
A curve always rises. Which is ?
Effect of outliers
Spearman's uses only ranks, so an outlier counts just as the highest or lowest rank.
An outlier is a point far from the others. Pearson's uses the actual values, so one outlier can change it greatly. Spearman's uses only ranks, so an outlier counts only as the highest or lowest rank.
Eight students' revision hours are with scores . The student with 30 hours is an outlier. With all eight, and . Without that student, and .
Even is pulled down. Investigate outliers; do not delete them without a reason.
- All eight students
- Without the 30-hour student
Why is Spearman's less affected by an extreme point?
Interpreting and limitations
State direction and strength in context, and remember it shows association, not cause.
State the direction and strength of , and give your conclusion in context: "students who rank highly in maths tend to rank highly in physics".
Limits:
- Correlation does not prove one variable causes the other.
- describes only monotonic relationships; check the scatter diagram.
- Small samples can mislead, and many tied ranks reduce reliability.
- It ignores how far apart values are, only their order.
| Use Pearson's when | Use Spearman's when | |
|---|---|---|
| Shape | Data roughly linear | Curved but monotonic |
| Outliers | No outliers | Outliers present |
Use Pearson's when
- Shape:
- Data roughly linear
- Outliers:
- No outliers
Use Spearman's when
- Shape:
- Curved but monotonic
- Outliers:
- Outliers present
Which data suit Spearman's better?
Try an exam question
Five students sit two tests. Test 1 scores: . Test 2 scores: . Find Spearman's rank correlation coefficient and interpret it.
[4 marks]
- [1]Test 1 ranks (highest = 1): .
- [1]Test 2 ranks: .
- [1] (GDC, or ).
- [1]Strong positive monotonic association: students who score highly on one test tend to score highly on the other.
That's the notes covered.
Carry on to the next subtopic.
Try a question
What is the physics rank of the student who scored ?
1 mark, marked against the mark scheme
What is the physics rank of the student who scored ?
1 mark, marked against the mark scheme