KS Maths
Year 11 Extended · Unit 5 Sampling, correlation and regression · Lesson 4 of 5

The regression line

The regression line: the line that makes the squared gaps smallest

Many lines pass through the mean point. The regression line of y on x is the one for which the total of the squared vertical gaps is smallest, and its gradient and intercept come from the same sums as r. This lesson finds it by formula once, and then with a GDC.

Statistics and ProbabilityGDC optional

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.

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.
square
Multiply a number by itself. Also, a shape with four equal sides and four right angles.5 squared is 25.
mean
The total of all values divided by how many values there are.The mean of 2, 4, 6 is 4.
add
Put numbers together to find the total.Add 3 and 4 to get 7.
straight line
A line that does not bend.A ruler draws a straight line.
less than
Not as big as. The sign is <.3 is less than 5.
intercept
The point where a line or curve crosses an axis.The y-intercept is where x is zero.
height
How tall something is, measured straight up.The height of the box is 5 cm.
standard deviation
A number that shows how far data are from the mean on average.A small standard deviation means data are close together.

Preview You are reading the start of this lesson. The rest opens with a plan. See plans Already paid? Sign in

Warm-up

Three quick ones from earlier work. Try each in your head or on paper before you open the answer.

  1. From Year 9: a line is y = 3x + 8. Find y when x = 5.
    Answer23, because 3 × 5 + 8 = 23.
  2. From Lesson 2: the sum of dx² is 20 and the sum of dx × dy is 30. What is the sum of dx × dy divided by the sum of dx²?
    Answer30 ÷ 20 = 1.5.
  3. From Lesson 3: r = 0.6, the sum of dx² is 16 and the sum of dy² is 25. What is the sum of dx × dy?
    Answer0.6 × √(16 × 25) = 0.6 × 20 = 12.
Words used in this lesson
regression line
the line of y on x that makes the total of the squared vertical gaps smallest. For example: the line used to predict a plant's height from its hours of light.
gradient
how much y changes for a rise of 1 in x. For example: a gradient of 1.5 means y rises by 1.5 for each extra 1 in x.
intercept
the value of y where the line crosses the y-axis. For example: the height at 0 hours of light.
residual
the gap from a dot to the line: the dot's y minus the line's y. For example: a plant 2 cm below the line.
least squares
the method that chooses the line with the smallest total of squared gaps. For example: the rule that picks the regression line.

Which line is the best line?

Five plants of the same kind were grown with x hours of daily light, from 1 to 5, and their heights y were recorded in centimetres: 14, 17, 17, 22 and 25. The mean point is (3, 19). A line through the mean point can be tilted like a seesaw about that point. The gap from a dot to a line is how far the dot is above or below it, measured straight up or down.

Predict first: as you tilt the line, the total of the squares of the five gaps changes. Between gradient 1 and gradient 4, at roughly which gradient do you think it is smallest? Then drag the slider and watch the small graph.

02460102030xygradientsquared gaps1234
2gradient
13y-intercept of the line
10total of the squared gaps

Gradient 2: the line through the mean point is y = 2x + 13, and the squares of the five gaps add to 10.

Show me the steps
  1. Gradient 2: the line is y = 2x + 13. The gaps are −1, 0, −2, 1 and 2 (dot minus line), and their squares add to 1 + 0 + 4 + 1 + 4 = 10.
  2. Gradient 3: the line is y = 3x + 10 and the squares of the gaps add to 6, smaller than 10.
  3. Gradient 2.7: the line is y = 2.7x + 10.9 and the squares add to 5.1, the smallest of all the gradients. This is the regression line.
  4. Gradient 4: the line is y = 4x + 7 and the squares add to 22. Tilting too far makes the total grow again, so there is one lowest point.

The regression line of y on x is the line that makes the total of the squared gaps smallest.

  • Its gradient is b = (sum of dx × dy) ÷ (sum of dx²), the same sums as in r. Equivalently b = r × (spread of y) ÷ (spread of x).
  • It passes through the mean point, so its intercept is a = (mean of y) − b × (mean of x). The line is y = a + bx.
  • Because it passes through the mean point, the gaps (the residuals) add to 0.
  • It is for predicting y from x, inside the data. A GDC gives it from two lists.

Many lines go through the mean point. Which one is the regression line, and what decides it? Think about the gaps, and what happens to them once they are squared. And a regression line can be worked out for any dots, however poorly they follow a line, so a regression line is not evidence that a straight line is a good model. That is the work of the next lesson.

The rest of this lesson is in the full course

Still to come in this lesson:

  • Worked examples
  • Check before you go on
  • Your turn

In the full lesson every figure moves as you drag it, and every answer you type is checked, with a note on what each wrong answer means.

Years 7 to 11 plan$59Every lesson from Year 7 to Year 11, so the refresher links always open, and every Year 7 to 11 revision pack, for the whole family. $59 for 12 months or $99 for 2 years.
IB Diploma plan$99Every lesson from Year 7 to the IB Diploma, AA and AI, SL and HL, for the whole family. $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.

One payment. Nothing renews. Full refund within 30 days. Prices are in US$; Gumroad shows your local currency at checkout. Pay by card on Gumroad, then come back here and type the email you paid with: we email you a sign-in link. For a refund, reply to your Gumroad receipt or email hello@ksmaths.com.

Try a free sample lesson in every unit, and the whole Skill Tree. See this unit.

Already have a revision pack or the Years 7 to 11 plan? Move up and the unused part of what you paid comes off.

Teaching students who need extra support? Student codes for 5, 10 or 30 students.

Year 11 revision pack, $19BuyPlan $59