Statistics Graduate Level • Linear Models and GLMs

Regression Diagnostics — Diagnostics: leverage, influence, residual structure

Identifying observations that distort fitted models through leverage, influence measures, and residual analysis.

Graduate statistics illustration with a fitted curve, summation sign, and data table
Inside this lesson 10 sections 5 questions 11 figures

SECTION 1

Historical Context & Motivation

The development of ordinary least squares regression by Legendre and Gauss in the early nineteenth century provided a powerful tool for modeling relationships between variables, yet for over a century practitioners had no systematic framework for evaluating whether individual observations were unduly controlling the fit. Early statisticians relied on visual inspection of scatter plots and subjective judgment to flag problematic data points, an approach that became untenable as datasets grew in dimensionality. The formalization of regression diagnostics as a rigorous subdiscipline emerged primarily in the 1970s and 1980s, when statisticians began exploiting the algebraic structure of the hat matrix and developing quantitative measures of leverage and influence. These tools address a fundamental question in applied modeling: even when a regression passes global tests such as the F-test or R² thresholds, can a small number of observations be disproportionately responsible for the estimated coefficients and apparent goodness of fit?

1805–1809 • Foundations of Least Squares

Legendre (1805) and Gauss (1809) independently develop ordinary least squares, establishing the regression framework but without formal diagnostics for individual observations.

1972 • The Hat Matrix and Leverage

Hoaglin and Welsch popularize the hat matrix H = X(XTX)−1XT as a diagnostic tool, with its diagonal elements h_ii quantifying leverage.

1977 • Cook's Distance

R. Dennis Cook introduces Cook's distance, the first widely adopted scalar measure that combines leverage and residual magnitude to assess each observation's influence on the entire coefficient vector.

1980s • DFFITS, DFBETAS, and Residual Plots

Belsley, Kuh, and Welsch (1980) introduce DFFITS and DFBETAS for coefficient-level diagnostics. Standardized, studentized, and externally studentized residuals become standard tools for detecting heteroscedasticity and non-normality.

2000s–Present • Diagnostics for GLMs and Mixed Models

Extensions of classical leverage and influence diagnostics to generalized linear models, mixed-effects models, and high-dimensional settings emerge, using deviance residuals, Pearson residuals, and analogues of the hat matrix.

The central question that regression diagnostics address is: which observations exert disproportionate control over the fitted model, and how do the residuals reveal systematic departures from model assumptions? Without answering this question, a practitioner risks drawing inferences that rest on the peculiarities of a handful of data points rather than on genuine population-level relationships.

SECTION 2

Core Principles & Definitions

Regression diagnostics revolve around three interconnected concepts. Leverage describes how far an observation's predictor values lie from the center of the predictor space, thereby measuring its potential to affect the fitted values. Influence captures the actual effect an observation has on the estimated coefficients or fitted values when it is included versus excluded from the analysis. Residual structure refers to the patterns and distributional properties of the differences between observed and fitted responses, which serve as primary evidence for or against the validity of model assumptions such as linearity, constant variance, and normality. Together, these three pillars allow a modeler to interrogate a regression fit at the observation level, moving beyond aggregate summaries like R² or the F-statistic.

1

Leverage (h_ii)

The diagonal element of the hat matrix for observation i. It depends only on the predictor values and measures the observation's distance from the centroid of X-space. High leverage means the observation could potentially distort the fit, regardless of its response value.
2

