James Ashton MathsFREE MATHEMATICS. OPEN TO EVERYONE.
HomeIB DiplomaA levelAbout
IB Diploma › Maths AA HL › Topic 4: Statistics & probability › Correlation & regression

Correlation & regression

Scatter diagrams, Pearson's correlation coefficient, regression lines of y on x and x on y, and using them sensibly to make predictions.

SL 4.44.10SL + HL extensionPaper 1Paper 2≈ 45 min to work through
Before you start: straight lines and the mean. See Straight lines and Data.

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.

  • Describe correlation from a scatter diagram (direction and strength)SL 4.4
  • Find and interpret Pearson's correlation coefficient rSL 4.4
  • Draw a line of best fit by eye through the mean pointSL 4.4
  • Find the regression line of y on x with the GDC and use it to predictSL 4.4
  • Know when a prediction is reliable (interpolation, strong correlation)SL 4.4
  • Use the regression line of x on y to predict xSL 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.

The big idea

When two quantities are measured together (hours studied and test score, height and arm span), a scatter diagram shows whether they are related. The correlation coefficient measures how close the points are to a straight line, and the regression line lets you make predictions.

2.1 Correlation

Positive correlation: as one variable increases, the other tends to increase. Negative correlation: as one increases, the other tends to decrease. The closer the points lie to a straight line, the stronger the correlation.

  • Pearson's r lies between −1 and 1. Close to ±1: strong linear correlation. Close to 0: weak or no linear correlation.
  • r>0: positive correlation; r<0: negative correlation.
  • Correlation does not imply causation: both variables may depend on a third.
Correlation is not causation

Ice cream sales and drowning numbers are positively correlated, but ice cream does not cause drowning. Both increase in hot weather. Correlation only tells you that two variables move together; it does not tell you why. Also, r only measures linear relationships: data that follows a clear curve can have r close to 0.

2.2 Regression lines

The regression line of y on x, y=ax+b, is the line that best predicts y from x. It always passes through the mean point (x¯,y¯). Interpret a as the change in y for each increase of 1 in x.

"Best" has a precise meaning. For each point, measure the vertical distance to the line (the prediction error). The regression line is the line that makes the total of the squared errors as small as possible. Your calculator finds it for you.

The gradient has a meaning in context. If score =4.6×hours+36, then each extra hour of study is linked to about 4.6 more marks. The y-intercept may not make sense if x=0 is far outside the data.

Worked example 1Paper 2
Hours studied x: 2, 3, 5, 6, 8, 9. Test score y: 45, 50, 62, 65, 78, 80. Find r and the regression line of y on x, and predict the score for 7 hours.
GDC: r=0.996: a very strong positive linear correlation.
y=5.17x+34.9
x=7: y=5.17(7)+34.9=71.1
7 is inside the data range (interpolation) and r is close to 1, so the prediction is reliable.

2.3 Reliable predictions

  • Interpolation (inside the range of the data) with a strong r is reliable.
  • Extrapolation (outside the range) is unreliable.
  • Use the y on x line to predict y. To predict x from y, use the regression line of x on y (SL 4.10): it is a different line.
Worked example 2Paper 2
For the data above, estimate the hours studied by a student who scored 70.
Predicting x from y: use the regression line of x on y.
GDC: x=0.192y−6.65
y=70: x=6.78 hours
Worked example 3 (faded)Paper 1
The mean point of a data set is (5.5, 63.3) and the regression line of y on x has gradient 5.17. Find the y-intercept.
63.3=5.17(5.5)+b, so b= 34.9  ← you work this out
On your TI-Nspire Calculator tricks →

Enter x and y in two columns of a Lists & Spreadsheet page. Then menu → 4: Statistics → 1: Stat Calculations → 3: Linear Regression (mx+b). The output gives m, b and r. For x on y, swap the X List and Y List.

3Explore it

Move the last data point. Watch how one unusual point changes r and pulls the regression line. The cross marks the mean point.

★HL extension

Extra depth for HL: harder worked examples and HL-standard exam questions.

There is no extra regression content at HL, but HL questions use the properties of the regression line algebraically. The most useful fact: the regression line of y on x always passes through the mean point (x¯,y¯).

Using the mean point

Worked example H1Paper 1
For a set of data, x¯=5, y¯=12, and the regression line of y on x has gradient 1.8. Find its equation.
12=1.8(5)+c⇒c=3
y=1.8x+3
Worked example H2Paper 2
The data x: 1, 2, 3, 4, 5 and y: 2, 4, 5, k, 9 have y¯=5.6. Find k and the regression line of y on x.
20+k5=5.6⇒k=8
GDC: y=1.8x+0.2, r=0.988
Check: the line passes through (3,5.6) ✓
A quick check with the mean point.

