COLLEGE STATISTICS • DESCRIPTIVE STATISTICS

Residual Plots

Visualizing model fit by examining the gap between observed data and predicted values.

Historical Context & Motivation

The concept of fitting a line to data has ancient roots, but the formal analysis of the deviations from that line — what we now call residuals — emerged from the fertile intersection of astronomy, geodesy, and probability theory in the late eighteenth and early nineteenth centuries. Early scientists recognized that simply drawing a best-fit line was insufficient; one needed a principled way to evaluate whether that line truly captured the underlying relationship. The practice of plotting residuals against fitted values or predictor variables grew out of this tradition, providing a visual diagnostic that reveals patterns invisible in the raw scatter of data.

1805
Legendre's Least Squares
Adrien-Marie Legendre published the method of least squares, formalizing the idea of minimizing the sum of squared deviations (residuals) between observed data and a fitted model. This gave residuals a precise mathematical definition.
1809
Gauss and the Normal Error Model
Carl Friedrich Gauss independently derived least squares and connected residuals to the normal distribution, establishing the probabilistic framework that underpins modern regression diagnostics.
1922
Fisher's ANOVA Framework
Ronald Fisher formalized the decomposition of total variation into explained and residual components, making residual analysis an integral part of experimental design and model evaluation.
1973
Anscombe's Quartet
Francis Anscombe demonstrated four data sets with nearly identical summary statistics but strikingly different scatter plots — a powerful argument that numerical summaries alone are insufficient and visual diagnostics like residual plots are essential.

The fundamental question that residual plots address is deceptively simple: Does the model I have chosen adequately describe the structure in my data, or is there systematic information left unexplained? Summary statistics like R² and standard error provide numerical answers, but they can mask critical violations of model assumptions. A residual plot translates this abstract question into a visual form, enabling analysts to detect non-linearity, heteroscedasticity, and outliers at a glance.

Core Principles & Definitions

Before constructing a residual plot, it is essential to understand what residuals are and what properties a well-fitting model should exhibit. A residual is defined as the difference between an observed response value and the value predicted by the regression model. A residual plot graphs these differences — typically on the vertical axis — against the fitted (predicted) values or a predictor variable on the horizontal axis. The resulting scatter should appear as a random cloud if the model is appropriate, but deviations from randomness signal model inadequacy.

1

Residual Definition

The residual for observation i is eᵢ = yᵢ − ŷᵢ, where yᵢ is the observed value and ŷᵢ is the predicted value from the fitted model. Positive residuals indicate under-prediction; negative residuals indicate over-prediction.
2

Random Scatter (Ideal)

If the model is appropriate, residuals should display no systematic pattern when plotted against fitted values. They should scatter randomly around the horizontal zero line with roughly constant spread.
3

Constant Variance (Homoscedasticity)

The vertical spread of residuals should remain approximately the same across all levels of the predictor. A fan or funnel shape indicates heteroscedasticity — a violation of a key regression assumption.
4

Zero Mean

In ordinary least squares regression, the residuals always sum to zero by construction. Any localized departure from zero suggests the model is systematically biased in that region of the predictor space.
5

Independence

Residuals should not show serial patterns — such as runs of positive followed by negative values — when plotted in order of data collection. Autocorrelation patterns suggest that time or sequence effects are unmodeled.
KEY TAKEAWAY
Think of a residual plot like a medical X-ray for your regression model. The scatter plot of data shows the patient's outward appearance, while the residual plot reveals the internal structure — exposing fractures (non-linearity), inflammation (heteroscedasticity), and foreign objects (outliers) that are invisible from the surface. A clean residual plot, showing nothing but random noise, is the statistical equivalent of a clean bill of health.

Visual Explanation

The following diagram illustrates how residuals are computed from a simple linear regression and then displayed in a residual plot. On the left panel, a scatter plot of data with a fitted regression line shows each observation's deviation from the line. On the right panel, those deviations are replotted with the predicted value (ŷ) on the horizontal axis and the residual (e) on the vertical axis. Notice how the "ideal" residual plot shows a random scatter centered on zero.

Left panel: a scatter plot with data points (cyan) and the least-squares regression line (violet dashed). The pink dashed segment shows the residual eᵢ for one observation. Right panel: the corresponding residual plot displays residuals on the vertical axis against fitted values (ŷ) on the horizontal axis. The pink dashed line at zero is the reference; an ideal residual plot shows random scatter around this line.

