Unit 5 · Topic 5.4 · about 25 minutes

Residuals

Calculate and interpret residuals, and use a residual plot to decide whether a linear model is appropriate.

Predict first

On one of the cricket nights from 5.3 Linear Regression Models, the point for that night sits well above the regression line. Did the model overestimate or underestimate that night's temperature?

Actual minus predicted

A model's prediction is rarely exactly right. The residual for an observation measures the miss:

residual=y−y^=actual y−predicted y

The order matters: always start from what actually happened.

  • A positive residual means the actual value is above the prediction. The model underpredicted (underestimated) it.
  • A negative residual means the actual value is below the prediction. The model overpredicted (overestimated) it.

On a scatterplot, a residual is the vertical gap between a point and the line, with a sign: up is positive and down is negative.

The 16 cricket nights with y^=40.73+0.2447x

607080Temperature (degrees Fahrenheit)100120140160180Chirps per minute

Every point above the line has a positive residual, and every point below it has a negative one.

Four of the 16 nights, using y^=40.73+0.2447x
Chirps per minute, xActual temperature, yPredicted, y^Residual, y−y^
1106367.65−4.65
1187569.605.40
1658381.111.89
1778184.04−3.04

Worked exampleInterpreting a residual

On the night with 118 chirps per minute, the temperature was 75 degrees. Find the residual for that night and interpret it in context.

  1. Predict. y^=40.73+0.2447(118)=69.60 degrees.

  2. Subtract, actual minus predicted. 75−69.60=5.40 degrees.

  3. Interpret in context. The actual temperature that night was 5.40 degrees higher than the model predicted for a chirp rate of 118 per minute. The model underestimated it.

Answer.

The residual is 5.40 degrees: the night was about 5.4 degrees warmer than the model predicted from the cricket's chirp rate.

Working backward from a residual

Sometimes you know the residual and need the actual value. Rearrange the definition: actual = predicted + residual.

Suppose a classmate checks a 17th night. She counts 140 chirps per minute and works out a residual of −2.3 degrees, but forgets to write down the temperature itself. The prediction is 40.73+0.2447(140)=74.99 degrees, so the actual temperature was 74.99+(−2.3)=72.69, about 72.7 degrees.

A quick sense check catches most sign errors. A negative residual means the night came in cooler than predicted, so the actual value has to be below 74.99. If your answer lands above the prediction, the sign went the wrong way.

Sort it

Did the model overpredict or underpredict? Tap each card, then tap its bin.

Model overpredicted

Model underpredicted

Residual plots

A residual plot is a scatterplot of the residuals against the explanatory variable (or against the predicted values). It takes away the overall trend so you can see what the line missed. A horizontal line at 0 marks a perfect prediction.

The question to ask of a residual plot is whether you can see a pattern. If the residuals look randomly scattered above and below 0, with no curve, the line has captured the form of the relationship, and the linear model is appropriate for the data.

Residual plot for the cricket model

−505Residual (degrees)100120140160180Chirps per minute

No curve and no trend: the residuals bounce above and below 0 without any pattern. A linear model is appropriate here.

When the residuals curve

The stopping distances in 5.2 Correlation had r=0.995, and a straight line through them looked close to perfect. Plot their residuals, though, and the bend is impossible to miss.

Residual plot for a straight line fit to stopping distances

−1001020Residual (feet)203040506070Speed (mph)

A clear U shape. The line underpredicts at low and high speeds and overpredicts in between.

A curve in the residual plot means the line is wrong in a predictable way: too low over one stretch of the data, too high over another. The linear model is not the most appropriate model for these data, however close r is to 1. Stopping distance grows faster and faster as speed increases, and a model that curves would follow it better than any straight line can.

Practice

Practice until it is automatic

Each problem gives a regression line and one observation. Find the residual, then say whether the model overpredicted or underpredicted that observation.

Predicted values and residuals practice page

Lab

Regression Playground

Watch the residual plot under the scatterplot. Arrange points so the scatterplot looks almost straight but the residual plot shows a clear curve. Then drag a single point well above the line and watch its residual jump.

Open the full Regression Playground lab

Check your understanding

1

The regression line for predicting a used laptop's resale price (dollars) from its age (months) is y^=612−11.5x. A 24-month-old laptop sold for 380 dollars. Find its residual, in dollars.

2

A coach uses a regression line to predict a runner's 5-kilometer race time (minutes) from the number of miles the runner trains per week. One runner's residual is −1.8 minutes. Which statement is correct?

3

The residual plot for a linear model shows the residuals scattered randomly in a horizontal band around 0, with no curve or other pattern. What does this indicate?

4

A linear model predicts the number of downloads of a new app from the number of days since launch. The residual plot shows residuals that are positive for the first few days, negative in the middle, and positive again for the most recent days. What should you conclude?

5

A teacher's model predicts a student's score on a 30-point quiz from the number of minutes the student studied: y^=4.2+0.85x. Dana studied for 20 minutes, and her residual was 1.8 points. What was Dana's actual score?

Course alignment, for teachers

AP Statistics topic 5.4, Unit 5: Regression Analysis.

  • Skill 3.B: Calculate summary statistics, relative positions of points within a distribution, and predicted responses.
  • Skill 4.A: Describe and compare tabular and graphical representations of data, as well as summary statistics.
  • Skill 4.D: Interpret statistical calculations and results to assess meaning or a claim.