4.10 Spearman's rank correlationIB Maths: Applications and Interpretation SL: Revision notes
Section 1
Ranking data and Spearman's coefficient
Pearson's coefficient measures how close data lie to a straight line. Spearman's rank correlation coefficient 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 :
- rank each variable separately (rank 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 is found using technology; you do not need to prove the formula. The value satisfies . Close to means a strong positive monotonic association, close to a strong negative one and near little or no monotonic association. Example: maths marks have ranks and physics marks have ranks . Pearson's coefficient of these ranks gives : students who rank highly in maths also tend to rank highly in physics.
Ranking one variable from the highest and the other from the lowest. This changes the sign of .
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 ranked from the highest. The two s would take ranks and , so each gets . The next value, , gets rank , because ranks and have been used. Three equal values taking ranks would each get . Then use your GDC on the two lists of ranks as before. For judges and scoring seven dishes with several ties, this gives , a fairly strong positive agreement between the judges.
Check that your ranks add up to . For items that is ; the ranks do.
Section 3
Pearson's or Spearman's?
The two coefficients answer different questions.
- Pearson's tests only for linearity. It is suitable when the scatter diagram is close to a straight line.
- Spearman's tests for any monotonic relationship, linear or curved. Example: bacteria counts at hours to always rise. The ranks of both variables are identical, so , a perfect monotonic relationship. 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. Always look at the scatter diagram first. Neither coefficient is suitable for a relationship that rises then falls, which is not monotonic.
Saying a low 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 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. This is why Spearman's is less sensitive to outliers. Example: eight students' revision hours and scores . The student with hours is an outlier. For all eight, and . Without that student, and . Pearson's changed by about and Spearman's by about . 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.
When a question gives an outlier, say that is less affected because it uses ranks, not the actual values.
Section 5
Interpreting and limitations
When you interpret , 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.
- only describes monotonic relationships; check the scatter diagram.
- Small samples can give misleading values.
- Many tied ranks reduce how reliable 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.
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
- Six students sat a maths test and a physics test. Their marks (maths, physics) were , , , , and . In both subjects the highest mark is given rank .Interpret the value of in context.2 marks
- Seven dishes in a cookery competition were each given a score out of by two judges, and . In the order of the dishes, judge gave and judge gave . The highest score is given rank .Write down the ranks given by judge to the seven dishes, in the order of the dishes.2 marks
- A scientist counts the bacteria in a culture, thousand, hours after the start of an experiment. For the counts are . Use your GDC.(i) Find Pearson's product-moment correlation coefficient between and . (ii) Find Spearman's rank correlation coefficient , justifying your value.3 marks
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).