In the left panel, each cyan data point sits at some vertical distance from the violet regression line — that distance is the residual for that observation. When the model captures the true relationship, these distances are governed only by random noise, so re-plotting them in the right panel yields a shapeless cloud. If you were to observe a discernible curve, fan, or cluster in the right panel, it would suggest that the linear model is missing a structural feature of the data. The power of the residual plot is precisely this transformation: it strips away the fitted trend and leaves only the model's mistakes for inspection.

Mathematical Framework

The mathematical foundation of residual analysis rests on the ordinary least squares (OLS) regression framework. Consider a simple linear regression model relating a response variable y to a single predictor x. The model posits that each observed response is the sum of a systematic component and a random error term. The residuals are the sample analogues of these unobservable error terms, and residual plots serve as the primary graphical tool for assessing whether the assumptions about those errors hold.

SIMPLE LINEAR REGRESSION MODEL
yᵢ = β₀ + β₁xᵢ + εᵢ
where yᵢ is the observed response for observation i, β₀ is the y-intercept, β₁ is the slope, xᵢ is the predictor value, and εᵢ is the random error term assumed to be independently distributed as N(0, σ²).
FITTED VALUE
ŷᵢ = b₀ + b₁xᵢ
where ŷᵢ is the predicted (fitted) value for observation i, and b₀ and b₁ are the sample estimates of β₀ and β₁ obtained by minimizing the sum of squared residuals.
RESIDUAL
eᵢ = yᵢ − ŷᵢ
The residual eᵢ is the vertical distance between the observed data point and the regression line. By OLS construction, Σeᵢ = 0 and Σxᵢeᵢ = 0, meaning the residuals sum to zero and are uncorrelated with the predictor.
SUM OF SQUARED RESIDUALS (SSE)
SSE = Σᵢ₌₁ⁿ eᵢ² = Σᵢ₌₁ⁿ (yᵢ − ŷᵢ)²
SSE quantifies the total unexplained variation in the response. The OLS estimates b₀ and b₁ are chosen to minimize this quantity. Dividing SSE by (n − 2) yields the mean squared error (MSE), an unbiased estimate of σ².

The key insight is that if the true model is linear and the errors εᵢ satisfy the standard assumptions — normality, constant variance, independence — then the residuals eᵢ should approximate these properties. A residual plot of eᵢ versus ŷᵢ therefore provides a direct visual check: curvature implies the linearity assumption is violated, a funnel shape implies non-constant variance, and clustering or runs imply dependence. While formal hypothesis tests exist for each of these assumptions (e.g., the Breusch–Pagan test for heteroscedasticity, the Durbin–Watson test for autocorrelation), the residual plot remains the first and often most informative diagnostic tool.

Interpreting Residual Plot Patterns

The true diagnostic power of a residual plot lies in the analyst's ability to read its patterns and translate them into actionable modeling decisions. Below is a visual catalog of four common residual plot signatures, each paired with its diagnostic interpretation and the corrective action it implies. Learning to distinguish these patterns is one of the most important practical skills in applied regression.

Four common residual plot patterns. Panel A (emerald) shows the ideal random scatter indicating a well-specified model. Panel B (red) reveals a U-shaped curve, indicating the true relationship is non-linear. Panel C (amber) displays a fan shape — widening spread — indicating heteroscedasticity. Panel D (violet) shows an isolated point far from the zero line, flagged as a potential outlier.

Each pattern in the diagram above maps to a specific diagnosis. Random scatter (Panel A) confirms that the chosen model form and assumptions are reasonable. Curvature (Panel B) signals that a higher-order polynomial term, a logarithmic transformation, or some other non-linear specification should be considered. A fan or funnel shape (Panel C) indicates that the variance of the errors is not constant — a condition called heteroscedasticity — which inflates standard errors and invalidates confidence intervals; remedies include variance-stabilizing transformations (e.g., log or square root of y) or weighted least squares. Finally, isolated outliers (Panel D) warrant investigation: they may reflect data entry errors, measurement anomalies, or genuinely unusual observations. Removing them without justification is statistically irresponsible, but ignoring them is equally problematic because they can distort coefficient estimates and inflate the residual standard error.

Worked Example

Suppose a researcher collects data on study hours (x) and exam scores (y) for eight students, fits a simple linear regression, and wants to construct a residual plot to assess whether the linear model is appropriate.

