Tutorials › Generalized Linear Models › Separating Design Leverage From Response Discrepancy

Leverage and Influence · Tutorial 759 of 981

Separating Design Leverage From Response Discrepancy

Learn to interpret leverage and residual size as distinct diagnostic signals, and see why neither by itself establishes that a case substantially changes a GLM fit.

Advanced 12 min read

What You'll Learn

  • Define local GLM leverage using the current weighted design.
  • Distinguish design unusualness from response disagreement.
  • Prove basic bounds and the total-leverage identity.
  • Relate perturbations in the working response to fitted working responses.
  • Work through examples where leverage or residual size alone gives an incomplete diagnostic.
  • Avoid confusing a large diagnostic value with a large change in the fitted model.

Two Different Questions in a Diagnostic

When an observation looks unusual, two questions should be kept separate. Is its predictor configuration unusual relative to the design? And does its response disagree with the model’s fitted pattern? Leverage addresses the first question; residuals address the second. They describe different features of a case, so neither alone establishes that removing or changing it would substantially alter a fitted model.

In a generalized linear model (GLM), this distinction is usually examined through the weighted least-squares problem underlying an iteratively reweighted least-squares (IRLS) fit. At a given iteration, the design matrix and working weights define a local weighted regression. Leverage is a property of that weighted design; a working residual measures disagreement on the working-response scale. Response, Pearson, and deviance residuals provide other discrepancy summaries, but they are not interchangeable with the working residual.

Definition: Suppose a local weighted least-squares problem has design matrix \(X\) with \(n\) rows and \(p\) linearly independent columns, and diagonal weight matrix \(W=\operatorname{diag}(w_1,\ldots,w_n)\) with every \(w_i>0\). Write \(\mathbf{x}_i\) for the column vector whose transpose is row \(i\) of \(X\). The local leverage of observation \(i\) is \[ h_i=w_i\mathbf{x}_i^\mathsf{T}(X^\mathsf{T}WX)^{-1}\mathbf{x}_i. \] It measures the observation’s position in the current weighted design. A working residual is \(r_i=z_i-\hat z_i\), where \(z_i\) is the working response and \(\hat z_i\) its fitted value in this local problem. Its size measures response disagreement on that scale.

The word local matters. In a GLM, the weights depend on the fitted model and can change during fitting; leverage is therefore tied to the current weighted design, not just to the raw predictor values. The formula provides a diagnostic summary at that fit or iteration, not a universal measure of how influential the observation must be.

What Leverage Measures

To see the design component, transform the weighted problem using \(W^{1/2}\). Its whitened design matrix is \(W^{1/2}X\), and the projection matrix onto the columns of that design is \[ H=W^{1/2}X(X^\mathsf{T}WX)^{-1}X^\mathsf{T}W^{1/2}. \] The diagonal entry \(H_{ii}\) equals \(h_i\). This representation gives useful facts about leverage without making it a measure of response disagreement.

Result: Under the full-rank and positive-weight conditions in the definition, \(0\leq h_i\leq 1\) for every observation, and \(\sum_{i=1}^n h_i=p\).

Proof. The matrix \(H\) is symmetric. If \(A=W^{1/2}X\), then \(H=A(A^\mathsf{T}A)^{-1}A^\mathsf{T}\), so \[ H^2=A(A^\mathsf{T}A)^{-1}(A^\mathsf{T}A)(A^\mathsf{T}A)^{-1}A^\mathsf{T}=H. \] Thus \(H\) is a symmetric projection matrix. For the \(i\)th coordinate vector \(\mathbf{e}_i\), \[ h_i=\mathbf{e}_i^\mathsf{T}H\mathbf{e}_i =\mathbf{e}_i^\mathsf{T}H^\mathsf{T}H\mathbf{e}_i =\|H\mathbf{e}_i\|^2\geq 0. \] An orthogonal projection cannot increase length, so \(\|H\mathbf{e}_i\|^2\leq\|\mathbf{e}_i\|^2=1\). Finally, the trace of a projection onto a \(p\)-dimensional column space is \(p\), and trace is the sum of diagonal entries. Hence \(\sum_i h_i=\operatorname{tr}(H)=p\). \(\square\)