Influence (Cook's D, DFFITS)

A measure of the actual change in the fitted model when observation i is deleted. Influence combines leverage and residual size: an observation must be both high-leverage and have a large residual to be truly influential.
3

Residual Types

Ordinary residuals (eie_i = yiy_i − ŷ_i), standardized residuals (dividing by estimated σ), and studentized (externally studentized) residuals (using leave-one-out variance). Each type has distinct diagnostic utility.
4

Outlier vs. Influential Point

An outlier has a large residual but may or may not change the fit materially. An influential point actually shifts the regression surface. A high-leverage outlier is the most dangerous combination.
5

Residual Structure & Assumptions

Patterns in residual plots—fanning, curvature, clustering—signal violations of linearity, homoscedasticity, or independence. Residuals should appear as a structureless random scatter when assumptions hold.
✦

KEY TAKEAWAY

Think of a regression fit like a see-saw balanced on a fulcrum. Leverage is how far from the fulcrum an observation sits—farther out means greater mechanical advantage. Influence is the actual tilt the observation causes, which depends on both its distance from the fulcrum (leverage) and how heavy it is (residual magnitude). An observation sitting far out on the see-saw but weighing nothing causes no tilt; a heavy observation near the center barely budges it either. Only a heavy observation far from the fulcrum truly tips the balance.

SECTION 3

Visual Explanation — Leverage vs. Influence

Leverage, Outlier Status, and Influence: A SchematicPredictor xResponse yOLS fit (all data)A: Low leverage,large residual (outlier)Low influenceB: High leverage,on regression lineLow influence (good lever.)C: High leverage,large residualHIGH INFLUENCEOLS fit with CBulk dataPoint APoint BPoint C
Point A (pink) is an outlier with a large residual but sits near the center of x-space, giving it low leverage and therefore low influence. Point B (amber) has high leverage because its x-value is extreme, but it falls near the regression line, so its influence is small. Point C (red) combines high leverage with a large residual, producing a dramatically different regression line (dashed red) and high influence.

The diagram above captures the essential taxonomy of unusual observations. Leverage is a function of the predictor configuration alone—it tells us where the observation lives in predictor space relative to the centroid of the design matrix. An observation can have extreme x-values (high leverage) yet conform perfectly to the linear trend, in which case it stabilizes rather than distorts the fit. Conversely, an observation near the centroid of x-space has limited ability to rotate the regression hyperplane even if its y-value departs wildly from the fitted value. The truly problematic observations are those that combine both features: they sit in an extreme region of predictor space and deviate substantially from the pattern established by the remaining data.

SECTION 4

Mathematical Framework

The Hat Matrix and Leverage

In the standard linear model y = Xβ + ε, the vector of fitted values is ŷ = Hy, where H is the hat matrix. This matrix is the orthogonal projection onto the column space of X and plays a central role in all diagnostic measures.

HAT MATRIX

H=X(X⊤X)−1X⊤H = X(X⊤X)⁻¹X⊤

X is the n × p design matrix. H is n × n, symmetric, and idempotent (H² = H). The diagonal element hii is the leverage of observation i. Properties: 0 ≤ hii ≤ 1, and Σhii = p (trace of H equals the number of parameters). A common rule of thumb flags hii > 2p/n as high leverage.

Residual Types

ORDINARY RESIDUAL

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

The raw difference between observed and fitted values. Under the model, Var(eᵢ) = σ²(1 − hii), so high-leverage points have smaller residual variance, making raw residuals misleading for diagnostic purposes.

INTERNALLY STUDENTIZED RESIDUAL

ri=ei/(σ^√(1−hii))rᵢ = eᵢ / (σ̂ √(1 − hᵢᵢ))

Divides the residual by its estimated standard deviation using the full-sample estimate σ̂. This standardizes residuals to have approximately unit variance, but the estimate of σ still includes observation i.

EXTERNALLY STUDENTIZED RESIDUAL

ti=ei/(σ^(−i)√(1−hii))tᵢ = eᵢ / (σ̂₍₋ᵢ₎ √(1 − hᵢᵢ))

Uses σ̂₍₋ᵢ₎, the estimate of σ computed without observation i. Under normality, tᵢ follows a t-distribution with n − p − 1 degrees of freedom, enabling formal outlier tests (Bonferroni-corrected).

Influence Measures

COOK'S DISTANCE

Di=(β^−β^(−i))⊤(X⊤X)(β^−β^(−i))/(p×σ^2)=ri2×hii/(p×(1−hii))Dᵢ = (β̂ − β̂₍₋ᵢ₎)⊤(X⊤X)(β̂ − β̂₍₋ᵢ₎) / (p × σ̂²) = rᵢ² × hᵢᵢ / (p × (1 − hᵢᵢ))

Cook's distance measures the shift in the entire coefficient vector when observation i is deleted. The second form reveals that Di is a product of residual size (ri²) and leverage (hii/(1 − hii)). Common threshold: Di > 4/n or Di > 1.

DFFITS

DFFITSi=ti×√(hii/(1−hii))DFFITSᵢ = tᵢ × √(hᵢᵢ / (1 − hᵢᵢ))

DFFITS measures the change in the fitted value ŷi when observation i is deleted, standardized by the leave-one-out standard error. Threshold: |DFFITSi| > 2√(p/n).

SECTION 5

Residual Structure & Diagnostic Plots

While scalar measures like Cook's distance and DFFITS flag individual observations, the full diagnostic picture requires examination of residual plots that reveal systematic departures from model assumptions. The four most informative diagnostic plots are: (1) residuals versus fitted values, which reveals non-linearity and heteroscedasticity; (2) the scale-location plot (√|standardized residuals| vs. fitted values), which focuses on variance structure; (3) the Q–Q plot of standardized residuals against theoretical normal quantiles, which assesses the normality assumption; and (4) the residuals-versus-leverage plot, which overlays Cook's distance contours to identify influential points. Together, these are often called the "regression diagnostic quartet" and are generated by default in statistical software packages such as R's plot(lm_object).

Diagnostic Quartet: Four Key Residual Plots1. Residuals vs FittedFitted valuesResiduals✓ Good: no pattern2. Scale-LocationFitted values√|Std. Resid.|✗ Fanning: heteroscedasticity3. Normal Q–Q PlotTheoretical quantilesStd. residuals✓ Points hug the line4. Residuals vs LeverageLeverage h_iiStd. residuals★ InfluentialD=0.5D=1
The diagnostic quartet. Plot 1 (residuals vs. fitted) shows a well-behaved random scatter. Plot 2 (scale-location) reveals fanning indicative of heteroscedasticity. Plot 3 (Q–Q) shows points closely following the reference line, consistent with normality. Plot 4 (residuals vs. leverage) identifies one observation (red star) beyond the Cook's distance D = 0.5 contour, flagging it as influential.
Diagnostic PlotWhat It DetectsWarning Signs
Residuals vs. FittedNon-linearity, heteroscedasticityCurved smoothing line, funnel/megaphone pattern
Scale-Location (√|Std. Resid.| vs. Fitted)Non-constant varianceUpward trending smoothing line, systematic spread changes
Normal Q–QNon-normality of residualsS-shaped curve (heavy tails), banana curve (skewness), detached points
Residuals vs. LeverageInfluential observationsPoints beyond Cook's distance contours (D > 0.5 or D > 1)

Summary of the four standard diagnostic plots and their interpretation.

⚠

Correlated Residuals

In time-series or spatial regression contexts, residuals may exhibit autocorrelation even when the model is correctly specified for the mean function. The Durbin–Watson test and plots of residuals against time or lag order help detect serial correlation, which violates the independence assumption and leads to underestimated standard errors.

SECTION 6

Worked Example

Suppose we fit a simple linear regression y = β₀ + β₁x + ε to n = 10 observations and obtain the following information for observation i = 7: the hat matrix diagonal is h₇₇ = 0.45, the ordinary residual is e₇ = 4.2, the full-sample root mean squared error is σ̂ = 2.1, the leave-one-out root mean squared error is σ̂₍₋₇₎ = 1.8, and p = 2 parameters are estimated. We want to compute the leverage flag, the internally studentized residual, the externally studentized residual, Cook's distance, and DFFITS.

Diagnostic Measures for Observation 7

  1. 1

    Step 1 — Check Leverage Threshold

    The leverage threshold is 2p/n = 2(2)/10 = 0.40. Since h₇₇ = 0.45 > 0.40, observation 7 is flagged as a high-leverage point. Its predictor value is far from the centroid of x.
    h₇₇ = 0.45 > 2p/n = 0.40 → High leverage
  2. 2

    Step 2 — Internally Studentized Residual

    Compute r₇ = e₇ / (σ̂ × √(1 − h₇₇)) = 4.2 / (2.1 × √(1 − 0.45)) = 4.2 / (2.1 × √0.55) = 4.2 / (2.1 × 0.7416) = 4.2 / 1.5574 ≈ 2.70. An internally studentized residual exceeding 2 in absolute value is noteworthy, so this observation has a large residual.
    r₇ ≈ 2.70
  3. 3

    Step 3 — Externally Studentized Residual

    Compute t₇ = e₇ / (σ̂₍₋₇₎ × √(1 − h₇₇)) = 4.2 / (1.8 × 0.7416) = 4.2 / 1.3349 ≈ 3.15. Under normality, t₇ follows a t-distribution with n − p − 1 = 10 − 2 − 1 = 7 degrees of freedom. Comparing |t₇| = 3.15 against the Bonferroni-corrected threshold t₀.₀₂₅/₁₀,₇ ≈ 3.50, the observation narrowly avoids formal outlier rejection, but is clearly suspicious.
    t₇ ≈ 3.15 (borderline outlier)
  4. 4

    Step 4 — Cook's Distance

    Using the formula D₇ = r₇² × h₇₇ / (p × (1 − h₇₇)) = (2.70)² × 0.45 / (2 × 0.55) = 7.29 × 0.45 / 1.10 = 3.2805 / 1.10 ≈ 2.98. This vastly exceeds both the 4/n = 0.40 threshold and the conventional D > 1 benchmark, indicating that observation 7 is highly influential on the entire set of regression coefficients.
    D₇ ≈ 2.98 → Highly influential
  5. 5

    Step 5 — DFFITS

    DFFITS₇ = t₇ × √(h₇₇ / (1 − h₇₇)) = 3.15 × √(0.45 / 0.55) = 3.15 × √0.8182 = 3.15 × 0.9045 ≈ 2.85. The threshold is 2√(p/n) = 2√(2/10) = 2 × 0.4472 ≈ 0.89. Since |DFFITS₇| = 2.85 far exceeds 0.89, this confirms that observation 7 has a dramatic effect on its own fitted value.
    DFFITS₇ ≈ 2.85 ≫ 0.89 threshold
✦

INTERPRETING THE RESULTS

Observation 7 is both high-leverage and has a large residual, producing extreme values of Cook's distance and DFFITS. The appropriate response is not automatic deletion; rather, the analyst should investigate whether this observation reflects a data entry error, belongs to a different population, or represents a genuine but extreme case. If legitimate, robust regression methods or sensitivity analyses are warranted.

SECTION 7

Strengths & Limitations of Diagnostic Measures

No single diagnostic statistic is sufficient for comprehensive model checking. Each measure captures a particular aspect of an observation's role in the regression, and understanding the strengths and limitations of the main diagnostics guides effective practice.

Diagnostic MeasureStrengthsLimitations
Leverage (h_ii)Computed from X alone, no model fitting required; identifies design space extremesDoes not account for the response; a high-leverage point on the regression line is benign
Cook's DistanceCombines leverage and residual size into one scalar; measures global coefficient changeSummarizes influence on all coefficients jointly, which may mask influence on a single coefficient; cutoffs are approximate
DFFITSUses externally studentized residuals; measures impact on the observation's own fitted valueFocused on the fitted value at the specific observation, not on any particular coefficient
DFBETASIdentifies which specific coefficient(s) are most affected by each observationProduces p values per observation, creating a large amount of output; harder to summarize
Externally Studentized ResidualsHas a known t-distribution under normality; enables formal outlier testingMasking and swamping effects: multiple outliers can distort each other's residuals

Comparison of key diagnostic measures: what each captures and where each falls short.

✦

BEST PRACTICE

Effective regression diagnostics require a battery of complementary tools rather than reliance on a single measure. Scalar statistics like Cook's distance should be examined alongside residual plots to detect global assumption violations. When influential points are identified, the first response should be investigation, not deletion: check for recording errors, consider whether the observation belongs to a different subpopulation, and conduct sensitivity analyses comparing models with and without the flagged observations.

SECTION 8

Extensions to GLMs and Beyond

The diagnostic framework developed for the normal linear model extends—with modifications—to generalized linear models (GLMs) and mixed-effects models. In GLMs, the hat matrix is replaced by its generalized analogue computed from the final iteration of the iteratively reweighted least squares (IRLS) algorithm, and residuals take specialized forms—Pearson residuals, deviance residuals, and Anscombe residuals—each correcting for the non-constant variance inherent in non-Gaussian responses. Cook's distance and DFFITS are redefined using the appropriate residual and leverage quantities, but the conceptual interpretation remains the same: influence = leverage × residual magnitude.

FeatureNormal Linear ModelGLMs
Hat matrixH = X(X⊤X)⁻¹X⊤, fixedH = W1/2W^{1/2}X(X⊤WX)⁻¹X⊤W1/2W^{1/2}, depends on fitted values via weight matrix W
Residual typesOrdinary, standardized, externally studentizedPearson, deviance, Anscombe, working residuals
Variance structureVar(y) = σ² (constant)Var(y) = φ × V(μ), variance function of the mean
Cook's distanceExact deletion formula availableOne-step approximation based on IRLS; exact computation requires re-fitting
Normality of residualsExpected under correct modelDeviance residuals are approximately normal for large samples; Pearson residuals can be skewed

Diagnostics in the normal linear model versus generalized linear models.

In modern high-dimensional settings where p may approach or exceed n, classical leverage becomes less informative because many observations have leverage close to 1. Research in this area has developed random-projection-based leverage approximations and regularization-aware influence diagnostics. Similarly, for mixed-effects models, influence can be assessed at both the observation level and the group level, using tools such as the likelihood displacement and conditional Cook's distance. As modeling methodologies continue to evolve, so too does the toolkit for diagnosing whether the conclusions drawn from a fitted model are robust or fragile.

SECTION 9

Practice Problems

Question 1: CONCEPTUAL

Explain why a high-leverage observation does not necessarily have a large residual. Under what conditions can a high-leverage point actually have a residual of exactly zero?
Show answer
Leverage depends solely on the predictor values (the position of xᵢ relative to the centroid of X), not on the response yᵢ. A high-leverage observation that lies exactly on the regression surface fitted to the remaining data will have a small or zero residual. In fact, in simple linear regression with a single extreme x-value, the OLS line is pulled toward that observation so strongly that it essentially passes through it, yielding a near-zero residual. This is precisely why leverage alone is insufficient for assessing influence—one must also examine the residual to determine whether the observation is genuinely distorting the fit.

Question 2: BASIC CALCULATION

A regression with n = 20 observations and p = 4 parameters yields h₅₅ = 0.35, e₅ = 3.0, and σ̂ = 1.5. Compute the internally studentized residual r₅ and determine whether observation 5 is flagged as high leverage.
Show answer
The leverage threshold is 2p/n = 2(4)/20 = 0.40. Since h₅₅ = 0.35 < 0.40, observation 5 is not flagged as high leverage by this rule. The internally studentized residual is r₅ = e₅ / (σ̂ × √(1 − h₅₅)) = 3.0 / (1.5 × √0.65) = 3.0 / (1.5 × 0.8062) = 3.0 / 1.2093 ≈ 2.48. This exceeds 2 in absolute value, suggesting that observation 5 has an unusually large residual even though its leverage is below the threshold. Further investigation with Cook's distance would be warranted.

Question 3: INTERMEDIATE

For a model with n = 25 and p = 3, observation 12 has h₁₂,₁₂ = 0.42, an internally studentized residual of r₁₂ = 1.8, and σ̂₍₋₁₂₎ = 2.0. Compute Cook's distance D₁₂ and DFFITS₁₂. Is this observation influential by standard criteria? Also compute the externally studentized residual if e₁₂ = 3.24 is given.
Show answer
Cook's distance: D₁₂ = r₁₂² × h₁₂,₁₂ / (p × (1 − h₁₂,₁₂)) = (1.8)² × 0.42 / (3 × 0.58) = 3.24 × 0.42 / 1.74 = 1.3608 / 1.74 ≈ 0.782. The 4/n threshold is 4/25 = 0.16, and the conventional benchmark is 1. Since D₁₂ = 0.782 exceeds 4/n but not 1, the observation is noteworthy but not extreme by the most conservative standard. For the externally studentized residual: t₁₂ = e₁₂ / (σ̂₍₋₁₂₎ × √(1 − h₁₂,₁₂)) = 3.24 / (2.0 × √0.58) = 3.24 / (2.0 × 0.7616) = 3.24 / 1.5232 ≈ 2.13. DFFITS₁₂ = t₁₂ × √(h₁₂,₁₂ / (1 − h₁₂,₁₂)) = 2.13 × √(0.42/0.58) = 2.13 × √0.7241 = 2.13 × 0.8512 ≈ 1.81. The DFFITS threshold is 2√(p/n) = 2√(3/25) = 2 × 0.3464 ≈ 0.69. Since 1.81 greatly exceeds 0.69, this observation substantially influences its own fitted value.

Question 4: APPLIED

A researcher fits a multiple regression predicting house prices from square footage, number of bedrooms, and neighborhood income (n = 200, p = 4). The residuals-versus-fitted-values plot shows a clear funnel shape (variance increasing with fitted values). One observation—a mansion with 8,000 square feet in a wealthy neighborhood—has h = 0.15, a studentized residual of 0.3, but the sale price of $2.1M is actually well predicted. Should this observation be deleted? What does the funnel pattern suggest, and how would you address it?
Show answer
The mansion should not be deleted. Although h = 0.15 exceeds 2p/n = 2(4)/200 = 0.04, flagging it as a high-leverage point, its studentized residual of 0.3 is small, meaning it lies close to the fitted regression surface. Its Cook's distance will be small since influence requires both high leverage and a large residual. The funnel pattern in the residual plot is a separate issue: it indicates heteroscedasticity, meaning Var(ε) increases with the level of house prices. This does not invalidate OLS point estimates but renders standard errors and confidence intervals unreliable. The appropriate remedy is to transform the response (e.g., log(price)), use weighted least squares with variance proportional to ŷ², or employ heteroscedasticity-consistent (HC) standard errors (e.g., HC3). Deleting the mansion would not fix the systematic variance pattern.

Question 5: CRITICAL THINKING

Consider the phenomenon of 'masking': when two or more outliers are present, their joint effect can cause each individual observation's diagnostic measures to appear benign. Explain mechanistically why this occurs in terms of the hat matrix and residual computation, and propose a diagnostic strategy to detect masked outliers.
Show answer
Masking occurs because the OLS fit, including the suspected outliers, is pulled toward the cluster of outlying observations. When multiple outliers share similar predictor configurations, they can collectively shift the regression surface so that their individual residuals shrink. Simultaneously, the hat matrix incorporates all observations, and the inflated σ̂ (from the contaminated fit) further reduces studentized residuals. The leave-one-out approach underlying Cook's distance and DFFITS deletes only a single observation at a time, so with k outliers, removing one still leaves k − 1 to anchor the surface near the outlying region. To detect masked outliers, one can use forward search algorithms (Atkinson and Riani) that begin with a clean subset and add observations one at a time, monitoring diagnostic statistics as the subset grows. Alternatively, robust regression estimators such as least trimmed squares (LTS) or MM-estimation provide breakdown points of up to 50%, yielding residuals computed from a fit that is resistant to clusters of outliers. Plotting residuals from a robust fit against those from OLS often reveals the masked observations as points with dramatically different residuals between the two methods.

SUMMARY

Summary

Summary

Regression diagnostics provide the critical toolset for moving beyond aggregate model summaries to observation-level scrutiny. Leverage, quantified by the hat matrix diagonal hii, identifies observations occupying extreme positions in predictor space. Influence measures such as Cook's distance and DFFITS combine leverage with residual magnitude to assess the actual distortion each observation causes. The key insight is that influence = leverage × discrepancy: an observation must be both extreme in X-space and poorly fit to substantially alter the model.

Residual structure analysis through the diagnostic quartet—residuals versus fitted values, scale-location plots, Q–Q plots, and residuals versus leverage—reveals violations of linearity, homoscedasticity, and normality. These tools extend naturally to GLMs through generalized residuals and weight-adjusted hat matrices. In all contexts, the diagnostic workflow should be investigative rather than mechanical: flagged observations warrant substantive inquiry, not automatic deletion.

Varsity Tutors • Statistics Graduate Level • Regression Diagnostics — Diagnostics: leverage, influence, residual structure