☰ Year plan · Statistics

Spearman’s rank correlation

Week 3 · Spearman’s rank correlation coefficient: ranks, tied values, D² and the formula, and when to use it instead of Pearson’s · 3 lessons
1

Why ranks: ordered levels such as weak, pass and good, and giving tied values the mean of their places

Statistics Sec 3 Term 1, Unit 1, Lesson 1
GoalReplace ordered levels or numbers by ranks, and give tied values the mean of their places.
New words
ordinal data · levels with an order but no measured distance, such as weak < pass < goodrank · the place of a value when the list is put in ordertied values · equal values; each gets the mean of the places they share
Explanation

Pearson’s coefficient needs numbers we can add and multiply. Many data are only ordered: a teacher marks handwriting as weak, pass, good, very good or excellent. We know the order but not how far “good” is from “pass”. For such ordinal data we use ranks: put the values in order from the smallest and give each its place, 1, 2, 3 and so on. The same method works for numbers when only the order matters. If two or more values are equal they are tied, and they share the places they would have taken. Each gets the mean of those places. Two “weak” pupils would take places 1 and 2, so each gets (1 + 2) ÷ 2 = 1.5; three equal values for places 3, 4 and 5 each get 4. Never skip a place and never give the same rank to different values. A quick check: for n values the ranks must add up to n(n + 1) ÷ 2. The table ranks the handwriting of seven pupils; they add up to 28 = 7 × 8 ÷ 2.

PupilLevelPlaceRank
Bweak11.5
Fweak21.5
Cpass33.5
Gpass43.5
Agood55.5
Dgood65.5
Eexcellent77
Worked examples
Reading the table: the two “good” pupils (A and D) share places 5 and 6, so each has rank (5 + 6) ÷ 2 = 5.5. The single “excellent” pupil E has place 7 and rank 7. Check: 1.5 + 1.5 + 3.5 + 3.5 + 5.5 + 5.5 + 7 = 28.
Ranks of numbers: 12, 7, 12, 9, 12, 15. In order: 7, 9, 12, 12, 12, 15. The value 7 has rank 1, 9 has rank 2, the three 12’s share places 3, 4, 5 so each has rank 4, and 15 has rank 6. In the original order the ranks are 4, 1, 4, 2, 4, 6, which add up to 21 = 6 × 7 ÷ 2.
A common slip: ranking 3, 5, 5, 8 as 1, 2, 2, 3. The two 5’s share places 2 and 3, so they get 2.5 each, and 8 has place 4. The correct ranks are 1, 2.5, 2.5, 4 (sum 10 = 4 × 5 ÷ 2); the slip gives the sum 8.
Class activity

Ask six family members or friends to rate a dish from 1 to 5 stars. Rank the ratings from the smallest, share the places of equal ratings, and check that the ranks add up to 21.

Practice
1
Give the ranks (smallest = 1) of 8, 3, 5, 3, 9.
2
Star ratings 4, 5, 4, 4, 2, 5: find the ranks.
3
Why can Pearson’s coefficient not be used for the levels weak, pass, good?
4
Three runners tie for places 4, 5 and 6. What rank does each get?
5
A pupil ranks 10, 20, 20, 30 as 1, 2, 2, 3. What is wrong?