← Statistics

Statistics

Scatter Plots and Residuals

Lesson

A scatter plot shows pairs of values (x,y)(x, y) as dots. When a roughly linear pattern appears, we fit a line and use it to predict.

Regression line

y^=mx+b\hat{y} = mx + b

y^\hat{y} (read “y-hat”) is the predicted y for a given x.

Residual

residual=yy^=actualpredicted\text{residual} = y - \hat{y} = \text{actual} - \text{predicted}

Positive residual: actual is ABOVE the line. Negative residual: actual is BELOW the line.

For a least-squares regression line, the residuals always sum to 0.

Worked example 1 — prediction

Line y^=2x+1\hat{y} = 2x + 1, predict at x=3x = 3:

y^=2(3)+1=7\hat{y} = 2(3) + 1 = 7

Worked example 2 — residual

Line y^=3x+1\hat{y} = 3x + 1, data point (4,15)(4, 15).

y^=3(4)+1=13\hat{y} = 3(4) + 1 = 13
residual=1513=2\text{residual} = 15 - 13 = 2

A residual plot tells a story

If residuals are scattered randomly around zero, the linear model is a good fit. If there’s a clear pattern (curve, fan shape), a linear model misses something — try a different model.

Practice

Work through these. Stuck? Click Get a hint.

Warm-Up

Quick problems to get going.

Problem 1

y^=2x+1; predict at x=3\hat{y} = 2x + 1; \ \text{predict at } x = 3

Problem 2

y^=x+10; predict at x=5\hat{y} = -x + 10; \ \text{predict at } x = 5

Problem 3

Residual: actual y=10, y^=8\text{Residual: actual } y=10, \ \hat{y}=8

Problem 4

Residual: actual y=4, y^=7\text{Residual: actual } y=4, \ \hat{y}=7

Practice

Standard problems matching the lesson.

Problem 5

y^=0.5x+2; predict at x=10\hat{y} = 0.5x + 2; \ \text{predict at } x = 10

Problem 6

yhat=3x, actual (4,15). Residual?

Problem 7

y^=2x+5; predict at x=2\hat{y} = -2x + 5; \ \text{predict at } x = 2

Problem 8

Residual: actual 20, y^=25\text{Residual: actual } 20, \ \hat{y} = 25

Problem 9

y^=4x+7; predict at x=0\hat{y} = 4x + 7; \ \text{predict at } x = 0

Problem 10

yhat=4x+5, (6,30). Residual?

Problem 11

y^=0.5x+10; predict at x=8\hat{y} = -0.5x + 10; \ \text{predict at } x = 8

Problem 12

Residual: actual 50, y^=50\text{Residual: actual } 50, \ \hat{y} = 50

Problem 13

y^=2x; predict at x=12\hat{y} = 2x; \ \text{predict at } x = 12

Problem 14

yhat=3x+1, (3,11). Residual?

Problem 15

Sum of residuals for a least-squares line equals what?\text{Sum of residuals for a least-squares line equals what?}

Problem 16

yhat=5x+10, (2,25). Residual?

Problem 17

C-hat = 3x + 50. Cost at x=20?

Problem 18

Predicted 110, actual 105. Residual?

Challenge

Harder problems — edge cases, trickier numbers, multiple steps.

Problem 19

y^=3x1; predict at x=2\hat{y} = 3x - 1; \ \text{predict at } x = -2

Problem 20

yhat=4x+1, (5,24). Residual?

Problem 21

yhat=2x+3, (4,12). Residual?

Problem 22

yhat=0.25x+1, (8,4). Residual?

Problem 23

r=0.9: strong (1) or weak (0)?

Problem 24

y^=2x+250; predict at x=100\hat{y} = -2x + 250; \ \text{predict at } x = 100

Problem 25

C-hat = 4x+20, actual at x=5 is 45. Residual?

Ask the tutor

Stuck on a concept? Want another example? Ask anything about this topic.

Type your own question below, or tap one of the suggestions. The tutor can re-explain the lesson, work through a specific problem with you, generate fresh practice tuned to where you are, or check your reasoning.

Quiz

Test yourself on this topic →

10 questions, no hints. About 5 minutes.