KS Maths
Topic 4.4 · AA and AI, SL and HL

Correlation and regression

A strong correlation is one point away from a weak one

Pearson's r, the regression line, and the two marks that are not about calculating anything.

This video lesson is a free sample. The plans open the rest of the lessons in this course, each with a figure to move and questions that check your answer as you type. See the plans.
Words you need (10 key words in this lesson)

The maths words this lesson uses, in plain English. Open this before you start if English is not your first language.

correlation
How strongly two sets of data are linked.Hours of study and test scores show positive correlation.
regression
A method for finding the best straight line through data.The regression line predicts y from x.
gradient
How steep a line is. Up divided by across.A line going up 2 for each 1 across has gradient 2.
estimate
Find an answer that is close, but not exact.Estimate 19 times 21 as 20 times 20.
degree
The highest power of x in a polynomial. Also, the unit for measuring angles.The degree of x cubed plus x is 3.
positive
Greater than zero.7 is a positive number.
negative
Less than zero. A negative number has a minus sign.Minus 4 is a negative number.
significant figure
A digit that matters for the size of a number. Counting starts at the first non-zero digit.0.0382 to 2 significant figures is 0.038.
linear
Making a straight line. The letter has power 1.y = 2x plus 1 is linear.
interpret
Say what the numbers or graph mean in the real situation.Interpret the gradient as the cost per item.

Warm-up

Four quick ones from earlier work. Try each on paper before you open the answer; a slip here shows you what to watch for later in the lesson.

  1. Find the gradient of the line through (2, 7) and (6, 19).
    Answer

    (19 − 7) ÷ (6 − 2) = 12 ÷ 4 = 3. Change in y over change in x, with the points in the same order top and bottom.

  2. A line has equation y = 3x + 4. In words, what does the 3 tell you?
    Answer

    For every 1 unit increase in x, y increases by 3 units. Saying the gradient is 3 only restates it: the meaning is the “for every 1 more …” sentence.

  3. Find the mean of 4, 7, 9, 12.
    Answer

    (4 + 7 + 9 + 12) ÷ 4 = 32 ÷ 4 = 8. A regression line always passes through the point made from the two means.

  4. A line was fitted using values of x from 2 to 8. Is an estimate at x = 5 interpolation or extrapolation? What about x = 11?
    Answer

    x = 5 is inside the range of the data, so interpolation. x = 11 is outside it, so extrapolation, which is much less reliable.

Words used in this lesson
correlation
how closely two variables follow a straight line together. For example: hours of sunshine and sales of ice cream have a positive correlation.
positive / negative
y goes up as x goes up / y goes down as x goes up. For example: the more kilometres cycled, the lower the resting heart rate: negative.
correlation coefficient (r)
a number from −1 to 1 for how tightly the points sit on a line. For example: r near 1 means the points lie close to a rising line.
regression line
the straight line that best fits the points. For example: y = 2x + 5 can be a regression line of y on x.
gradient
how much y changes when x increases by 1. For example: in y = 2x + 5 the gradient is 2.
intercept
the value of y where the line crosses the y-axis, when x = 0. For example: in y = 2x + 5 the intercept is 5.
interpolation
estimating inside the range of the data. For example: data from 1 to 9 hours: an estimate at 4 hours.
extrapolation
estimating outside the range of the data, which is unreliable. For example: an estimate at 20 hours from data going up to 9.
outlier
a point far from the rest. For example: one student who revised 9 hours and scored very low.
interpret
say in words what a result means in the situation. For example: “interpret the gradient” wants a sentence about y per unit of x, with units.

Predict first. You are going to drag one point a long way. Which will do more damage to r: dragging it far along the direction of the line, up and to the right, or dragging it far straight up, away from the line? Decide, and say why, before you look.

Then check

Now try both with the same point and watch the readout for r each time, putting the point back between tries. Which did more damage? If it was not what you predicted, say what r is measuring that made the difference.

Eight students recorded hours revised and the mark they scored. The correlation looks convincing. Drag one point a long way from the others and watch how convincing it stays.

–r
–r squared
–least squares line

Eight draggable points. Nothing is stored and nothing is sent.

What r actually tells you

Pearson's product-moment correlation coefficient, r, measures how close the points lie to a straight line, and nothing else. It runs from −1 to 1.

It says nothing about the steepness of the relationship. A gentle line with points tightly on it has r near 1. A steep line with widely scattered points can have a much smaller r. Gradient and r answer different questions: how much, and how tightly.

Describing r in words. Give the direction (positive or negative) and the strength. The syllabus fixes no cut-offs, but a common guide for the size of r, ignoring the sign, is:

size of r0 to 0.250.25 to 0.50.5 to 0.750.75 to 1
descriptionvery weakweakmoderatestrong

So r = −0.62 is a moderate negative linear correlation. Write “linear”: r says nothing about any other shape.