What correlation does not tell you

A strong correlation does not mean one variable causes the other: both may depend on a third variable. A single outlier can change r a lot, and r only measures linear association: data on a perfect curve can have r close to 0.

HL exam-style questions

Question 1Paper 1[4 marks]

For a bivariate data set, x¯=8 and y¯=20. The regression line of y on x is y=ax+4.

  • (a)Find the value of a.[2]
  • (b)Use the line to estimate y when x=10, and state one condition for this estimate to be reliable.[2]
(a)
20=8a+4M1
a=2A1
(b)
24A1
x=10 is within the data range and the correlation is strongR1
Question 2Paper 2[5 marks]

The data x: 1, 2, 3, 4, 5 and y: 2, 4, 5, k, 9 have a mean y-value of 5.6.

  • (a)Find k.[2]
  • (b)Find the equation of the regression line of y on x and the value of r.[3]
(a)
20+k=28M1
k=8A1
(b)
y=1.8x+0.2A1A1
r=0.988A1

4Common mistakes & exam tips

Common mistakes

  • Using the y on x line to predict x.
  • Extrapolating far outside the data and calling it reliable.
  • Saying a strong correlation proves that one variable causes the other.
  • Describing r without both direction and strength.

Exam tips

  • Interpret the gradient in context with units, e.g. "the score increases by about 5.2 marks per extra hour".
  • Give r to 3 s.f. and describe it in words.
  • A line of best fit by eye should pass through the mean point.

5Practice

Fluency questions build the basics. Problem-solving questions make you think about which method to use.

FluencyP1
Describe the correlation when r=−0.92.
Strong negative linear correlation.
FluencyP2
Describe the correlation when r=0.15.
Very weak (almost no) positive linear correlation.
FluencyP3
The regression line is y=2.4x+10. Predict y when x=5.
22
FluencyP4
The mean point is (4, 20) and the line has gradient 3. Find the equation of the line.
y=3x+8
Problem solvingP5
Ice cream sales and drownings are strongly positively correlated. Does eating ice cream cause drowning?
No: both increase in hot weather. Correlation does not imply causation.
Problem solvingP6
A regression line was found from x-values between 10 and 35. Explain whether a prediction at x=60 is reliable.
No: it is extrapolation, far outside the data range.

6Exam-style questions

Original questions in the style of the IB exam, with full markschemes. Give yourself about 1 minute per mark.

Question 1Paper 2[7 marks]

The temperature x (°C) and hot drink sales y at a café were recorded: x: 10, 15, 20, 25, 30, 35; y: 52, 48, 45, 39, 35, 30.

  • (a)Find Pearson's correlation coefficient r.[2]
  • (b)Describe the correlation.[1]
  • (c)Find the regression line of y on x.[2]
  • (d)Predict the sales when the temperature is 28 °C.[1]
  • (e)Use an appropriate regression line to estimate the temperature on a day when 42 drinks were sold.[1]
(a)
r=−0.997A2
(b)
Very strong negative linear correlationA1
(c)
y=−0.886x+61.4A1 A1
(d)
36.6 (about 37 drinks)A1
(e)
x on y: x=−1.12y+69.0, giving 21.9 °CA1
Question 2Paper 1[4 marks]

For a data set, x¯=6 and y¯=40. The regression line of y on x is y=ax+16.

  • (a)Find a.[2]
  • (b)Interpret a if x is the number of hours worked and y is pay in euros.[2]
(a)
40=6a+16M1
a=4A1
(b)
Pay increases by €4A1
for each extra hour workedA1
Question 3Paper 1[3 marks]

Match each value of r to a description: r=0.98, r=−0.5, r=0.02.

0.98: very strong positiveA1
−0.5: moderate negativeA1
0.02: no linear correlationA1

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 real IB questions. Your school or teacher will have these papers.

PaperQuestionFocusDifficulty
May 2025 · TZ2 · Paper 2Q1Find regression line and estimate a value from it★☆☆
Nov 2025 · TZ1 · Paper 2Q3Means, missing value from regression line, correlation coefficient★☆☆
May 2024 · TZ1 · Paper 2Q5Correlation coefficient and predictions from test scores★★☆
Nov 2024 · Paper 2Q10Population models: linear regression, exponential, logistic, derivatives★★★
Spotted a mistake on this page?Tell me and I'll fix it. The button opens an email with this page already named, or write to jamesashtonmaths@gmail.com.
Report a mistake