Raw data: study hours and exam scores for 8 students
StudentHours (x)Exam Score (y)
1152
2258
3362
4468
5573
6676
7782
8885
Constructing and Interpreting a Residual Plot
1
Step 1 — Compute summary statisticsWe need the means of x and y. x̄ = (1 + 2 + 3 + 4 + 5 + 6 + 7 + 8) / 8 = 36 / 8 = 4.5. ȳ = (52 + 58 + 62 + 68 + 73 + 76 + 82 + 85) / 8 = 556 / 8 = 69.5.
x̄ = 4.5, ȳ = 69.5
2
Step 2 — Calculate the slope (b₁) and intercept (b₀)Using the formulas b₁ = Σ(xᵢ − x̄)(yᵢ − ȳ) / Σ(xᵢ − x̄)² : Σ(xᵢ − x̄)(yᵢ − ȳ) = (−3.5)(−17.5) + (−2.5)(−11.5) + (−1.5)(−7.5) + (−0.5)(−1.5) + (0.5)(3.5) + (1.5)(6.5) + (2.5)(12.5) + (3.5)(15.5) = 61.25 + 28.75 + 11.25 + 0.75 + 1.75 + 9.75 + 31.25 + 54.25 = 199.0. Σ(xᵢ − x̄)² = 12.25 + 6.25 + 2.25 + 0.25 + 0.25 + 2.25 + 6.25 + 12.25 = 42.0. So b₁ = 199.0 / 42.0 ≈ 4.738. Then b₀ = ȳ − b₁ × x̄ = 69.5 − 4.738 × 4.5 ≈ 69.5 − 21.321 = 48.179.
ŷ = 48.18 + 4.74x
3
Step 3 — Compute fitted values and residualsFor each student, compute ŷᵢ = 48.18 + 4.74xᵢ and then eᵢ = yᵢ − ŷᵢ. Student 1: ŷ₁ = 48.18 + 4.74(1) = 52.92, e₁ = 52 − 52.92 = −0.92. Student 2: ŷ₂ = 57.66, e₂ = 0.34. Student 3: ŷ₃ = 62.39, e₃ = −0.39. Student 4: ŷ₄ = 67.13, e₄ = 0.87. Student 5: ŷ₅ = 71.87, e₅ = 1.13. Student 6: ŷ₆ = 76.61, e₆ = −0.61. Student 7: ŷ₇ = 81.34, e₇ = 0.66. Student 8: ŷ₈ = 86.08, e₈ = −1.08.
Residuals: −0.92, 0.34, −0.39, 0.87, 1.13, −0.61, 0.66, −1.08
4
Step 4 — Plot residuals vs. fitted valuesOn the horizontal axis, place the fitted values (ŷ₁ through ŷ₈). On the vertical axis, place the corresponding residuals (e₁ through e₈). Draw a horizontal reference line at e = 0. Examine the resulting scatter for patterns.
Plot created: residuals scattered randomly around zero
5
Step 5 — Interpret the residual plotThe residuals alternate in sign and range from about −1.08 to 1.13 — there is no systematic curvature, no fan shape, and no extreme outlier. The spread appears roughly constant across the range of fitted values. We conclude that the linear model is a reasonable fit for these data and that the assumptions of linearity and constant variance are not obviously violated.
Conclusion: The linear model ŷ = 48.18 + 4.74x is appropriate for these data.

Strengths, Limitations & Comparisons

Residual plots are among the most widely used diagnostic tools in statistics, but like any method, they have both strengths and limitations. Understanding these trade-offs helps analysts decide when to rely on visual diagnostics versus formal statistical tests.

Comparison of strengths and limitations of residual plots
AspectStrengthsLimitations
AccessibilityIntuitive and easy to construct; requires no specialized software beyond basic graphing capabilities.Interpretation is subjective — different analysts may disagree about whether a pattern is present, especially with small samples.
Assumption CheckingSimultaneously reveals violations of linearity, constant variance, and the presence of outliers in a single graphic.Cannot detect violations of normality; a normal probability plot (Q-Q plot) of residuals is needed for that purpose.
Sample Size SensitivityEffective even with moderate sample sizes (n ≥ 20), where patterns become visually distinguishable.With very small samples (n < 15), random variation alone can produce apparent patterns, leading to false diagnoses.
GeneralityApplicable to simple regression, multiple regression, ANOVA, and any model where residuals can be computed.In multiple regression, residual plots against individual predictors can be misleading due to confounding; partial residual plots may be preferred.
Formal RigorExcellent as an exploratory diagnostic and a complement to numerical summaries like R² and RMSE.Does not provide p-values or test statistics; formal tests (e.g., Breusch–Pagan, Durbin–Watson) are needed for confirmatory analysis.
KEY TAKEAWAY
Residual plots are like a field engineer's visual inspection of a bridge — fast, holistic, and capable of catching gross structural defects. But just as the engineer eventually needs stress calculations and load-bearing tests, the statistician needs formal hypothesis tests to confirm what the residual plot suggests. The best practice is to use both: start with the visual, then validate with the numerical.