r only detects linear association. Data lying perfectly on a parabola can have r near zero. A near zero r means "not linear", not "no relationship", which is why you sketch the scatter before you trust the number.

Worked example: the regression line by hand

With the eight points as they start, the means are x̅ = 5 and y̅ = 62.

b= SxySxx = 27660 = 4.6 exactly, with this data a= y̅ − b x̅ the line passes through the mean point = 62 − 4.6 × 5 = 62 − 23 = 39 y= 4.60x + 39.0 r = 0.989

Check that against the readout above before you move anything. If the two ever disagree, it is the hand calculation to distrust.

The two marks that are not calculation

Interpreting the gradient. Each extra hour of revision is associated with about 4.6 more marks. In context, with units. Writing "the gradient is 4.60" restates the answer and earns nothing.

Interpreting the intercept. The 39 is the mark the model predicts for 0 hours of revision. The data starts at 1 hour, so even that is a small extrapolation. In many contexts the intercept has no sensible meaning at all (a person of height 0 cm), and saying so is the interpretation.

Knowing the limit. Predicting from 40 hours gives 4.6 × 40 + 39 = 223, a mark above 100. The model was built from data between 1 and 9 hours, and outside that range it is extrapolation. The impossible value is the proof.

Association is not cause. The data cannot tell you that revising causes higher marks. A student who revises nine hours is probably different in other ways too. Saying so is worth a mark; reciting "correlation does not imply causation" without naming an alternative explanation usually is not.

On the GDC: regression and r

The gradient, the intercept and r all come from one command. Typing the data in correctly is the whole job.

When you may use it. Applications allows a calculator in every paper. Analysis does not allow one in Paper 1, so if you sit AA you must be able to do this without the machine as well.

TI-Nspire CX II

  1. Put x in one column and y in the next in Lists & Spreadsheet
  2. menu → Statistics → Stat Calculations → Linear Regression (mx+b)
  3. Read m, b and r

Casio fx-CG50

  1. MENU → Statistics, x into List 1 and y into List 2
  2. F2 CALC → F3 REG → F1 X for ax+b
  3. Read a, b and r

The mark people lose. The calculator will happily extrapolate. It has no idea the test is marked out of 100, so for twenty hours of revision this line returns 131. The GDC gives the line; deciding where the line means anything is yours.

A second example, finished by you

The same hand method on new data, with a different sign. The first three steps are written out with the reason for each; the last is yours. Cover the reasons and see if you can say them first.

Five cyclists record their weekly distance x (km: 2, 4, 6, 8, 10) and their resting heart rate y (beats per minute: 64, 60, 55, 53, 48). The summary values are x̅ = 6, y̅ = 56, Sxx = 40 and Sxy = −78. Find the regression line of y on x and use it to estimate the resting heart rate at 7 km.

  1. b = Sxy ÷ Sxx = −78 ÷ 40 = −1.95The gradient is Sxy over Sxx, with the sign kept. The negative sign says y falls as x rises: more cycling goes with a lower heart rate.
  2. a = y̅ − b x̅ = 56 − (−1.95)(6) = 56 + 11.7 = 67.7The line passes through the mean point. Subtracting a negative is adding, which is where the sign slips happen. Use the unrounded gradient.
  3. y = −1.95x + 67.7Write the line out before you use it. The gradient is negative and the intercept is positive.
  4. Substitute x = 7 into your line. Then check that the answer is sensible: 7 km is inside the range of the data, so this is interpolation.Your step. Write it out in full before you type the answer below.

Your answer. Type the estimated resting heart rate at 7 km, in beats per minute, to 2 decimal places.

Check before you go on

One question that tells you whether the main idea has landed. Each wrong option is a different common slip, so the reply tells you which one you made.

The points (−3, 9), (−2, 4), (−1, 1), (0, 0), (1, 1), (2, 4) and (3, 9) lie exactly on a curve, y = x². What can you say about the correlation coefficient r for these points?

The points (−3, 9), (−2, 4), (−1, 1), (0, 0), (1, 1), (2, 4) and (3, 9) lie exactly on a curve, y = x². What can you say about the correlation coefficient r for these points?

Where it decides something

A running club fits the regression line of 5 km time T (minutes) on weeks of training w, using members who had trained for between 1 and 12 weeks: T = 36 − 0.9w. A new member plans to train for 18 weeks, and the coach wants to promise them a time under 21 minutes by then.

Use the model to predict the 5 km time after 18 weeks, in minutes, to 1 decimal place. Then decide whether the coach should make the promise.

Your turn

1. A cafe in Bangkok finds n = 8.2t − 118, where t is the maximum temperature in degrees Celsius and n is iced coffees sold. Estimate sales at 31 degrees. The model was built from days with maximum temperatures between 26 and 36 degrees.

2. Using the same model, the owner asks about 5 degrees. Why should you refuse to answer with this model?

