AP Statistics • Exploring Two-Variable Data

Residuals

Measuring how far observed data deviate from a regression model reveals fit quality and hidden patterns.

A scatter plot with data columns and a percentage symbol.
Inside this lesson 10 sections 5 questions 8 figures

SECTION 1

Historical Context & Motivation

The idea of measuring how well a mathematical model fits observed data is central to modern statistics, but it did not emerge overnight. Long before the term residual entered common statistical vocabulary, scientists and mathematicians were grappling with discrepancies between their theoretical predictions and real-world measurements. The need to quantify these discrepancies—and to use them diagnostically—drove much of the development of regression analysis and the broader field of mathematical statistics. Understanding this history illuminates why residuals remain one of the most powerful tools for assessing model adequacy.

1805 • Legendre and Least Squares

Adrien-Marie Legendre published the method of least squares, explicitly minimizing the sum of squared differences between observed and predicted values—the first formal treatment of residuals as quantities to be optimized.

1809 • Gauss and the Normal Distribution

Carl Friedrich Gauss provided a probabilistic justification for least squares by showing that if measurement errors follow a normal distribution, the method yields maximum-likelihood estimates—linking residuals to the theory of probability.

1886 • Galton Introduces Regression

Francis Galton coined the term 'regression' while studying heredity, observing that offspring measurements 'regressed' toward the population mean. Residuals became central to quantifying how individual observations deviated from the regression line.

1922 • Fisher Formalizes Regression Diagnostics

R. A. Fisher formalized analysis of variance and regression diagnostics, establishing residuals as essential tools for checking model assumptions such as constant variance, normality, and independence.

1973 • Anscombe's Quartet

Frank Anscombe demonstrated four data sets with nearly identical summary statistics but vastly different scatter plots, powerfully illustrating that examining residual plots—not just numerical summaries—is essential for sound statistical practice.

This rich history converges on a single guiding question: after fitting a model to data, what information remains in the deviations between observed and predicted values? Residuals answer that question by capturing everything the model failed to explain—random noise, systematic patterns, or both. Mastering their interpretation is one of the most important skills tested on the AP Statistics exam.

SECTION 2

Core Principles & Definitions

A residual is the vertical distance between an observed response value and the value predicted by a regression model. In the context of a least-squares regression line (LSRL), each data point (xi, yi) has a corresponding predicted value ŷi on the line, and the residual is ei = yi − ŷi. This seemingly simple subtraction encodes a wealth of diagnostic information about the quality and appropriateness of the fitted model.

1

Definition of a Residual

Residual = Observed − Predicted (ei = yi − ŷi). A positive residual means the model underestimated; a negative residual means it overestimated.
2

Sum of Residuals Is Zero

For a least-squares regression line, the residuals always sum to zero (Σei = 0). This is a mathematical consequence of how the LSRL is derived—it passes through (x̄, ȳ).
3

Residual Plots Reveal Patterns

Plotting residuals against the explanatory variable (or predicted values) should show random scatter if the model is appropriate. Curved patterns, fan shapes, or clusters signal model inadequacy.
4

Standard Deviation of Residuals (s)

The quantity s = √(Σe²/(n − 2)) measures typical residual size and is reported on the AP exam as the 'standard deviation of the residuals' or 'standard error of the estimate.' Smaller s means better fit.
5

Connection to r² (Coefficient of Determination)

r² quantifies the proportion of variability in y explained by the regression on x. The residuals represent the remaining (1 − r²) proportion of unexplained variability.
✦

KEY TAKEAWAY

Think of residuals like the error signal in an engineering feedback loop. If you design a thermostat to maintain 72°F, the residual at any moment is the difference between the actual temperature and 72°F. When the residuals bounce randomly around zero, your thermostat (model) is working well. But if you notice a consistent drift—say the residuals are always positive in the afternoon—you have a systematic pattern revealing that your model is missing something important (perhaps solar heating). In statistics, examining residuals is how we diagnose whether a linear model captures the true relationship in the data.

SECTION 3

Visual Explanation — Residuals on a Scatter Plot

The most intuitive way to understand residuals is to see them as vertical line segments on a scatter plot. Each segment connects an observed data point to the least-squares regression line, with its length representing the magnitude of the residual and its direction (above or below the line) indicating the sign. The following diagram illustrates this concept with a small data set and its fitted LSRL.