Connection to Advanced Regression Diagnostics

The basic residual plot introduced in this lesson is the gateway to a rich family of regression diagnostic techniques. As models grow more complex — adding multiple predictors, interaction terms, or non-linear components — the simple eᵢ versus ŷᵢ plot is supplemented by more specialized variants. Understanding where the basic residual plot sits within this hierarchy prepares you for courses in regression analysis, econometrics, and machine learning.

Basic residual plots vs. advanced regression diagnostics
Diagnostic ToolWhat It DoesWhen to Use It
Basic Residual Plot (eᵢ vs. ŷᵢ)Displays raw residuals against fitted values; checks linearity, constant variance, and outliers.First diagnostic for any regression — simple or multiple. Covered in this lesson.
Standardized Residual PlotDivides each residual by its estimated standard deviation, putting all residuals on a common scale.When comparing residuals across observations with different leverages; points beyond ±2 or ±3 are flagged.
Partial Residual Plot (Component Plot)Isolates the effect of a single predictor in a multiple regression by plotting (eᵢ + bⱼxᵢⱼ) vs. xᵢⱼ.When assessing linearity with respect to one predictor while controlling for the others.
Normal Q-Q Plot of ResidualsCompares the distribution of residuals to a theoretical normal distribution via quantile matching.When normality of errors is a critical assumption (e.g., for confidence intervals and hypothesis tests on coefficients).
Cook's Distance PlotMeasures the influence of each observation on the entire set of fitted values; identifies high-leverage outliers.When a few observations may be disproportionately driving the regression results.

As you progress into inferential statistics and multiple regression, you will encounter these advanced tools as natural extensions of the residual plot concept. The unifying principle remains the same: the residuals carry the information about what the model failed to capture, and any diagnostic built from residuals is fundamentally about asking whether that leftover information is truly random or contains recoverable structure.

Practice Problems

PROBLEM 1CONCEPTUAL
Explain why a residual plot that shows a clear U-shaped (parabolic) curve indicates a problem with the fitted model. What specific regression assumption is violated, and what does the pattern tell us about the relationship between x and y?
PROBLEM 2BASIC CALCULATION
A simple linear regression yields the equation ŷ = 12.5 + 3.2x. For an observation where x = 5 and y = 30, compute the residual. Is this observation above or below the regression line?
PROBLEM 3INTERMEDIATE
A regression model is fit to 20 data points, yielding the following five fitted values and residuals: (ŷ = 10, e = −1.2), (ŷ = 20, e = 0.5), (ŷ = 30, e = 2.8), (ŷ = 40, e = −4.1), (ŷ = 50, e = 6.3). Describe what pattern these five points suggest on a residual plot. Which regression assumption might be violated, and why?
PROBLEM 4APPLIED
An environmental scientist models the relationship between daily temperature (x, in °C) and electricity consumption (y, in MWh) for a city over 30 days. The scatter plot of y vs. x appears reasonably linear, and R² = 0.87. However, the residual plot of eᵢ vs. ŷᵢ reveals a clear U-shaped curve. Should the scientist rely on the high R² and conclude the linear model is adequate? What would you recommend?
PROBLEM 5CRITICAL THINKING
Consider a data set with n = 8 observations. A colleague fits a linear regression and shows you a residual plot that looks perfectly random. She argues this confirms the model is correct. Provide a rigorous critique of this claim, discussing at least two reasons why a clean residual plot with such a small sample may be insufficient evidence of model adequacy.

Lesson Summary

A residual is defined as eᵢ = yᵢ − ŷᵢ, the difference between the observed and predicted values. A residual plot graphs these residuals on the vertical axis against fitted values (or a predictor) on the horizontal axis. When the regression model is appropriate, the residual plot displays random scatter around the zero line with roughly constant spread (homoscedasticity). Departures from this ideal reveal model problems: a curved pattern indicates non-linearity, a fan shape signals heteroscedasticity, and isolated extreme points flag potential outliers.

Residual plots complement numerical summaries like and the residual standard error by providing a visual diagnostic that can detect problems those statistics may obscure. As you advance, basic residual plots extend into standardized residual plots, partial residual plots, and Cook's distance plots — all built on the same fundamental principle that the residuals reveal what the model missed.

Varsity Tutors • College Statistics • Residual Plots