3. Two data sets both have r = 0.95. Set A has a regression gradient of 0.4; set B has a gradient of 12. What does that tell you?

4. A market stall records the maximum temperature t (°C) and the number of bottles of water sold, w, on seven days.

t24262729303235
w58667170828496

Use your GDC to find the equation of the regression line of w on t. Type its gradient, to 2 decimal places, then say in a sentence what it means for the stall.

Where the marks go

Finding the line is two marks and almost nobody loses them, because the calculator does it. Do not spend your revision there.

One mark is interpretation in context with units. One is knowing when the model stops applying. Those two are where the grades separate, and neither requires a calculation.

Do not round the gradient and then use the rounded value to find the intercept. With real data that loses accuracy marks.

Something to think about

The line for the eight students is y = 4.6x + 39 (hours revised x, mark y). The teacher decides to mark out of 50 instead of 100, so every mark is halved. What is the new line? What happens to r, and why?

One way to think about it

Think of what happens to every y-value and what that does to the line passing through the mean point. Then ask what r is measuring: the gradient, or how tightly points sit on a line? Test your answer on the mean point (5, 62).

Climb to an exam question

Five steps, each one a little harder, on one small set of data. Use the regression function in your technology. They lead to an exam-style question on different data.

Step 1 of 5: find the correlation coefficient. A teacher records the hours of practice per week, x, and the test score, y, of six students. x: 1, 2, 4, 5, 7, 9. y: 12, 15, 19, 24, 27, 35. Find the correlation coefficient r, correct to three significant figures.

Step 2 of 5: describe the correlation. Which statement describes the correlation between hours of practice and test score for these six students?

Which statement describes the correlation between hours of practice and test score for these six students?

Step 3 of 5: find the gradient of the regression line. Find the equation of the regression line of y on x for the same six students. Type the gradient, correct to three significant figures.

Step 4 of 5: estimate a value inside the data. Use the regression line to estimate the test score of a student who practises for 3 hours a week. Give your answer to the nearest whole number.

Step 5 of 5: judge whether an estimate can be trusted. The same line is used to estimate the score of a student who practises for 15 hours a week. The data covered 1 to 9 hours. Which statement is best?

The same line is used to estimate the score of a student who practises for 15 hours a week. The data covered 1 to 9 hours. Which statement is best?

The exam question

Written for this site in the style of the real papers. Do it on paper first, as you would in the exam, and show your working: most of the marks are for method. Give answers to 3 significant figures unless the question says otherwise. Then check each part below.

Paper 2 style · calculator (GDC) allowed · 9 marks · about 10 minutes

A biologist records the air temperature, T degrees Celsius, and the number of chirps per minute, n, made by a cricket on eight evenings. The temperatures were 18, 21, 23, 26, 28, 31, 33 and 36. The numbers of chirps per minute were 42, 55, 58, 71, 74, 88, 90 and 104.

(a) Find the product moment correlation coefficient, r, for these data. Give your answer correct to three significant figures. [2]

(b) Describe the correlation between T and n. [1]

(c) Find the equation of the regression line of n on T. Give both the gradient and the intercept correct to three significant figures. [2]

(d) Hence estimate the number of chirps per minute on an evening when the air temperature is 30 degrees Celsius. Give your answer to the nearest whole number. [2]

(e) Interpret the gradient of the regression line in this context. [1]

(f) Explain why the equation should not be used to estimate the number of chirps per minute on an evening when the air temperature is 45 degrees Celsius. [1]

Check (a). Type r, correct to 3 significant figures.

Check your working for (b)

Your description needs two things: a direction and a strength. The value of r in part (a) is the evidence for both.

Check (c). Type the gradient of the line, correct to 3 significant figures.

Check (d). Type your estimate, to the nearest whole number.

Check your working for (e)

Say what happens to the number of chirps per minute when the air temperature goes up by one degree. Use the words of the situation and the size of the change.

Check your working for (f)

Compare 45 with the range of temperatures in the data. Use the word that names what such an estimate is.

Want the rest of this topic?

This is a free sample lesson. The IB Diploma plan opens every other Diploma lesson, AA and AI, SL and HL, and every lesson from Year 7 for the refreshers. It covers every child in the family and includes all seven revision packs.

$99 for 12 months, or $149 for 2 years

One plan opens every Diploma lesson, AA and AI, SL and HL, for the whole family.

That is $8.25 a month for the whole family.

Student without a card? in one tap.

One payment. Nothing renews. Full refund within 30 days. Prices are in US$; Gumroad shows your local currency at checkout. Already paid? Type the email you paid with in the sign-in box, then click the link we send. See every price, including $19 revision packs.

Teaching this lesson?

Every lesson here has a teacher page beside it: worked answers, what each common wrong answer tells you about a student's thinking, and questions at three levels for the board. Every unit has a free sample lesson for students, and a plan opens every other lesson.

See the teacher pages