The least-squares regression 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

Grade 8 › Associations in data

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

Sources and credits

Written with this source as a starting point:

sedifier rewrote the text and added its own examples and exercises.

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 regression line

Associations in data. scatter plots, line of best fit, trends, two-way tables, association

Warm-up

Three quick questions from earlier lessons.

  1. A scatterplot of car age against resale value has r=−0.94r = -0.94. How would you describe the relationship?
    1. Strong, negative, linear: older cars tend to be worth less
    2. Weak, because r is negative
    3. Each extra year causes a fixed loss of value
  2. Which statements about the correlation rr of 50 pairs (x,y)(x, y) are true? Tick all that are.
    1. −1≤r≤1-1 \le r \le 1
    2. rr has no units
    3. Swapping xx and yy does not change rr
    4. rr measures the strength of any relationship, curved or straight
    5. r=0r = 0 means there is no relationship at all
  3. Heights (cm) and weights (kg) of students have r=0.58r = 0.58. Heights are converted to inches. What is the new correlation?
    1. Still 0.580.58: changing units does not change rr
    2. Smaller, since inches are bigger units
    3. It cannot be known without the data

Discover

If r=1r = 1, every point is on a line. A student 1 SD above the mean in xx is then 1 SD above the mean in yy. If r=0.5r = 0.5, how many SDs above the mean in yy would you predict?

  1. 0.5 SD
  2. 1 SD

Key idea

The line that minimizes the sum of squared residuals.

Least-squares regression line y^=a+bx\hat{y} = a + bx with slope b=r sysxb = r\,\dfrac{s_y}{s_x} and intercept a=yˉ−bxˉa = \bar{y} - b\bar{x}; it always passes through (xˉ,yˉ)(\bar{x}, \bar{y}).

Worked example

r=0.6r = 0.6, xˉ=10\bar{x} = 10, sx=2s_x = 2, yˉ=50\bar{y} = 50, sy=8s_y = 8.

  1. Step 1The data.
  2. Step 2The point of means (x̄, ȳ) = (10, 50).
  3. Step 3The line ŷ = 26 + 2.4x passes through it.
  4. Step 4Residuals: no other line makes the sum of their squares smaller.

b=2.4b = 2.4
0.6 × 8/2.
a=26a = 26
50 − 2.4 × 10.
y^=26+2.4×12=54.8\hat{y} = 26 + 2.4 \times 12 = 54.8
At x = 12.

Your turn, guided

Your turn: r=0.5r = 0.5, sx=4s_x = 4, sy=6s_y = 6. The slope.

b=0.75b = 0.75
0.5 × 6/4.

Practice ★

  1. r=0.6r = 0.6, sx=15s_x = 15 and sy=16s_y = 16. Find the slope of the least-squares regression line of yy on xx.
  2. r=0.5r = 0.5, sx=11s_x = 11 and sy=17s_y = 17. Find the slope of the least-squares regression line of yy on xx.
  1. The regression line is y^=29+2x\hat{y} = 29 + 2x. Predict yy for x=3x = 3.

Watch out!

Practice ★★

  1. The least-squares line has slope 33, and xˉ=20\bar{x} = 20, yˉ=12\bar{y} = 12. Find its intercept.
  2. The least-squares line has slope 44, and xˉ=97\bar{x} = 97, yˉ=157\bar{y} = 157. Find its intercept.

Exit ticket

Three questions to check you have got it.

  1. r=0.6r = 0.6, sx=15s_x = 15 and sy=16s_y = 16. Find the slope of the least-squares regression line of yy on xx.
  2. r=0.5r = 0.5, sx=11s_x = 11 and sy=17s_y = 17. Find the slope of the least-squares regression line of yy on xx.
  3. r=0.9r = 0.9, sx=19s_x = 19 and sy=12s_y = 12. Find the slope of the least-squares regression line of yy on xx.

Summary card

Least-squares line

b=r sy/sxb = r\,s_y/s_x, a=yˉ−bxˉa = \bar{y} - b\bar{x}, through (xˉ,yˉ)(\bar{x}, \bar{y}).

Watch out: sys_y on top.

One more step is optional: a challenge. Try it, or finish the lesson now.

Challenge ★★★

  1. r=0.9r = 0.9, sx=20s_x = 20 and sy=19s_y = 19. Every yy-value is doubled. What is the new slope of the least-squares line?
Sources and credits

Written with this source as a starting point:

sedifier rewrote the text and added its own examples and exercises.

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