The sum identity is a useful check on calculated leverages. It also gives a reference point: their average is \(p/n\). But an observation with leverage above that average is not automatically problematic. Leverage says that the design gives the case a particular geometric position; it says nothing by itself about whether its response agrees with the fitted pattern.

Working-Response Perturbations and Leverage

Leverage also describes how a change in one working response is reflected in the fitted working responses, with the weights and design held fixed. It is important to distinguish the fitted working response on its original scale from the fitted whitened response.

Result: Let \(\hat{\mathbf{z}}\) be the fitted working-response vector in weighted least squares. Define \[ P=X(X^\mathsf{T}WX)^{-1}X^\mathsf{T}W. \] Then \(\hat{\mathbf{z}}=P\mathbf{z}\). If only \(z_i\) changes by \(\delta\), the fitted working response at observation \(j\) changes by \(P_{ji}\delta\). In particular, its fitted value at \(i\) changes by \(h_i\delta\), since \(P_{ii}=h_i\). The fitted whitened response instead has projection matrix \(H\).

Proof. Minimizing \((\mathbf{z}-X\boldsymbol{\beta})^\mathsf{T}W(\mathbf{z}-X\boldsymbol{\beta})\) gives the normal equations \(X^\mathsf{T}WX\hat{\boldsymbol{\beta}}=X^\mathsf{T}W\mathbf{z}\). Since \(X^\mathsf{T}WX\) is invertible, \(\hat{\boldsymbol{\beta}}=(X^\mathsf{T}WX)^{-1}X^\mathsf{T}W\mathbf{z}\). Multiplying by \(X\) gives \(\hat{\mathbf{z}}=P\mathbf{z}\). Changing only \(z_i\) adds \(\delta\mathbf{e}_i\) to \(\mathbf{z}\), so the fitted vector changes by \(P\delta\mathbf{e}_i\), whose \(j\)th component is \(P_{ji}\delta\). On the diagonal, \[ P_{ii}=\mathbf{x}_i^\mathsf{T}(X^\mathsf{T}WX)^{-1}\mathbf{x}_i\,w_i=h_i. \] For comparison, whitening gives \(W^{1/2}\hat{\mathbf{z}}=H W^{1/2}\mathbf{z}\), so \(H\) acts on the whitened working response, not directly on \(\mathbf{z}\). \(\square\)

This result describes a fixed local weighted least-squares problem. It does not say that a case with high leverage must have a large residual, or that a response perturbation of a given size will have the same effect on every coefficient or fitted response. It is one reason to keep leverage and discrepancy conceptually distinct.

Worked Examples

Worked Example: High Leverage With No Working-Response Disagreement

Consider an unweighted regression with an intercept and predictor values \(-1,0,1,10\). Suppose the working responses lie exactly on \(z=2+3x\), so they are \( -1,2,5,32\). Find the leverage of the case with \(x=10\), and compare it with its residual.

For simple linear regression with an intercept and unit weights, the leverage at \(x_i\) is \(h_i=1/n+(x_i-\bar x)^2/S_{xx}\), where \(S_{xx}=\sum_j(x_j-\bar x)^2\). Here \(n=4\), \(\bar x=(-1+0+1+10)/4=2.5\), and \[ S_{xx}=(-3.5)^2+(-2.5)^2+(-1.5)^2+(7.5)^2 =12.25+6.25+2.25+56.25=77. \] Thus the leverage at \(x=10\) is \[ h_4=\frac14+\frac{(10-2.5)^2}{77} =\frac14+\frac{56.25}{77}\approx0.9805. \] The fitted line is exactly \(z=2+3x\), so the fitted value at \(x=10\) is \(32\), and its working residual is \(32-32=0\). The case is extreme in the design, but it has no response disagreement in this example. High leverage alone does not imply a large residual or a large fit change in this exact-fit configuration.

Worked Example: Large Residual With Modest Leverage

Fit an intercept-only, unweighted model to working responses \(0,100,0\). Find the fitted value, residuals, and leverages.

The fitted value is the sample mean: \[ \hat z=\frac{0+100+0}{3}=\frac{100}{3}\approx33.333. \] The residuals are therefore \(-100/3\), \(200/3\), and \(-100/3\), approximately \(-33.333\), \(66.667\), and \(-33.333\). For an intercept-only model with three equally weighted observations, each leverage is \(1/3\). In particular, the middle case has a residual of about \(66.667\) but leverage only \(0.333\).

The large residual identifies substantial disagreement with the fitted mean; it does not, by itself, quantify the case’s effect on all model parameters or predictions. Leverage supplies different information, and the two values should not be substituted for one another.

Worked Example: A Large Raw Residual With Tiny Weighted Leverage

Consider an intercept-only weighted least-squares problem with four working responses \(0,0,0,100\) and weights \(1,1,1,10^{-8}\), respectively. Calculate the fitted weighted mean, the fourth case’s residual and leverage, and the fitted mean after omitting that case.

The full-data fitted mean is \[ \hat z=\frac{1(0)+1(0)+1(0)+10^{-8}(100)}{1+1+1+10^{-8}} =\frac{10^{-6}}{3.00000001}\approx3.3333\times10^{-7}. \] The fourth residual is \(100-\hat z\approx99.9999997\), a very large raw working residual. In an intercept-only weighted model, leverage is weight divided by total weight, so \[ h_4=\frac{10^{-8}}{3.00000001}\approx3.3333\times10^{-9}. \] After omitting the fourth case, the fitted mean is \(0\). Thus omitting a case with a raw residual near \(100\) changes the fitted mean by only about \(3.3333\times10^{-7}\). Its tiny weight gives it very little leverage in this local problem. This calculation illustrates why residual size alone cannot establish a substantial fit change; the scale and weight relevant to the fitted problem matter too.

How to Read the Pair

A practical diagnostic interpretation starts by asking what each quantity measures and on which scale it is computed. High leverage indicates that the observation’s predictor configuration is unusual relative to the current weighted design. A large residual indicates disagreement, but the meaning of “large” depends on the residual definition: a raw response residual, Pearson residual, deviance residual, and working residual use different scales and constructions. Use a residual appropriate to the diagnostic question, and do not treat their numerical magnitudes as interchangeable.

The combination is informative but not a mechanical verdict. High leverage together with a substantial residual is a reason to inspect the observation and the model carefully. High leverage with little discrepancy may have little immediate evidence of tension with the fitted pattern. A large residual with modest leverage signals a response mismatch without, on its own, establishing that the overall fit changes greatly. The detailed relation between these quantities and case-deletion changes requires additional analysis; neither diagnostic summary is itself a case-deletion calculation.

1
Check the design.
Ask whether the predictor configuration is unusual in the current weighted design, using leverage as a summary rather than as a response diagnostic.
2
Check the discrepancy.
Inspect an appropriate residual and its scale; a large value indicates disagreement, not automatically a large change in the fitted model.
3
Interpret both in context.
Consider the model, weights, and the case’s role in the design before drawing conclusions about potential influence.

Common Mistake

Wrong reasoning: “This case has high leverage, so it must strongly affect the fit,” or, conversely, “Its residual is large, so it must be influential.” Both claims jump from one diagnostic dimension to a conclusion about fit change. High leverage describes predictor geometry, while residual size describes response disagreement. As the worked examples show, either can occur without the other, and a large raw residual can coexist with a tiny weighted contribution. Treat them as complementary clues, not as guarantees.

Key takeaway: Leverage is about where an observation sits in the current weighted predictor design; residual size is about how its response disagrees with the fitted pattern. A fit-change conclusion requires more than either summary alone.

Check Your Understanding

Use the distinction between design leverage and response discrepancy to answer these questions.

  1. In a local weighted least-squares problem, what feature of an observation does leverage summarize?
  2. Why can an observation have high leverage and a zero working residual?
  3. For an intercept-only model with four positive weights, what is the sum of the four leverages under the stated full-rank conditions?
  4. Why should a large raw residual in a low-weight observation not automatically be interpreted as a large change in the fitted model?
  5. Which matrix maps the original-scale working response to its fitted values, and which projection matrix acts on the whitened working response?
Clinical Biostats