Scatter Plot with Residuals Shown as Vertical Segmentsx (Explanatory Variable)y (Response Variable)80604020246810ŷ = 5 + 5.4xe=+6.2e=+5.0e=−1.8e=−4.0e=+5.6Observed point (x, y)LSRLPositive residualNegative residual
Each cyan dot is an observed data point. The violet line is the LSRL (ŷ = 5 + 5.4x). The dashed green segments represent positive residuals (observed above predicted) and the dashed red segments represent negative residuals (observed below predicted). The numeric labels show each residual's value.

Notice how residuals are measured vertically, not perpendicularly to the line. This is because regression models predict the response variable y for a given x, so the relevant error is the vertical discrepancy between the observed y and the predicted ŷ. Points above the line have positive residuals (the model under-predicted), while points below the line have negative residuals (the model over-predicted). On the AP exam, you should be comfortable computing individual residuals from the equation of the LSRL and interpreting their signs in context.

SECTION 4

Mathematical Framework

The mathematical machinery behind residuals connects to the derivation of the least-squares regression line itself. The LSRL is the unique line that minimizes the sum of squared residuals, which means understanding the residual formula is inseparable from understanding why the line takes the form it does.

RESIDUAL FORMULA

ei=yi−y^ieᵢ = yᵢ − ŷᵢ

Where ei is the residual for the i-th observation, yi is the observed response, and ŷi = b₀ + b₁xi is the predicted value from the LSRL.

LEAST-SQUARES CRITERION

MinimizeSSE=Σi=1nei2=Σi=1n(yi−y^i)2Minimize SSE = Σᵢ₌₁ⁿ eᵢ² = Σᵢ₌₁ⁿ (yᵢ − ŷᵢ)²

The sum of squared errors (SSE), also called the sum of squared residuals, is the quantity the LSRL minimizes. Squaring prevents positive and negative residuals from canceling.

STANDARD DEVIATION OF RESIDUALS

s=√(Σei2/(n−2))s = √(Σeᵢ² / (n − 2))

The denominator is n − 2 because fitting a line estimates two parameters (b₀ and b₁), leaving n − 2 degrees of freedom. This quantity s represents the typical size of a residual and is the standard deviation of the residuals reported on calculator output.

COEFFICIENT OF DETERMINATION

r2=1−(SSE/SST)=1−Σ(yi−y^i)2/Σ(yi−yˉ)2r² = 1 − (SSE / SST) = 1 − Σ(yᵢ − ŷᵢ)² / Σ(yᵢ − ȳ)²

SST = Σ(yi − ȳ)² is the total sum of squares. When SSE is small relative to SST, the regression explains a large proportion of the variability in y, and r² is close to 1.

💡

AP Exam Tip

When interpreting s on the AP exam, use language like: "The typical distance between the observed y-values and the y-values predicted by the regression line is approximately s [units of y]." Always include the context (units) of the response variable.

SECTION 5

Residual Plots — Diagnosing Model Fit

While individual residual values are informative, the real diagnostic power of residuals emerges when they are plotted. A residual plot places the explanatory variable x (or equivalently, the predicted value ŷ) on the horizontal axis and the corresponding residuals on the vertical axis. The pattern—or ideally, the lack of pattern—in a residual plot is a primary diagnostic for assessing whether a linear model is appropriate.

Residual Plot Patterns: Good Fit vs. Poor Fit✓ Good: Random Scatter+0−xResidual✗ Bad: Curved Pattern+0−xResidual✗ Bad: Fan Shape (Heteroscedasticity)+0−x✗ Bad: Cluster / Outlier+0−xoutlierA good residual plot shows no pattern — just random scatter around the zero line.
Four residual plot scenarios. Top-left (green): random scatter indicates a good linear fit. Top-right (red): a U-shaped curve indicates a nonlinear relationship. Bottom-left (amber): a fan shape indicates non-constant variance. Bottom-right: an isolated point far from the rest flags a potential outlier or influential point.

The key criterion on the AP exam is straightforward: a good residual plot shows no discernible pattern. The residuals should appear randomly scattered above and below the horizontal line at zero, with roughly constant spread across all values of x. A curved pattern (such as the U-shape in the top-right panel) is strong evidence that a linear model is not appropriate and that a transformation or a polynomial model should be considered. A fan or megaphone shape (bottom-left) indicates that the variability of y changes with x, violating the assumption of homoscedasticity (constant variance). Individual points with unusually large residuals (bottom-right) may be outliers that warrant further investigation, as they can exert disproportionate influence on the slope and intercept of the LSRL.

