Why Weighted Projection Geometry Matters
Weighted least squares chooses coefficients so that the fitted response is close to the observed response, while giving observations different weights in the squared-error criterion. The resulting geometry is not mysterious: after scaling each observation by the square root of its weight, the problem becomes ordinary least squares in transformed coordinates. In those coordinates, the fitted vector is an orthogonal projection.
This viewpoint gives a precise meaning to the weighted hat matrix. It also clarifies two related ideas that are easy to confuse: the matrix that projects the transformed response, and the matrix that maps the original response to its fitted values. Their diagonal entries agree, so they give the same observation-by-observation leverage.
From Weighted Least Squares to a Projection
The objective can be rewritten as an ordinary sum of squares by defining the transformed response \(y^*=W^{1/2}y\) and transformed design matrix \(X^*=W^{1/2}X\). Indeed, \((y-X\beta)^\mathsf{T}W(y-X\beta)=\|y^*-X^*\beta\|^2\). Because the columns of \(X^*\) are linearly independent, its least-squares coefficient estimate is \(\hat{\beta}=(X^\mathsf{T}WX)^{-1}X^\mathsf{T}Wy\). Multiplying the fitted transformed response by the corresponding matrices gives the projection formula below.
Thus \(H\) acts on \(y^*\), not directly on \(y\). The fitted response on the original scale is \(\hat{y}=X\hat{\beta}\). Its mapping from the original response is given by a different matrix, often denoted \(S\):
The matrix \(S\) need not be symmetric in the ordinary Euclidean geometry. It is the matrix \(H\) that is symmetric and represents an ordinary orthogonal projection. Since \(S\) and \(H\) have the same diagonal entries, either matrix gives the same leverage for each observation.
Worked Example: A Weighted Intercept-Only Fit
Take \(X=(1,1)^\mathsf{T}\), \(W=\operatorname{diag}(1,4)\), and \(y=(2,5)^\mathsf{T}\). The model has an intercept only, so both observations share one fitted value.
First, \(X^\mathsf{T}WX=1+4=5\), and \(X^\mathsf{T}Wy=2+4(5)=22\). Therefore \(\hat{\beta}=22/5=4.4\), giving \(\hat{y}=(4.4,4.4)^\mathsf{T}\).
For the transformed coordinates, \(W^{1/2}X=(1,2)^\mathsf{T}\). Hence \(H=(1/5)(1,2)^\mathsf{T}(1,2)\), or explicitly
The transformed fitted vector is \(W^{1/2}\hat{y}=(4.4,8.8)^\mathsf{T}\), as required. The diagonal entries are \(h_{11}=0.2\) and \(h_{22}=0.8\): the observation with weight 4 has more leverage in this intercept-only fit.
Projection Properties and Their Proof
The geometric claims follow directly from writing the weighted hat matrix in terms of the transformed design \(X^*=W^{1/2}X\). The columns of \(X^*\) span the model’s fitted subspace in transformed coordinates.
Set \(X^*=W^{1/2}X\). Then \(X^{*\mathsf{T}}X^*=X^\mathsf{T}WX\), so \(H=X^*(X^{*\mathsf{T}}X^*)^{-1}X^{*\mathsf{T}}\).
The matrix \(X^{*\mathsf{T}}X^*\) is symmetric positive definite, so its inverse is symmetric. Transposing the expression for \(H\) therefore gives \(H^\mathsf{T}=H\).
Multiplying \(H\) by itself and cancelling the middle factor gives \(H^2=X^*(X^{*\mathsf{T}}X^*)^{-1}(X^{*\mathsf{T}}X^*)(X^{*\mathsf{T}}X^*)^{-1}X^{*\mathsf{T}}=H\).
Every column of \(H\) is in the column space of \(X^*\). Also, \(HX^*=X^*\), so \(H\) leaves every vector in that column space unchanged. These facts identify \(H\) as the orthogonal projection onto that space.
The weighted least-squares normal equations are \(X^\mathsf{T}W(y-X\hat{\beta})=0\). Since \(r=y-X\hat{\beta}\), this is \(X^\mathsf{T}Wr=0\). Equivalently, \(W^{1/2}r\) is orthogonal to every column of \(W^{1/2}X\). Thus the residual is orthogonal to the fitted subspace in transformed coordinates. \(\square\)
The normal equations also show why \(\hat{y}\) is the weighted projection of \(y\): among fitted vectors \(X\beta\), the chosen one leaves a residual orthogonal to the model space under the weighted inner product \(\langle u,v\rangle_W=u^\mathsf{T}Wv\). The theorem expresses the same fact as an ordinary orthogonal projection after transformation.
Worked Example: Weighted Line and Leverage
Fit a line with an intercept to three observations at \(x=0,1,2\), using weights \(1,2,1\) and responses \(1,2,4\). The design rows are \((1,0),(1,1),(1,2)\). Direct calculation gives
Multiplying the last two matrices gives \(\hat{\beta}=(3/4,3/2)^\mathsf{T}\). The fitted values are therefore \((3/4,9/4,15/4)^\mathsf{T}\), and the residuals are \((1/4,-1/4,1/4)^\mathsf{T}\). Check weighted orthogonality: the intercept component is \(1(1/4)+2(-1/4)+1(1/4)=0\), and the slope component is \(0+2(1)(-1/4)+2(1/4)=0\).
For a design row \(x_i^\mathsf{T}\), the \(i\)th diagonal entry of \(H\) is \(h_{ii}=w_i x_i^\mathsf{T}(X^\mathsf{T}WX)^{-1}x_i\). At \(x=0\), this is \(1(3/4)=3/4\). At \(x=1\), it is \(2[(1,1)(1/4,0)^\mathsf{T}]=1/2\). At \(x=2\), it is \(1[(1,2)(-1/4,1/2)^\mathsf{T}]=3/4\). The leverages sum to \(3/4+1/2+3/4=2\), the number of fitted coefficients.
Leverage: Bounds, Total, and Interpretation
The diagonal entries \(h_{ii}\) are called leverages. Since \(H\) is an orthogonal projection, each \(h_{ii}\) is the squared length of the projection of the \(i\)th coordinate unit vector onto the fitted subspace. This provides a direct proof of their bounds. It also shows that leverage depends on the design and weights, not on the observed response values.
To prove the bounds, let \(e_i\) be the \(i\)th coordinate unit vector. Symmetry and idempotence give \(h_{ii}=e_i^\mathsf{T}He_i=(He_i)^\mathsf{T}(He_i)=\|He_i\|^2\geq0\). An orthogonal projection cannot increase length, so \(\|He_i\|\leq\|e_i\|=1\), giving \(h_{ii}\leq1\). For the total, the trace of a projection equals its rank: its eigenvalues are 1 on its \(p\)-dimensional range and 0 on the orthogonal complement. Thus \(\sum_i h_{ii}=\operatorname{tr}(H)=p\). Finally, taking the \(i\)th diagonal element of the matrix formula for \(H\) gives the stated row-wise expression.
A higher leverage means that the observation’s response has more opportunity to affect the fitted value at that location, conditional on the design and weights. It does not by itself establish that the observation is an outlier or that it has a large residual. Those are separate properties of the observed response relative to the fitted model.
Worked Example: Leverage in a Weighted Intercept-Only Model
Suppose three observations have weights \(1,1,2\), and the model contains only an intercept. Then \(X=(1,1,1)^\mathsf{T}\), \(X^\mathsf{T}WX=4\), and the weighted mean is \(\hat{\beta}=(y_1+y_2+2y_3)/4\).
The transformed design is \((1,1,\sqrt{2})^\mathsf{T}\). Therefore the diagonal leverages are \(1/4,1/4,2/4\), or \(0.25,0.25,0.50\). They are nonnegative, each is at most 1, and they sum to 1, the rank of the intercept-only design.
For example, if \(y=(2,4,10)^\mathsf{T}\), then \(\hat{\beta}=(2+4+2(10))/4=6.5\). The fitted vector is \((6.5,6.5,6.5)^\mathsf{T}\). The largest leverage belongs to the observation with weight 2, but its observed response of 10 does not enter the leverage calculation; leverage is determined by \(X\) and \(W\).
Common Mistake: Applying the Wrong Hat Matrix
A common error is to call \(S=X(X^\mathsf{T}WX)^{-1}X^\mathsf{T}W\) the symmetric weighted projection matrix. It maps \(y\) to the original-scale fit, but in general \(S^\mathsf{T}\neq S\). The symmetric projection matrix is \(H\), which maps \(W^{1/2}y\) to \(W^{1/2}\hat{y}\). The correction is not to discard \(S\): use \(S\) when mapping the original response to original-scale fitted values, and use \(H\) when invoking ordinary Euclidean projection properties. Their diagonal entries coincide, which is why either gives the same leverage values.
A second tempting shortcut is to interpret a large diagonal entry as proof of an unusual response. The calculation \(h_{ii}=w_i x_i^\mathsf{T}(X^\mathsf{T}WX)^{-1}x_i\) shows why that conclusion is unsupported: no \(y_i\) appears. Leverage describes the observation’s position in the weighted design, not whether its response is surprising.
Check Your Understanding
Answer each question using the weighted projection definitions and results above.
- Why must \(X\) have full column rank and all weights be positive for the displayed formula for \(H\) to apply?
- Which matrix maps the original response \(y\) to the original-scale fitted response \(\hat{y}\), and which matrix projects the transformed response?
- For a weighted least-squares residual \(r\), what equation expresses its orthogonality to the design?
- Why do the leverages sum to \(p\), and what does this imply for their average when \(n\) observations are fitted?
- Can a high-leverage observation be identified as an outlier from its leverage alone? Explain which quantities determine leverage.