From the free course AP Statistics on Lykke
5.4 Residuals
Key concepts: Residual e = observed y − predicted ŷ, measured vertically · Positive residual — the model underpredicted that observation · Negative residual — the model overpredicted that observation · Residual plot — residuals graphed against x or against ŷ · Random scatter in the residual plot — the linear model is appropriate · Curvature in the residual plot — a line is the wrong model
Every linear model is an approximation of reality, and the "error" of that approximation is captured in the residual. A residual measures the vertical distance between an observed data point and the value predicted by the regression line.
Every linear model is an approximation of reality, and the "error" of that approximation is captured in the residual. A residual measures the vertical distance between an observed data point and the value predicted by the regression line. It represents the portion of the response variable ($y$) that the explanatory variable ($x$) fails to explain.
Definition: Residual (VAR-2.B.1) The residual ($e$) for a specific observation is the difference between the observed value ($y$) and the predicted value ($\hat{y}$). $$e = \text{Observed } y - \text{Predicted } \hat{y}$$ $$e = y - \hat{y}$$
Determining the Model and the Residual (Skill 3.B)
Before calculating a residual, we must determine the equation of the Least-Squares Regression Line (LSRL). This line is unique because it minimizes the sum of the squared residuals. To find the equation $\hat{y} = b_0 + b_1x$, we use the summary statistics of the dataset: the means ($\bar{x}, \bar{y}$), the standard deviations ($s_x, s_y$), and the correlation coefficient ($r$).
Worked Example: Electric Vehicle Range
A researcher tracks the "Age of Battery" (years) and the "Maximum Range" (miles) for five identical electric vehicle models to see how capacity degrades over time.
| Age ($x$) | Range ($y$) |
|---|---|
| 1 | 295 |
| 2 | 280 |
| 3 | 275 |
| 4 | 250 |
| 5 | 240 |
Step 1: Determine the LSRL Equation (Skill 3.B) Using technology or summary statistics ($\bar{x}=3, \bar{y}=268, s_x \approx 1.58, s_y \approx 22.25, r \approx -0.987$), we calculate the slope ($b_1$) and intercept ($b_0$):
- Slope: $b_1 = r \left( \frac{s_y}{s_x} \right) \approx -0.987 \left( \frac{22.25}{1.58} \right) \approx -13.9$
- Intercept: $b_0 = \bar{y} - b_1\bar{x} = 268 - (-13.9)(3) = 309.7$
- Equation: $\widehat{\text{Range}} = 309.7 - 13.9(\text{Age})$
Step 2: Calculate a Specific Residual (VAR-2.B.1) Let’s find the residual for the car that is 4 years old (Observed $y = 250$).
- Predict: $\hat{y} = 309.7 - 13.9(4) = 254.1$ miles.
- Subtract: $e = y - \hat{y} = 250 - 254.1 = -4.1$ miles.
- Interpret: The actual range of this 4-year-old car is 4.1 miles less than predicted by the linear model.
Analyzing Residual Plots (VAR-2.C.1, Skill 4.A)
A residual plot is a scatterplot where the $x$-axis represents the explanatory variable (or predicted values) and the $y$-axis represents the residuals. This tool is essential for visualizing how well a linear model fits the data.
| Feature | Interpretation (Skill 4.A) |
|---|---|
| Random Scatter | If residuals are scattered randomly above and below the $e=0$ line with no clear pattern, a linear model is appropriate. |
| Curved Pattern | If residuals show a "U" or "inverted U" shape, the relationship is likely nonlinear, and a linear model is not adequate. |
| Changing Spread | If the vertical spread of residuals increases or decreases as $x$ increases (fanning), the model's predictive reliability varies across the domain. |
Assessing Model Adequacy (Skill 4.D)
Statistical practice requires us to justify why we chose a specific model. A high correlation ($r$) or a high coefficient of determination ($r^2$) is not enough to prove that a linear model is appropriate. You must examine the residual plot.
The Golden Rule of Adequacy (VAR-2.C.1): A linear model is appropriate for the data if and only if the residual plot shows a random scatter of points around the horizontal line at zero, with no discernable non-linear pattern.
Misconception Check: The "Perfect" Line
Misconception: A residual of zero means the model is "wrong" for other points. Correction: A residual of zero simply means the observed value fell exactly on the regression line. Furthermore, the sum of all residuals in a least-squares regression will always be zero ($\sum e = 0$), meaning the positive and negative "errors" perfectly cancel each other out.
Misconception Check: Correlation vs. Adequacy
Misconception: "Since $r = 0.99$, the linear model is the best fit." Correction: Even with a near-perfect correlation, if the residual plot shows a curve, a linear model is technically inappropriate. A curved model (like a quadratic or exponential) would be a better representation of the underlying relationship.
Interpretation Check
A researcher calculates a residual of $+12.5$ for a data point.
- Did the linear model overpredict or underpredict the actual value?
- Is the data point located above or below the regression line?
(Answer: 1. Underpredict; 2. Above. Since $e = y - \hat{y}$, a positive value means the actual $y$ was greater than the predicted $\hat{y}$.)
