What least-squares residuals must and need not do

In ordinary least squares (OLS), a residual is an observed response minus its fitted value. The governing sample identity is that the residual vector is orthogonal to every included column of the design matrix. Its variance and covariance require further assumptions about the errors that generated the responses.

Exact fitted-sample identities

Write the residual vector as e=y−Xβ^e=y-X\hat\beta. Minimizing the squared residual length gives the normal equations XTe=0X^{\mathsf T}e=0, provided β^\hat\beta is an OLS solution. Each included predictor column therefore has zero inner product with the residual vector.


If the model includes an intercept, one column is all ones, so ∑iei=0\sum_i e_i=0 and the sample mean residual is zero. Without that column, the unweighted residual sum need not be zero, even though orthogonality to the columns actually fitted still holds. Neither identity establishes that the scientific model is adequate.

Conditional spread after fitting

For full-column-rank XX, the hat matrix is H=X(XTX)−1XTH=X(X^{\mathsf T}X)^{-1}X^{\mathsf T}. Conditional on fixed XX, if errors have common variance σ2\sigma^2 and zero pairwise covariances, the residual covariance matrix is σ2(I−H)\sigma^2(I-H). The diagonal leverage hiih_{ii} gives Var⁡(ei∣X)=σ2(1−hii)\operatorname{Var}(e_i\mid X)=\sigma^2(1-h_{ii}).


For distinct observations, conditional covariance is Cov⁡(ei,ej∣X)=−σ2hij\operatorname{Cov}(e_i,e_j\mid X)=-\sigma^2h_{ij}. Its sign depends on the off-diagonal hat-matrix entry; it need not be negative. These formulas describe variation across repeated error realizations at fixed XX, not the square or product of particular observed residuals.

Worked example

Suppose a fixed-design OLS model satisfies those error assumptions, with error variance 3636 outcome-units squared and one observation's leverage equal to 1/41/4. Its conditional residual variance is 36(1−1/4)=2736(1-1/4)=27 outcome-units squared. The fitted projection accounts for the remaining variance share at that observation; the calculation does not predict a particular observed residual.



An ordinary least-squares model with an intercept is fit to three observations and produces residuals 3, −1, and −2. Which statement explains their zero sum?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

Under a full-rank OLS model with fixed design X and homoscedastic uncorrelated errors, σ² = 25 units². Observation i has leverage hᵢᵢ = 0.40. What is Var(eᵢ | X)?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

Under homoscedastic uncorrelated errors, σ²=16 units² and the OLS hat matrix has h₁₂=0.10. What is Cov(e₁,e₂ | X)?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors