Leverage, influence, and residual diagnostics
Distinguish unusual predictor geometry, unusual responses, and sensitivity to deleting an observation.
On this page
The question for today
What you’ll understand
- Calculate leverage from the hat matrix.
- Explain how residual size and leverage combine in Cook's distance.
- Use diagnostic patterns without treating them as proofs of model assumptions.
A point can be unusual in its predictors, surprising in its response, or influential on the fitted model. Those are three different properties. A remote predictor location may follow the fitted trend closely; a large residual near the center may barely change the slope. Diagnostics help locate these situations and investigate model failures. Their role is to expose questions about data collection, mean structure, dependence, and sensitivity, rather than automatically label observations as disposable or certify that a model is correct.
Leverage is a property of the design
In a full-rank fixed design, the diagonal entry of the hat matrix measures how strongly response contributes to its own fitted value. It depends on the predictor rows, not on the responses. Because H is an orthogonal projection, its diagonal entries lie between zero and one and sum to its rank p. Thus p/n is the average leverage, although a multiple of that average is only a screening guideline and not a universal statistical threshold.
For an intercept and a single nonconstant predictor, leverage is one over n plus the squared distance from the predictor mean divided by the total centered predictor sum of squares. Remote predictor values therefore tend to have high leverage. Under spherical errors the residual variance at observation i is . A high-leverage point can pull the fit toward itself and thereby hide a large response discrepancy behind a relatively small raw residual. Standardizing residuals accounts for that geometry.
Influence asks what changes when a point is removed
An influential observation materially changes a fitted quantity when it is removed or perturbed. Cook's distance summarizes the squared change in all fitted values after deleting one observation, scaled by p times the full-model residual variance estimate. In a full-rank least-squares fit with positive residual variance and , it can be calculated from the full residual and leverage. Its formula makes the interaction explicit: a large residual and a leverage close to one can produce a substantial change.
Influence is a sensitivity description, not proof that the observation is wrong. A rare but valid operating condition may be exactly where predictions matter most. Check provenance and units, compare the fit with and without the point, and report the consequences for the target question. Automatic deletion based on a diagnostic threshold can remove scientifically meaningful extremes and make reported uncertainty conditional on an unacknowledged selection procedure. If deleting a point destroys rank, ordinary deletion formulas need special treatment rather than division by zero.
Patterns suggest investigations rather than verdicts
A curved residual pattern can suggest missing mean structure; a changing spread can suggest heteroskedasticity; a run-order pattern can suggest dependence or drift. A normal-quantile plot examines compatibility with a Gaussian shape but cannot establish independence or the correctness of the mean. Ordinary fitted residuals are already correlated through I−H, even when the underlying errors are independent. Interpreting them as a fresh iid sample ignores the fitting operation that created them.
A useful diagnostic workflow links each plot to an assumption and an action. Revisit the mean specification when curvature is plausible, inspect collection order when clusters appear, and evaluate robust or covariance-aware uncertainty when variance patterns persist. A visually featureless plot can reflect low power or limited predictor coverage, so it does not verify the model. Diagnostics are strongest when combined with knowledge of how observations were collected and with sensitivity analyses for the actual predictions or contrasts being used.
Work it through
A modest residual can still matter
Fit an intercept and slope to and . Calculate the last observation's leverage and Cook's distance.
The predictor mean is and the centered predictor sum of squares is . The fitted line is , yielding fitted values and residuals .
SSE is . With p=2 and n=4, . The last leverage is .
Insert into the formula: . Deleting the last point leaves three zero responses and a zero fitted line, directly confirming squared fitted change and .
The last response is influential for this fit even though its raw residual is only 0.3. Its leverage and the refit comparison explain the sensitivity; neither establishes that the observation should be discarded.
The living notebook
Explore the model
Interactive lab · matrix
Inspect directional sensitivity
Pause and Reset; set a=1 and b=0 to obtain the identity matrix. Predict condition number 1. Start a fresh Reset, set a=0.25 and b=2, and inspect the singular-value imbalance. This illustrates why some design directions can be sensitive. The triangular matrix is not a regression design with deletable observations, so its readouts are not leverage, residuals, or Cook's distance.
- Area scale · det A
- 1.4
- Singular values · σmax, σmin
- 1.597, 0.876
- Condition number · κ₂(A)
- 1.823
The selected matrix is A = [[a,b],[0,1]]. Playback interpolates geometry between the identity and A; readouts always describe A. Its determinant is a and its singular values come from AᵀA. Positive a makes every supported matrix invertible. This two-dimensional family is not a general eigensolver or a learned network. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forSensitivity requires identifying the quantity and perturbation being compared; a geometry picture alone does not diagnose data quality.
Pause & reason
Check your understanding
Your turn
Try it yourself
In a full-rank fit with p=2, an observation has , , and . Assume deletion retains rank. Calculate Cook's distance and explain why a small value does not certify the mean model.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Keep the squared factor (1−hᵢᵢ)² in the denominator, and distinguish sensitivity to one deletion from all possible model failures.
Compare with the solution
The value is . This says the fitted values are relatively insensitive to deleting this observation at the stated scale. It does not rule out shared curvature, dependence, selection bias, or failures that affect many observations together.
Keep the idea
Take it with you
- Leverage uses predictor geometry; a residual uses both design and response.
- Cook's distance combines residual size and leverage to measure deletion sensitivity.
- Diagnostic checks can contradict assumptions but cannot prove their truth.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.