SECTION 1
Historical Context & Motivation
The idea of fitting a straight line through data goes back to the early nineteenth century, when least-squares regression was independently developed by Adrien-Marie Legendre and Carl Friedrich Gauss to predict the orbits of celestial bodies. For over a century, practitioners applied linear models almost reflexively, rarely pausing to verify whether the assumed straight-line form was actually appropriate. It was only as data sets grew larger and computational tools became available that statisticians recognized the need for systematic diagnostics that could reveal when a linear model was misleading rather than informative.
1805 • Legendre's Least Squares
1885 • Galton's Regression to the Mean
1973 • Anscombe's Quartet
1977 • Tukey's EDA Movement
The central question this lesson addresses is deceptively simple: after you fit a line, how do you know whether the line is actually a good description of the relationship? As Anscombe's Quartet powerfully illustrates, summary statistics like r and r² can mask severe departures from linearity, making graphical residual analysis an indispensable skill for any practicing statistician.
SECTION 2
Core Principles & Definitions
Before diagnosing departures from linearity, you must be fluent in several foundational concepts that underpin residual analysis. A residual is defined as the difference between an observed response value and the value predicted by the regression line: e = y − ŷ. Residuals are the diagnostic currency of regression—they encode every piece of information the model failed to capture. When the linear model is appropriate, residuals should appear structureless; any visible pattern suggests the model is inadequate.
Residual Plot
Curvature (Nonlinearity)
Non-Constant Spread (Heteroscedasticity)
Influential Points & Outliers
Coefficient of Determination (r²)
KEY TAKEAWAY
SECTION 3
Residual Plots — The Visual Diagnostic
The single most powerful tool for detecting departures from linearity is the residual plot. The diagram below contrasts three scenarios: a residual plot consistent with a good linear fit, one showing systematic curvature, and one exhibiting non-constant spread. Study the shapes carefully—recognizing these patterns at a glance is essential on the AP exam.
When reading a residual plot, focus on two questions. First, is there a systematic shape (curve, wave, or cluster) rather than formless scatter? If so, the linear model is missing a structural feature of the data. Second, does the vertical spread remain roughly the same from left to right? Increasing or decreasing spread (the 'fan' or 'funnel' pattern) indicates that precision of prediction varies across the range of x, which undermines standard inference procedures that assume constant variance.
SECTION 4
Mathematical Framework
The least-squares regression line minimizes the sum of squared residuals. Understanding the formal definitions clarifies exactly what residuals measure and why their behavior reveals model inadequacy.
LEAST-SQUARES REGRESSION LINE
where ŷ is the predicted response, b₀ is the y-intercept, and b₁ is the slope. The slope b₁ = r × (sy / sx), and the line always passes through (x̄, ȳ).
RESIDUAL DEFINITION
A positive residual means the observed value lies above the regression line (model underestimates), while a negative residual means the observed value lies below (model overestimates). The sum of all residuals for an LSRL equals zero: Σeᵢ = 0.
COEFFICIENT OF DETERMINATION
SSE = Σ(yᵢ − ŷᵢ)² is the sum of squared residuals. SST = Σ(yᵢ − ȳ)² is the total sum of squares. r² gives the proportion of variation in y explained by the linear model. A high r² does not guarantee linearity—it only measures how much spread is reduced by the model.
STANDARD DEVIATION OF RESIDUALS
Also called the residual standard error, s estimates the typical size of a prediction error. A smaller s indicates predictions are, on average, closer to observed values. We divide by n − 2 because fitting a line consumes two degrees of freedom (one for the slope, one for the intercept).
AP Exam Tip
SECTION 5
Detailed Diagnostic Breakdown
Beyond recognizing gross patterns, effective residual analysis requires distinguishing among several specific types of departures. The diagram below illustrates additional diagnostic scenarios, including the effect of outliers and influential observations. The accompanying classification table provides a quick-reference guide for interpreting what you see.
| Residual Plot Pattern | Diagnosis | Action / Remedy |
|---|---|---|
| Random scatter, roughly constant spread around e = 0 | Linear model is appropriate | Proceed with inference; report slope, r², and s |
| Curved (U-shape or inverted-U) | Nonlinear relationship; line misses the true pattern | Try a transformation (e.g., log, square root, power) or fit a polynomial/exponential model |
| Fan or funnel shape (spread changes with x) | Heteroscedasticity (non-constant variance) | Consider a log transformation on y or use weighted regression |
| One or two points far from the rest | Outlier (large residual) or influential point (high leverage) | Investigate cause; refit without the point and compare results |
| Clusters or grouping in residuals | Possible lurking variable creating subgroups | Stratify by the grouping variable and fit separate models, or add the variable to a multiple regression model |
Residual plot pattern interpretation guide
SECTION 6
Worked Example
A biologist records age (years) and trunk diameter (centimeters) for seven oak trees. The least-squares line is ŷ = 8.9285714286 + 1.2642857143x, with R² ≈ 0.99463458. The table gives predictions and residuals from that fit. Determine what these data do and do not establish about a linear model.
| Age (x) | Diameter (y) | Predicted (ŷ) | Residual (e) |
|---|---|---|---|
| 5 | 14.0 | 15.250 | −1.250 |
| 10 | 22.5 | 21.571 | +0.929 |
| 15 | 28.0 | 27.893 | +0.107 |
| 20 | 35.0 | 34.214 | +0.786 |
| 25 | 40.0 | 40.536 | −0.536 |
| 30 | 48.0 | 46.857 | +1.143 |
| 35 | 52.0 | 53.179 | −1.179 |
Seven oak trees; predictions and residuals from ŷ = 8.9285714286 + 1.2642857143x, rounded to three decimals.
Analyzing the Oak Tree Residuals
- 1
Step 1 — Examine r²
R² ≈ 0.99463458 means this fitted line accounts for about 99.46% of the observed diameter variation. A high R² alone does not confirm linearity; examine the residuals and the limited sample size. - 2
Step 2 — Construct the Residual Plot (mentally or on calculator)
At ages 5,10,15,20,25,30,35, the residuals are approximately −1.250,+0.929,+0.107,+0.786,−0.536,+1.143,−1.179 cm. They sum to zero apart from rounding. Both positive and negative residuals occur across the age range; they do not follow a transition from positive values to increasingly negative ones. - 3
Step 3 — Identify the Pattern
These seven residuals do not establish the previously suggested monotonic curvature. Inspecting their plotted shape is still useful, but the small sample limits conclusions about model form. A high R² and a short residual series cannot certify that the population relationship is exactly linear.No established monotonic curvature; seven points limit the diagnosis. - 4
Step 4 — State the Conclusion
The fitted line closely summarizes these seven observed pairs. The residuals do not justify rejecting it on the basis of the claimed monotonic pattern or automatically applying a transformation. Continue to check model assumptions and gather more data when prediction matters; high R² alone is not sufficient validation.Retain a provisional linear summary; do not force an unsupported transformation.
Seven oak measurements determine the fitted line and residuals. Each residual is the observed diameter minus its predicted diameter; the small sample does not establish a unique growth law. The field scene illustrates circumference measurement; the supplied diameter records are the regression data, rather than values inferred from the picture.
Residuals for seven oak trees at ages 5 through 35, plotted around a common zero line within ±1.6 cm.
SECTION 7
Strengths & Limitations of Residual Analysis
| Strengths | Limitations |
|---|---|
| Residual plots can reveal curvature, non-constant spread, and outliers that summary statistics like r² completely miss. | With small sample sizes, random variation can mimic patterns, making it difficult to distinguish real departures from noise. |
| The technique requires no additional data collection—residuals are automatically produced by any regression software or graphing calculator. | Residual analysis is inherently subjective; two analysts may disagree about whether a pattern is 'systematic enough' to matter. |
| Residual plots are intuitive and communicate results visually, making them effective for both analysis and presentation. | A clean residual plot does not prove the model is correct—it only fails to reveal a problem. There may be lurking variables or issues not captured by a single predictor. |
| Identifying influential points via large residuals can flag data entry errors or unusual observations that deserve further investigation. | High-leverage points may not have large residuals precisely because they pull the line toward themselves, masking their own influence. |
Strengths and limitations of residual analysis for detecting departures from linearity
KEY TAKEAWAY
SECTION 8
Connecting to Transformations & Advanced Models
When residual analysis reveals a departure from linearity, the natural next step is to transform the data so that the relationship between the transformed variables is approximately linear. This strategy is central to the AP Statistics curriculum and connects residual diagnostics to a broader toolkit of modeling techniques. The two most common transformations—logarithmic and power—address the two most common types of curved relationships: exponential growth/decay and power functions.
| Feature | Linear Model (no transform) | Log Transformation | Power Transformation |
|---|---|---|---|
| Form of equation | ŷ = b₀ + b₁x | log(ŷ) = a + bx → ŷ = 10ᵃ × 10ᵇˣ | log(ŷ) = a + b·log(x) → ŷ = 10ᵃ × xᵇ |
| Typical pattern in original residual plot | Random scatter (model is fine) | Exponential curve; residuals accelerate | Concave-down curve; residuals level off |
| What to plot for linearity check | y vs. x | log(y) vs. x | log(y) vs. log(x) |
| When to try it | Residual plot shows no pattern | Data show multiplicative (percentage) growth | Data follow a physical/biological scaling law |
Comparing the linear model with common transformations used to address departures from linearity
In more advanced statistics courses, you will encounter polynomial regression, spline smoothing, and generalized additive models that handle nonlinearity without requiring you to choose a specific transformation. However, at the AP level, the critical skill is recognizing when the linear model fails via the residual plot and knowing that a logarithmic or power transformation may restore linearity. In the free-response section, clearly stating the evidence (the pattern in the residual plot) and the remedy (a specific transformation) demonstrates the kind of structured reasoning that earns full credit.
SECTION 9
Practice Problems
Question 1: CONCEPTUAL
- A. A high r² only indicates the slope is steep; it says nothing about the form of the relationship.
- B. A high r² means the data are approximately normal, not necessarily linear.
- C. A nonlinear relationship (such as a quadratic) can still produce a high r², so a residual plot must be checked for patterns before concluding linearity is appropriate.
- D. r² cannot exceed 0.90 for data that are truly linear, so a value of 0.95 actually suggests nonlinearity.
- E. The student should have used the correlation coefficient r instead of r², since r is more sensitive to departures from linearity.
Show answer (C)
Question 2: BASIC CALCULATION
- A. e = 2.5; the model underestimates y
- B. e = −2.5; the model overestimates y
- C. e = 2.5; the model overestimates y
- D. e = −40.5; the model overestimates y
- E. e = 40.5; the model underestimates y
Show answer (A)
Question 3: INTERMEDIATE
- A. The relationship is exponential, with output accelerating at high sunlight levels.
- B. The relationship exhibits non-constant variance (heteroscedasticity) but is otherwise linear.
- C. The true relationship is concave down: energy output increases with sunlight but at a decreasing rate, and may even decline at very high values due to overheating, producing an inverted-U residual plot with negative residuals at both extremes and positive residuals in the middle.
- D. There are influential high-leverage points at both ends of the data that are pulling the line upward.
- E. The residual plot indicates that a logarithmic transformation of x will linearize the data.
Show answer (C)
Question 4: APPLIED
4 ptsShow answer
Question 5: CRITICAL THINKING
4 ptsShow answer
SUMMARY
Lesson Summary
Summary
Analyzing departures from linearity begins with fitting a least-squares regression line and computing residuals (e = y − ŷ). The residual plot—residuals plotted against x or ŷ—is the primary diagnostic tool. A good linear fit produces random scatter with constant spread around zero. A curved pattern (U-shape or inverted-U) signals nonlinearity, a fan or funnel shape signals non-constant variance (heteroscedasticity), and isolated extreme points may indicate outliers or influential observations.
Critically, a high r² does not guarantee linearity—as Anscombe's Quartet demonstrated, dramatically different data configurations can share identical numerical summaries. When departures are detected, transformations (logarithmic or power) can often re-express the data into a linear form. Always verify a transformation's success by checking that the new residual plot shows the desired random scatter. On the AP exam, clearly describe the pattern you observe, state whether the linear model is appropriate, and if it is not, recommend a specific next step.