Pearson's r asks one question: how close are these points to a straight line? Spearman's rank correlation asks a different one: when one variable goes up, does the other consistently go up (or down), whatever the shape? Most lost marks in IB Maths AI SL bivariate statistics come from mixing up those two questions, or from using a regression line where it should not be used.
This guide shows how to calculate both coefficients, how to deal with tied ranks, how to read a regression line in context, and how an outlier can change everything, with four worked examples.
Where bivariate statistics sits
Bivariate data is part of Topic 4, Statistics and probability, the largest topic in AI SL. Both papers require a GDC, so you will rarely calculate r by hand. The marks are in choosing the right tool, setting out the calculator work and, above all, interpreting. For one-to-one practice on exactly these question styles, see our IB Maths AI SL tuition.
The hypothesis tests that often follow (chi-squared and the t-test) are covered separately in our AI SL statistics and hypothesis tests guide, so this post stays with correlation and regression.
The vocabulary in one table
| Term | Meaning |
|---|---|
| Pearson's r | Strength and direction of a linear relationship, from −1 to 1 |
| Spearman's r_s | Strength and direction of a monotonic relationship (always increasing or always decreasing), calculated from ranks |
| Regression line of y on x | The least-squares line y = ax + b, used to predict y from a given x |
| Mean point (x̄, ȳ) | Always lies on the regression line, and should lie on any trend line you draw by eye |
| Interpolation | Predicting inside the range of the data: generally reliable if r is strong |
| Extrapolation | Predicting outside the range: unreliable |
For describing strength, many textbooks use rough bands: |r| above about 0.75 strong, 0.5 to 0.75 moderate, 0.25 to 0.5 weak, below that very weak. Use the words your teacher uses, and always say "linear" and give the direction.
Worked example 1: regression line, prediction and extrapolation
Eight students record hours of revision (x) and their test score out of 100 (y).
| x (hours) | 2 | 3 | 5 | 6 | 8 | 9 | 11 | 12 |
|---|---|---|---|---|---|---|---|---|
| y (score) | 41 | 48 | 52 | 60 | 63 | 70 | 74 | 81 |
(a) Find r and describe the correlation.
GDC (two-variable statistics or linear regression): r = 0.990. This is a strong positive linear correlation.
(b) Find the regression line of y on x. y = 3.73x + 35.0 (3 s.f.).
(c) Interpret the gradient and the intercept.
- Gradient: each extra hour of revision is associated with about 3.73 more marks.
- Intercept: the model predicts 35 marks with no revision, but x = 0 is outside the data (2 to 12 hours), so treat this with caution.
(d) Predict the score for 7 hours. 3.73 × 7 + 35.0 ≈ 61.1. This is interpolation with a strong r, so it is reliable. In fact x̄ = 7 and ȳ = 61.125, so this prediction is the mean point itself.
(e) Comment on using the line for 20 hours. It gives 109.6, which is impossible on a test out of 100. Twenty hours is far outside the data, so this is extrapolation and not reliable.
(f) Does revision cause higher scores? Correlation alone does not show this. Students who revise more may also attend more lessons or find the topic easier. Our post on correlation and causation in IB maths explores this point.
Worked example 2: Spearman's rank with tied values
Eight flats are listed with their distance from a metro station (km) and monthly rent (₹ thousand).
| Flat | A | B | C | D | E | F | G | H |
|---|---|---|---|---|---|---|---|---|
| Distance | 1.2 | 2.5 | 3.1 | 4.0 | 4.0 | 5.6 | 7.2 | 8.5 |
| Rent | 62 | 55 | 58 | 47 | 44 | 40 | 41 | 30 |
| Distance rank | 1 | 2 | 3 | 4.5 | 4.5 | 6 | 7 | 8 |
| Rent rank | 8 | 6 | 7 | 5 | 4 | 2 | 3 | 1 |
Ranking. Rank each variable separately, in the same direction (here smallest = 1). D and E tie on 4.0 km, sharing ranks 4 and 5, so each gets the average, 4.5.
Calculating r_s. Enter the two rank lists in the GDC and calculate Pearson's r on the ranks: r_s = −0.946 (3 s.f.).
Interpretation. Strong negative association: flats further from the station tend to be cheaper, and the pattern is consistent.
About the shortcut formula. Some books give r_s = 1 − 6Σd² ÷ (n(n² − 1)). Here Σd² = 162.5, giving −0.935. That differs from −0.946 because of the tie: the shortcut is exact only when there are no tied ranks. Calculating r on the ranks works in every case.
Worked example 3: when Pearson's r understates a relationship
A bacteria count is recorded each hour.
| Hour t | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|
| Count | 3 | 5 | 9 | 17 | 33 | 65 | 129 | 257 |
GDC: r = 0.850, but r_s = 1.
The count rises every single hour, so the ranks match perfectly and Spearman's coefficient is 1. Pearson's r is lower only because the points curve upwards rather than lying on a line. A straight-line model would be the wrong choice here; the data calls for an exponential model, the kind of choice covered in our AI SL modelling post.
Worked example 4: one outlier
Return to the revision data from example 1 and add a ninth student: 4 hours of revision and a score of 95.
| Without the new student | With the new student | |
|---|---|---|
| Pearson's r | 0.990 | 0.524 |
| Spearman's r_s | 1 | 0.65 |
One unusual point roughly halves Pearson's r. Spearman's falls too, but less, because a rank cannot be more than "highest"; the 95 counts as rank 9 however large it is. When a question asks about "the effect of the outlier", say which coefficient changes more and why. Then check the context: is 95 a recording error, or a real student who should stay in the data?
Choosing the coefficient
| Situation | Use |
|---|---|
| Scatter looks roughly like a straight line | Pearson's r, then the regression line if you need predictions |
| Steadily rising or falling but curved | Spearman's r_s |
| Data is already ranks (judges' positions, league places) | Spearman's r_s |
| Clear outliers you cannot remove | Spearman's r_s is less affected |
Mistakes our tutors see
- "Strong correlation" with no direction or "linear". Write "strong positive linear correlation".
- Predicting x from the y on x line. AI SL questions use the y on x line to predict y from x.
- Extrapolating without comment. If x is outside the data range, say the prediction is unreliable.
- Ranking in opposite directions. Both variables must be ranked the same way.
- Ignoring ties, or giving tied values consecutive ranks.
- r_s = 1 read as "linear". It means perfectly monotonic, not a straight line.
- Causation claims. A strong r never proves that x causes y.
Exam technique
- Write what the GDC computed: "from GDC, r = 0.990" and "y = 3.73x + 35.0".
- Use the variables' names when interpreting the gradient: "per hour of revision", not "per x".
- Keep three significant figures for coefficients, but use unrounded line values when predicting.
- For "is the prediction reliable?", give two reasons: strength of r and whether x is in range.
- Bivariate data is also a common area for the exploration. Our walk-through of the IA criteria shows how the mathematics is judged there; the analysis and writing stay the student's own.
Self-check
- Describe r = −0.12. Answer: very weak negative linear correlation.
- Rank the values 5, 8, 8, 10 from smallest. Answer: 1, 2.5, 2.5, 4.
- A regression line is y = 2.4x + 11, from data with x between 5 and 20. Predict y when x = 12, and comment on using x = 40. Answer: 39.8; x = 40 is extrapolation, so unreliable.
- A regression line has gradient 4 and the mean point is (6, 30). Find its equation. Answer: y = 4x + 6.
- Data rises every time but curves sharply. Which coefficient describes the relationship better? Answer: Spearman's r_s.
Where this leads next
The same data skills support the AI SL normal distribution and descriptive statistics guide, and the AI SL topics overview shows the rest of Topic 4. At HL, curved data is straightened with logarithms before regression; our AI HL linearising data post shows how.
How Maths Bodhi helps
In the free demo our tutor gives a short scatter-plot question and listens to how the student interprets it, because that is where AI SL statistics marks are won or lost. Each student is matched to a tutor who teaches AI SL, works on their own GDC model, and practises past-paper style questions with written feedback on interpretation. For focused practice before mocks or finals, see our IB exam maths support.
Home tuition is available in Gurgaon (Gurugram). Students elsewhere in India and abroad learn with us online. You can book a free demo class.
Written and checked by the Maths Bodhi team. Facts checked against official IB sources, November 2026.
Frequently asked questions
- What is the difference between Pearson's and Spearman's correlation?
- Pearson's r measures how close data is to a straight line. Spearman's r_s uses ranks and measures whether one variable consistently increases or decreases as the other increases, whatever the shape.
- How do you calculate Spearman's rank on the GDC?
- Rank each variable in the same direction, give tied values the average of their ranks, enter the two rank lists and calculate Pearson's r on them. That value is r_s.
- How do you deal with tied ranks in Spearman's rank?
- Give each tied value the mean of the ranks they would share. Two values tied for 4th and 5th each get rank 4.5.
- When is a regression line prediction reliable?
- When the correlation is strong and the x-value is inside the range of the data. Predictions outside the range are extrapolation and are unreliable.
- Can I use the regression line of y on x to predict x?
- No. The y on x line is designed to predict y from a given x. In AI SL, use it only in that direction.
- Does a strong correlation mean one variable causes the other?
- No. Correlation shows an association. Another factor may drive both variables, so causation needs other evidence.
