AP Statistics · Lesson 3

Residuals and r-squared

Know Know it

A residual is observed minus predicted: residual=y−y^\text{residual} = y - \hat{y}. A positive residual means the point is above the line, so the line underpredicted. A negative residual means the line overpredicted. For a least-squares line, the residuals add to 0.

A residual plot graphs the residuals against x. If it shows random scatter around 0 with no pattern, a linear model is appropriate. A curved pattern means a curved model would fit better. A fan shape means the size of the prediction errors changes with x.

r-squared is the proportion of the variation in y that is accounted for by the linear relationship with x. It equals the square of r; the sign of r matches the sign of the slope.

s, the standard deviation of the residuals, is the typical size of a prediction error, in the units of y.

What each number tells you about the fit
NumberWhat it tells you
ResidualHow far one point is above (+) or below (-) the line
r-squaredThe share of the variation in y accounted for by the line
sThe typical size of a prediction error, in units of y
Residual plotWhether a straight line is the right form at all

Trap A high r-squared does not prove a line is right

Data with a gentle curve can still give r-squared above 0.9. Only the residual plot shows whether the form is linear. If the residuals curve, a straight line is the wrong model, however large r-squared is.

Worked example Easy

A line gives y^=12.6+4.8x\hat{y} = 12.6 + 4.8x. One data point is x = 5, y = 30. What is its residual?

  1. -6.6Answer
  2. 6.6
  3. 36.6
  4. 66.6

How to solve it

  1. Predict: y^=12.6+4.8×5=36.6\hat{y} = 12.6 + 4.8 \times 5 = 36.6.
  2. Residual = observed - predicted = 30 - 36.6 = -6.6.
  3. Negative, so the point is below the line and the line overpredicted it.

Why each choice is right or wrong

  • A. Correct. y^=12.6+4.8(5)=36.6\hat{y} = 12.6 + 4.8(5) = 36.6, so the residual is 30−36.6=−6.630 - 36.6 = -6.6; the line overpredicted.
  • B. Incorrect. 6.6 subtracts in the wrong order, predicted minus observed; a residual is observed minus predicted.
  • C. Incorrect. 36.6 is the predicted value y^\hat{y} itself, not the difference between observed and predicted.
  • D. Incorrect. 66.6 adds the observed and predicted values, 30 + 36.6, instead of subtracting them.

Explain Explain it

Task verbs: interpret, justify

Interpret a residual in context: this car sold for 1.3 thousand dollars more than the line predicts for a car with its mileage.

Interpret r-squared in context: about 72% of the variation in resale price is accounted for by the linear relationship with mileage.

Justify a linear model from the residual plot: the residuals are scattered randomly around 0 with no curve or fan, so a line is appropriate.

Worked example Medium

A least-squares line has a negative slope and r-squared = 0.64. What is the correlation r?

  1. -0.64
  2. -0.8Answer
  3. 0.4096
  4. 0.8

How to solve it

  1. ∣r∣=r2=0.64=0.8|r| = \sqrt{r^2} = \sqrt{0.64} = 0.8.
  2. r has the same sign as the slope.
  3. The slope is negative, so r = -0.8.

Why each choice is right or wrong

  • A. Incorrect. -0.64 just puts a minus sign on r-squared; r is the square root of r-squared, with the sign of the slope.
  • B. Correct. 0.64=0.8\sqrt{0.64} = 0.8, and the negative slope makes r negative, so r = -0.8.
  • C. Incorrect. 0.4096 squares 0.64 again; to go from r-squared back to r you take a square root.
  • D. Incorrect. 0.8 has the right size, but r takes the sign of the slope, which is negative here.

Interpret Your turn

A regression of resale price (thousands of dollars) on mileage (thousands of miles) for 40 used cars of a fictional model gives r-squared = 0.72. One car has a residual of 1.3. Interpret r-squared and this residual in context.

Write it, then compare. Nothing you type here is saved or graded.

Compare with a model answer

A full answer does this

  • Says about 72% of the variation in resale price is accounted for by the linear relationship with mileage
  • Says this car sold for 1.3 thousand dollars more than the line predicts for a car with its mileage

Model answer

About 72% of the variation in resale price among these cars is accounted for by the linear relationship between price and mileage. The residual of 1.3 means this car's actual resale price was 1.3 thousand dollars higher than the line predicts for a car with its mileage.

Apply Apply it

Practice this topic. AP Practice questions on exactly what this lesson covers, with an explanation for every answer.