All revision notes topics

4.10 Spearman's rank correlationIB Maths: Applications and Interpretation HL: Revision notes

Section 1

Ranking data and Spearman's coefficient

Pearson's coefficient rr measures how close data lie to a straight line. Spearman's rank correlation coefficient rsr_s instead measures how well the ranks of two variables agree, so it tests for a monotonic relationship: one that is always increasing or always decreasing. To find rsr_s:

  • rank each variable separately (rank 11 for the highest or lowest value, but be consistent for both variables);
  • on your GDC, find Pearson's coefficient of the two lists of ranks. In examinations rsr_s is found using technology; you do not need to prove the formula. The value satisfies −1≤rs≤1-1\leq r_s\leq1. Close to 11 means a strong positive monotonic association, close to −1-1 a strong negative one and near 00 little or no monotonic association. Example: maths marks 45,60,72,38,55,8045,60,72,38,55,80 have ranks 5,3,2,6,4,15,3,2,6,4,1 and physics marks 52,58,80,40,61,7552,58,80,40,61,75 have ranks 5,4,1,6,3,25,4,1,6,3,2. Pearson's coefficient of these ranks gives rs=0.886r_s=0.886: students who rank highly in maths also tend to rank highly in physics.
Key termsrankSpearman's rank correlation coefficientmonotonic
Common mistake

Ranking one variable from the highest and the other from the lowest. This changes the sign of rsr_s.

Section 2

Tied (equal) values

When two or more data items are equal, they share the ranks they would have taken, and each receives the average of those ranks. Example: scores 9,8,7,6,5,5,49,8,7,6,5,5,4 ranked from the highest. The two 55s would take ranks 55 and 66, so each gets 5+62=5.5\frac{5+6}{2}=5.5. The next value, 44, gets rank 77, because ranks 55 and 66 have been used. Three equal values taking ranks 2,3,42,3,4 would each get 33. Then use your GDC on the two lists of ranks as before. For judges XX and YY scoring seven dishes with several ties, this gives rs=0.791r_s=0.791, a fairly strong positive agreement between the judges.

Key termstied valuesaverage rank
Exam tip

Check that your ranks add up to n(n+1)2\frac{n(n+1)}{2}. For 77 items that is 2828; the ranks 2,5,1,3.5,3.5,6,72,5,1,3.5,3.5,6,7 do.

Section 3

Pearson's or Spearman's?

The two coefficients answer different questions.

  • Pearson's rr tests only for linearity. It is suitable when the scatter diagram is close to a straight line.
  • Spearman's rsr_s tests for any monotonic relationship, linear or curved. Example: bacteria counts 2,4,9,17,31,52,85,1402,4,9,17,31,52,85,140 at hours 11 to 88 always rise. The ranks of both variables are identical, so rs=1r_s=1, a perfect monotonic relationship. But the growth is curved, so Pearson's gives only r=0.911r=0.911. So r<1r<1 does not mean the variables are unrelated; it may mean the relationship is not linear. Always look at the scatter diagram first. Neither coefficient is suitable for a relationship that rises then falls, which is not monotonic.
Key termslinearmonotonic relationship
Common mistake

Saying a low rr means there is no relationship. It means there is no strong linear relationship.

Section 4

The effect of outliers

An outlier is a data point far from the others. Pearson's rr uses the actual values, so one outlier can change it greatly. Spearman's rsr_s uses only ranks, so an outlier counts only as the highest or lowest rank. This is why Spearman's is less sensitive to outliers. Example: eight students' revision hours 2,4,5,6,8,9,10,302,4,5,6,8,9,10,30 and scores 40,52,50,58,64,70,75,4540,52,50,58,64,70,75,45. The student with 3030 hours is an outlier. For all eight, r=−0.0948r=-0.0948 and rs=0.476r_s=0.476. Without that student, r=0.987r=0.987 and rs=0.964r_s=0.964. Pearson's changed by about 1.081.08 and Spearman's by about 0.4880.488. Even Spearman's is not immune. Here it is still pulled down by the outlier. Investigate outliers; do not just delete them without a reason.

Key termsoutliersensitive
Exam tip

When a question gives an outlier, say that rsr_s is less affected because it uses ranks, not the actual values.

Section 5

Interpreting and limitations

When you interpret rsr_s, state the direction and strength, and give your conclusion in context: 'students who rank highly in maths tend to rank highly in physics'.

  • Correlation does not prove that one variable causes the other.
  • rsr_s only describes monotonic relationships; check the scatter diagram.
  • Small samples can give misleading values.
  • Many tied ranks reduce how reliable rsr_s is.
  • Spearman's coefficient ignores how far apart the values are, only their order, so it loses some information that Pearson's uses. Use Pearson's when the data are roughly linear and have no outliers, and Spearman's when the relationship is curved but monotonic or when outliers are present.
Key termscausationmonotonic
Common mistake

Writing a conclusion without context. Refer to the variables in the question.

That's the notes covered.

Carry on to the next subtopic.

Exam questions on 4.10 Spearman's rank correlation

  1. Six students sat a maths test and a physics test. Their marks (maths, physics) were (45,52)(45,52), (60,58)(60,58), (72,80)(72,80), (38,40)(38,40), (55,61)(55,61) and (80,75)(80,75). In both subjects the highest mark is given rank 11.
    Interpret the value of rsr_s in context.2 marks
  2. Seven dishes in a cookery competition were each given a score out of 1010 by two judges, XX and YY. In the order of the dishes, judge XX gave 7,5,9,5,8,6,47,5,9,5,8,6,4 and judge YY gave 8,6,9,7,7,5,38,6,9,7,7,5,3. The highest score is given rank 11.
    Write down the ranks given by judge YY to the seven dishes, in the order of the dishes.2 marks
  3. A scientist counts the bacteria in a culture, yy thousand, xx hours after the start of an experiment. For x=1,2,3,4,5,6,7,8x=1,2,3,4,5,6,7,8 the counts are 2,4,9,17,31,52,85,1402,4,9,17,31,52,85,140. Use your GDC.
    (i) Find Pearson's product-moment correlation coefficient rr between xx and yy. (ii) Find Spearman's rank correlation coefficient rsr_s, justifying your value.3 marks
See the full worksheet

Written by the Exaim team, led by Shaun Daswani (Head of Upper Secondary, Improve ME Institute; MSc Financial Mathematics, Imperial College London; BSc, UCL) and Jason Daswani (operational lead, Improve ME Institute; LSE).