⚠

Common Misunderstanding

Students sometimes confuse a 'random' residual plot with a plot that has some positive and some negative residuals. Having both signs is necessary but not sufficient. The critical question is whether the signs cluster in a pattern (e.g., positive on the left, negative in the middle, positive on the right). Such a pattern means the linear model is systematically missing a curved relationship.

SECTION 6

Worked Example

A student collected data on the number of hours spent studying (x) and exam scores (y) for eight classmates. The least-squares regression line was computed as ŷ = 52.3 + 4.8x. One student studied for 7 hours and scored 89 on the exam. Let us compute and interpret the residual for this observation.

Computing and Interpreting a Residual

  1. 1

    Step 1 — Identify Known Values

    The observed values for this student are x = 7 hours and y = 89 points. The LSRL is ŷ = 52.3 + 4.8x.
  2. 2

    Step 2 — Compute the Predicted Value (ŷ)

    Substitute x = 7 into the regression equation: ŷ = 52.3 + 4.8(7) = 52.3 + 33.6 = 85.9.
    ŷ = 85.9 points
  3. 3

    Step 3 — Compute the Residual

    Apply the residual formula: e = y − ŷ = 89 − 85.9 = 3.1.
    e = 3.1 points
  4. 4

    Step 4 — Interpret in Context

    The residual of 3.1 means that this student's actual exam score was 3.1 points higher than the score predicted by the regression model for a student who studied 7 hours. Because the residual is positive, the LSRL underestimated this student's performance.
  5. 5

    Step 5 — Contextual Check

    Is a residual of 3.1 points large or small? To answer this, we would compare it to the standard deviation of the residuals (s). If s ≈ 4.2, for example, a residual of 3.1 is within one standard deviation of zero—typical and not alarming. This student performed slightly better than predicted but not unusually so.

SECTION 7

Strengths & Limitations of Residual Analysis

StrengthsLimitations
Residual plots can reveal nonlinear relationships that r² alone may not flag (a data set can have a moderately high r² yet a strongly curved residual pattern).Residuals from the LSRL assume the model form (linear). If the true relationship is nonlinear, residuals still reflect the mismatch but don't tell you which nonlinear model to use.
The standard deviation of residuals (s) gives a concrete measure of prediction accuracy in the units of the response variable, making it highly interpretable.A single outlier with a large residual can dramatically inflate s, making the overall model appear less precise than it is for the bulk of the data.
Residual analysis checks multiple conditions simultaneously: linearity, constant variance, and potential outliers—all visible in a single plot.Residual plots are visual and somewhat subjective. With small sample sizes, it can be difficult to distinguish a genuine pattern from random variation.
The sum-of-residuals-equals-zero property provides a quick arithmetic check when computing residuals by hand.Residuals do not directly assess whether x causes y; they only describe the quality of the linear fit, not causal mechanisms.

Strengths and limitations of residual analysis for LSRL

✦

KEY TAKEAWAY

Think of residual analysis as a quality-control step in manufacturing. A factory might have an average defect rate near zero (analogous to the mean residual being zero), but a control chart that plots individual defects over time can reveal systematic drift or increasing variability that the average alone would mask. Similarly, the residual plot reveals systematic model failures that summary statistics like r² might conceal.

SECTION 8

Connection to Advanced Topics

Residuals in the AP Statistics course lay the conceptual groundwork for a much broader set of ideas encountered in college-level statistics and data science. Below is a comparison of how residual concepts from this course map onto their more advanced counterparts.

AP Statistics ConceptAdvanced ExtensionWhat Changes
Residual eᵢ = yᵢ − ŷᵢStandardized residuals & studentized residualsResiduals are divided by their estimated standard error, making them comparable across observations with different leverages.
Standard deviation of residuals (s)Root mean squared error (RMSE) in machine learningConceptually identical, but applied to test data (not training data) to assess out-of-sample prediction accuracy.
Visual residual plot assessmentFormal tests (Breusch–Pagan, Durbin–Watson)Quantitative hypothesis tests replace subjective visual inspection for heteroscedasticity and autocorrelation.
Single-variable LSRLMultiple regression residualsResiduals now account for multiple predictors; partial residual plots isolate the effect of each variable.

How residual concepts scale to advanced coursework

