Regression
Diagnostics
Master leverage, influence, and residual structure to validate your linear models and detect hidden problems in your data.
Why Run Diagnostics?
A regression equation that looks great on paper can be driven by a single observation or violate key assumptions without you realizing it. Diagnostics are the tools that let you look under the hood of your fitted model.
Understanding Leverage
Leverage measures how unusual an observation's predictor values are. In simple linear regression, the leverage of observation \( i \) is:
Key properties: \( 1/n \leq h_{ii} \leq 1 \). The mean leverage is always \( p/n \) where \( p \) is the number of parameters. An observation with \( h_{ii} > 2p/n \) is conventionally flagged as high leverage.
Leverage in the Predictor Space
Measuring Influence: Cook's Distance
Influence combines leverage and residual size. Cook's distance quantifies how much all fitted values change when observation \( i \) is deleted:
A common rule of thumb: observations with \( D_i > 1 \) deserve close inspection. Alternatively, compare \( D_i \) against the 50th percentile of \( F_{p,\, n-p} \).
Other Influence Measures: DFFITS & DFBETAS
Leverage vs. Influence: The Key Distinction
The Hat Matrix
All leverage values come from the hat matrix \( \mathbf{H} \). In ordinary least squares:
Types of Residuals
Reading Residual Plots
Step-by-Step Diagnostic Checklist
Example 1: Computing Leverage
A dataset has \( n = 5 \) observations with \( x \)-values: \( 1, 2, 3, 4, 10 \). We fit a simple linear regression (\( p = 2 \)). Compute the leverage for the 5th observation.
Example 2: Cook's Distance Calculation
Continuing from Example 1: suppose observation 5 has a raw residual \( e_5 = 3.2 \), \( \mathrm{MSE} = 2.5 \), \( h_{55} = 0.92 \), and \( p = 2 \).
Example 3: Interpreting a Residual Plot
Common Mistakes
Diagnostic Summary Table
| Measure | Formula / Source | Cutoff |
|---|---|---|
| Leverage \( h_{ii} \) | Diagonal of \( \mathbf{H} \) | \( > 2p/n \) |
| Cook's \( D_i \) | \( \dfrac{e_i^2}{p \cdot \mathrm{MSE}} \cdot \dfrac{h_{ii}}{(1-h_{ii})^2} \) | \( > 1 \) or \( > 4/n \) |
| DFFITS | \( \dfrac{\hat{y}_i - \hat{y}_{i(i)}}{s_{(i)}\sqrt{h_{ii}}} \) | \( > 2\sqrt{p/n} \) |
| DFBETAS | \( \dfrac{\hat{\beta}_j - \hat{\beta}_{j(i)}}{s_{(i)}\sqrt{(\mathbf{X}^\top\mathbf{X})^{-1}_{jj}}} \) | \( > 2/\sqrt{n} \) |
| Studentized \( t_i \) | \( \dfrac{e_i}{s_{(i)}\sqrt{1 - h_{ii}}} \) | \( |t_i| > 3 \) (approx.) |
Question 1 of 5
In a simple linear regression with \( n = 20 \) and \( p = 2 \), which cutoff is conventionally used to flag high-leverage observations?
Question 2 of 5
An observation has high leverage but its residual is nearly zero. What can you conclude about its influence?
Question 3 of 5
A residual plot of \( e_i \) vs. \( \hat{y}_i \) shows a clear funnel shape (spread increases with fitted values). This pattern most directly suggests a violation of which assumption?
Question 4 of 5
Why are studentized residuals preferred over raw residuals for detecting outliers?
Question 5 of 5
For a model with \( p = 4 \) parameters and \( n = 50 \) observations, what is the DFFITS cutoff for flagging influential observations?