Spearman’s rank correlation
Spearman’s rank correlation coefficient measures how well two variables agree in order, not in a straight line. You rank the data (averaging tied ranks), then find the correlation of the ranks on the GDC, and decide whether Spearman or Pearson suits the data better.
1What you need to know
Tick these off as you go. By the end of the page you should be able to do all of them without notes.
- Rank data, giving tied values the average of their ranksSL 4.10
- Find with the GDC, as Pearson’s of the ranksSL 4.10
- Interpret : agreement in order (a monotonic relationship)SL 4.10
- Explain when Spearman is more appropriate than Pearson, including the effect of outliersSL 4.10
2Notes & worked examples
Each idea is followed by a worked example. Try the question yourself first, then reveal the solution one step at a time.
Pearson’s asks: do the points lie close to a straight line? Spearman’s asks a simpler question: when one variable goes up, does the other go up too? (a "monotonic" relationship). So suits curved but always-increasing data, rankings such as judges’ scores, and data with outliers. Like , it runs from to .
2.1 Ranking
Rank each variable separately: 1 for the largest (or the smallest; just be consistent for both variables). If values are tied, give each the average of the ranks they would take. For example, in 12, 15, 15, 18, 20 (smallest first), the two 15s share ranks 2 and 3, so each gets 2.5: the ranks are 1, 2.5, 2.5, 4, 5.
2.2 Finding on the GDC
2.3 Spearman or Pearson?
| Situation | Better choice |
|---|---|
| Points close to a straight line | Pearson |
| Always increasing (or decreasing), but curved | Spearman |
| Data are ranks or scores from judges | Spearman |
| There is an outlier | Spearman is less affected |
Type the ranks (not the raw data) into two lists, then menu → Statistics → Stat Calculations → Linear Regression (ax+b); the value in the output is . Ignore and : they mean nothing here. Check your ranks before you calculate: a single wrong rank changes the answer.
3Explore it
Move the last point up and down, or switch to curved data. Compare Pearson’s r with Spearman’s rₛ: which one reacts to the outlier, and which one notices that the curved data always increases?
4Common mistakes & exam tips
Common mistakes
- Calculating of the raw data instead of the ranks.
- Ranking one variable from largest and the other from smallest.
- Giving tied values different ranks, or the wrong average rank.
- Saying means the points lie on a straight line. It means the order agrees perfectly.
- Choosing Pearson for data with a clear outlier or a curved but monotonic pattern.
Exam tips
- Show your ranks in a table before using the GDC.
- "Which coefficient is more appropriate?" Look at the scatter diagram: curved, outliers or ranked data point to Spearman.
- Interpret in context: "the two judges rank the divers in a very similar order".
- If a question asks for the effect of an outlier, say that is less sensitive because it uses ranks only.
5Practice
Fluency questions build the basics. Problem-solving questions make you think about which method to use.
6Exam-style questions
Original questions in the style of the IB Maths AI SL exam, with full markschemes. Your GDC is allowed throughout: use it, but write down what you entered and what it gave you. Give yourself about 1 minute per mark.
The hours of sunshine and the number of ice creams sold on seven days are: : 6.2, 7.5, 5.1, 8.3, 7.5, 4.0, 9.1; : 110, 150, 95, 170, 140, 80, 160.
- (a)Write down the ranks of , from smallest to largest.[2]
- (b)Find Spearman’s rank correlation coefficient, .[2]
- (c)Interpret your answer in context.[2]
| (a) | |
| 3, 4.5, 2, 6, 4.5, 1, 7 | A2 |
| Award A1 for correct ranks without averaging the tie. | |
| (b) | |
| ranks of : 3, 5, 2, 7, 4, 1, 6 | (M1) |
| A1 | |
| (c) | |
| strong positive association | A1 |
| sunnier days tend to have more ice creams sold | R1 |
Data for follow the rule .
- (a)Find Pearson’s .[1]
- (b)Write down Spearman’s . Justify your answer.[2]
- (c)State which coefficient better describes the relationship, giving a reason.[2]
| (a) | |
| A1 | |
| (b) | |
| A1 | |
| increases every time increases, so the ranks agree exactly | R1 |
| (c) | |
| Spearman | A1 |
| the relationship is monotonic but not linear | R1 |
For eight students, is the hours of revision and the test mark: : 1, 2, 3, 4, 5, 6, 7, 8; : 3, 4, 6, 5, 7, 8, 9, 30.
- (a)Find Pearson’s and Spearman’s .[2]
- (b)Identify the value that affects most, and explain why it has little effect on .[2]
- (c)State, with a reason, which coefficient is more appropriate here.[2]
| (a) | |
| A1 | |
| A1 | |
| (b) | |
| (the outlier) | A1 |
| its rank is simply 8, the highest, whatever its size | R1 |
| (c) | |
| Spearman | A1 |
| it is less affected by the outlier | R1 |
7Check yourself
Six quick questions, marked instantly. Aim for 6/6 before moving on. Fractions like 3/2 are accepted.
8Past-paper practice
Once you're scoring well above, try these real IB Maths AI SL questions. Your school or teacher will have the papers.
| Paper | Question | Focus | Difficulty |
|---|---|---|---|
| May 2025 · TZ2 · Paper 1 | Q10 | Two judges ranking sheepdogs: rₛ and agreement | ★★☆ |
| May 2023 · TZ1 · Paper 1 | Q1 | Decathlon long and high jump: rank, rₛ, interpret | ★★☆ |
| May 2023 · TZ2 · Paper 1 | Q4 | Age vs 100 m time: ranks, rₛ, why not Pearson | ★★☆ |
| Nov 2024 · TZ1 · Paper 2 | Q3 | Survey data: quartiles, outlier, ranks, rₛ, validity | ★★☆ |