Even in machine learning contexts where models are far more complex than a straight line, the fundamental diagnostic strategy remains the same: compute the differences between observed and predicted values, then look for patterns in those differences. Whether you are training a neural network or fitting a simple LSRL, residual analysis is the universal language of model evaluation. Mastering it now provides a conceptual foundation that will serve you throughout any quantitative discipline.

SECTION 9

Practice Problems

Question 1: CONCEPTUAL

A least-squares regression line is fit to a data set, and the residual for one observation is −4.7. Which of the following best interprets this value?
  • A. The predicted value is 4.7 less than the observed value.
  • B. The observed value is 4.7 less than the predicted value.
  • C. The observed value is 4.7 less than the mean of the response variable.
  • D. The predicted value is 4.7 more than the mean of the explanatory variable.
  • E. The data point has a leverage of 4.7.
Show answer (B)
The correct answer is B. A residual equals observed minus predicted (e = y − ŷ). A residual of −4.7 means y − ŷ = −4.7, so the observed value is 4.7 less than what the model predicted—the model overestimated. Choice A reverses the direction: it states the predicted is less than observed, which would be a positive residual. Choice C incorrectly references the mean of y rather than the predicted value from the regression line. Choice D confuses the explanatory variable with the response variable and misapplies the concept entirely. Choice E introduces leverage, which measures how extreme an x-value is, not how far the observed y is from the predicted y.

Question 2: BASIC CALCULATION

The LSRL for a data set is ŷ = 12.5 + 3.2x. For the observation (x = 5, y = 30), what is the residual?
  • A. 1.5
  • B. −1.5
  • C. 28.5
  • D. 2.25
  • E. −2.25
Show answer (A)
The correct answer is A. First compute the predicted value: ŷ = 12.5 + 3.2(5) = 12.5 + 16.0 = 28.5. Then the residual is e = y − ŷ = 30 − 28.5 = 1.5. Choice B gives the negative of the correct answer, a common error when students compute ŷ − y instead of y − ŷ. Choice C is the predicted value itself, not the residual. Choices D and E do not correspond to any correct computation with these numbers and may result from arithmetic errors such as squaring the residual or misplacing the decimal.

Question 3: INTERMEDIATE

A researcher fits a LSRL to data relating outdoor temperature (°F) to daily ice-cream sales ($). The residual plot shows a clear U-shaped pattern: residuals are positive for low and high temperatures but negative for moderate temperatures. Which conclusion is most appropriate?
  • A. The linear model is appropriate because r² is likely high.
  • B. The relationship between temperature and sales is best described by a linear model.
  • C. A linear model is not appropriate for this data; a nonlinear model should be considered.
  • D. The variance of the residuals is not constant across temperature values.
  • E. The residuals indicate that temperature does not predict ice-cream sales.
Show answer (C)
The correct answer is C. A U-shaped (curved) residual plot is the classic indicator that a linear model fails to capture the true relationship and that a nonlinear model (such as a quadratic) should be considered. Choice A is wrong because a high r² can coexist with a clearly inappropriate model—Anscombe's Quartet demonstrates this principle. Choice B directly contradicts the evidence from the residual plot. Choice D describes heteroscedasticity (a fan shape), not a curved pattern; the U-shape is about systematic curvature, not changing spread. Choice E is too extreme—the pattern in the residual plot shows that temperature does predict sales, just not in a linear fashion.

Question 4: APPLIED

4 pts
A biologist measures the wingspan (cm) and body mass (g) of 10 birds of the same species. After fitting a LSRL, the computer output reports: ŷ = −15.2 + 1.45x, r² = 0.87, s = 3.6 g. The data for one bird shows wingspan = 30 cm and mass = 32 g. (a) Compute the residual for this bird and interpret it in context. (b) Using the value of s, explain what it tells us about the accuracy of the model's predictions. (c) Based on the r² value, what proportion of the variability in body mass is NOT explained by the linear regression on wingspan? (d) Suppose the residual plot shows a clear curved pattern. Explain what this implies about the appropriateness of the linear model, even though r² = 0.87.
Show answer
Rubric (4 points): Point 1 — (a) Compute and interpret: ŷ = −15.2 + 1.45(30) = −15.2 + 43.5 = 28.3 g. Residual = 32 − 28.3 = 3.7 g. Interpretation: This bird's actual mass is 3.7 grams more than the mass predicted by the regression model for a bird with a 30 cm wingspan. The positive residual indicates the model underestimated this bird's mass. Point 2 — (b) Interpret s: The standard deviation of the residuals, s = 3.6 g, means that the typical distance between the observed body masses and the body masses predicted by the LSRL is approximately 3.6 grams. This gives a sense of the average prediction error when using wingspan to predict mass. Point 3 — (c) Proportion unexplained: Since r² = 0.87, 87% of the variability in body mass is explained by the linear relationship with wingspan. The proportion NOT explained is 1 − 0.87 = 0.13, or 13%. Point 4 — (d) Curved residual plot implication: Even though r² = 0.87, a curved residual plot indicates that the linear model systematically over-predicts in some regions and under-predicts in others. This pattern means that a linear model is not the most appropriate choice for these data. A nonlinear model (or a transformation of the data) might explain even more variability and produce randomly scattered residuals. A high r² does not guarantee that a linear model is appropriate—the residual plot is a more reliable diagnostic.

