Algebra 1Data and StatisticsS-ID.B.6

Lines of Fit and Residuals

Fit a line to data and use residuals to judge the fit.

Not started Jump to practice

A line of fit summarizes a scatter plot with an equation, which is a linear model you can use to predict. How well does it fit? Look at the residuals: how far each actual point is from the line.

Why it works

For each data point, the line predicts $\hat{y}$ (read “y-hat”) at that $x$. The residual is $y - \hat{y}$, actual minus predicted. A positive residual means the point is above the line, a negative one means below, and $0$ means on it. The least-squares line is the line that makes the sum of the squared residuals as small as possible; squaring keeps positive and negative misses from canceling and weighs big misses more. A good linear fit leaves residuals scattered randomly around $0$; a curved pattern in the residuals says a line is the wrong shape.
Green segments are positive residuals (points above the line); red are negative. Drag a point and watch the line and the residuals change.

Key idea

Residual $= y - \hat{y}$ = actual $-$ predicted. Small residuals with no pattern mean the line fits well.

Worked examples

Worked example: Compute a residual

A line of fit is $\hat{y} = 4x + 48$. A student who studied $5$ hours scored $70$. Find the residual.
  1. Predicted: $\hat{y} = 4(5) + 48 = 68$.
  2. Residual: $70 - 68 = 2$.

Answer: $2$: the student scored $2$ points above the prediction.

Worked example: Read a residual pattern

Residuals in order of $x$: $-4, -1, 2, 3, 2, -1, -4$. Is the line a good model?
  1. The residuals go negative, then positive, then negative: a curved pattern, not random scatter.

Answer: No: the data bends, so a curve would fit better.

Common mistake

Computing residuals as predicted minus actual, which flips every sign. Residual means actual minus predicted, so a point above the line has a positive residual. Check against the picture: above the line should give a positive number.

Practice

Pass with 3 right answers, the last 2 in a row. Each right answer earns 2 XP.

Loading practice…

Builds on

Leads to

Sources and further reading

  • OpenStax, Introductory Statistics, chapter 12 Linear Regression and Correlation
  • Common Core State Standards for Mathematics, S-ID.B.6: fit a function to data, use it to solve problems, and assess the fit by plotting and analyzing residuals
@teddyrookbook GitHub