The least-squares line

Lessons and exercises follow the school system and stay in its language.Les leçons et les exercices suivent le système scolaire et restent dans sa langue.Lektionen und Übungen folgen dem Schulsystem und bleiben in seiner Sprache.

About this lesson

Integrated Math I › Descriptive statistics: two variables

To save a PDF, choose “Save as PDF” in the print dialog.

Sources and credits

Original sedifier lesson.

Written with AI assistance; every answer is checked by our math engine. Not yet reviewed by a teacher.

This lesson: CC BY-SA 4.0, © sedifier · All credits

The least-squares line

Descriptive statistics: two variables. two-way tables, scatterplots, correlation, line of best fit, residuals

Discover

A line fits some points, but none lies exactly on it. Which line is 'best'?

  1. The one that makes the sum of the squared vertical misses as small as possible
  2. Any line through two of the points

Key idea

Least squares.

The least-squares line y=mx+by = mx + b makes ∑(yi−mxi−b)2\sum (y_i - mx_i - b)^2 as small as possible. It always passes through the mean point (xˉ,yˉ)(\bar{x}, \bar{y}).

Worked example

Data: (1,2)(1, 2), (2,3)(2, 3), (3,7)(3, 7). The least-squares slope is 2.5. Find bb.

xˉ=2\bar{x} = 2, yˉ=4\bar{y} = 4
Mean point.
4=2.5×2+b4 = 2.5 \times 2 + b, so b=−1b = -1
The line passes through it.

Your turn, guided

Your turn: the line has slope 3 and xˉ=4\bar{x} = 4, yˉ=20\bar{y} = 20. Find bb.

b=8b = 8
20=3×4+b20 = 3 \times 4 + b.

Practice ★

  1. A least-squares line has slope 7 and the mean point is (7,57)(7, 57). Find its intercept bb.
  2. A least-squares line has slope 8 and the mean point is (8,25)(8, 25). Find its intercept bb.
  3. A least-squares line has slope 8 and the mean point is (5,43)(5, 43). Find its intercept bb.

Practice ★★

  1. Three points have residuals 11, −1-1 and 00 for the line y=2x+1y = 2x + 1. Find the sum of the squared residuals.
  2. Three points have residuals 11, −1-1 and 00 for the line y=2x+9y = 2x + 9. Find the sum of the squared residuals.

Exit ticket

Two questions to check.

  1. A least-squares line has slope 7 and the mean point is (7,57)(7, 57). Find its intercept bb.
  2. A least-squares line has slope 8 and the mean point is (8,25)(8, 25). Find its intercept bb.

Summary card

Least squares

  • Minimize the sum of squared residuals.
  • The line passes through (xˉ,yˉ)(\bar{x}, \bar{y}).

Every spreadsheet's 'trend line' is a least-squares line.

Sources and credits

Original sedifier lesson.

Written with AI assistance; every answer is checked by our math engine. Not yet reviewed by a teacher.

This lesson: CC BY-SA 4.0, © sedifier · All credits