Question 5: CRITICAL THINKING

4 pts
Two students each fit a LSRL to the same data set relating study time (hours) to quiz scores (points). Student A reports r² = 0.92 and concludes that the linear model is an excellent fit. Student B examines the residual plot and observes a systematic pattern: the residuals are positive for small and large x-values but negative for mid-range x-values. (a) Explain why Student A's conclusion based solely on r² may be misleading. (b) Describe what the pattern in Student B's residual plot suggests about the true relationship between study time and quiz scores. (c) Suppose the data are re-fit with a quadratic model and the new residual plot shows random scatter. The r² for the quadratic model is 0.97. Explain how the residual information and the change in r² together support the decision to use the quadratic model. (d) A third student suggests that because r² = 0.92 is 'close enough' to r² = 0.97, the simpler linear model should be preferred. Evaluate this argument by referencing the role of residual plots in model selection.
Show answer
Rubric (4 points): Point 1 — (a) Limitation of r² alone: r² measures the proportion of variability in the response explained by the model, but it does not assess whether the form of the model (linear) is appropriate. As Anscombe's Quartet illustrates, very different data patterns can produce similar r² values. A high r² can occur even when the linear model is systematically incorrect—overestimating in some x-ranges and underestimating in others. Relying solely on r² without examining a residual plot can lead to the false conclusion that the model fits well. Point 2 — (b) What the residual pattern suggests: The U-shaped residual pattern (positive → negative → positive) is the classic signal that the true relationship is curved, not linear. The linear model misses the curvature by systematically predicting too low at the extremes of x and too high in the middle. This suggests that quiz scores may increase at a non-constant rate as study time increases—perhaps with diminishing returns at higher study times, creating a concave-down curve. Point 3 — (c) Quadratic model support: The quadratic model produces a residual plot with random scatter, indicating that the model form is now appropriate—there are no remaining systematic patterns. Additionally, r² increased from 0.92 to 0.97, meaning the quadratic model explains 5 more percentage points of variability in quiz scores. Together, the elimination of the curved residual pattern and the increase in r² provide strong evidence that the quadratic model better captures the true relationship. Point 4 — (d) Evaluating the parsimony argument: While parsimony (preferring simpler models) is a valid principle, it applies when competing models fit equally well. Here, the linear model's residual plot shows a systematic, non-random pattern—a violation of the assumption that errors are randomly distributed. The quadratic model's residual plot is free of such patterns. The 5-point increase in r² is a secondary consideration; the primary justification for the quadratic model is that it corrects a diagnosed model failure. Using a model with patterned residuals leads to biased predictions in certain x-ranges, which undermines the reliability of conclusions drawn from the model regardless of the numerical closeness of r² values.

SUMMARY

Summary

Summary

A residual is the difference between an observed response value and the value predicted by the least-squares regression line (e = y − ŷ). A positive residual means the model underestimated the response, while a negative residual means it overestimated. For any LSRL, the sum of all residuals is zero, and the LSRL is defined as the line that minimizes the sum of squared residuals (SSE).

The standard deviation of the residuals (s) measures typical prediction error in the units of y, while r² quantifies the proportion of variability in y explained by the regression on x—with (1 − r²) captured by the residuals. The most critical diagnostic tool is the residual plot: random scatter around zero indicates a good linear fit, while curved patterns signal that a linear model is inappropriate, fan shapes indicate non-constant variance, and isolated extreme points flag potential outliers. Always examine the residual plot—never rely on r² alone.

Varsity Tutors • AP Statistics • Residuals