Tutorials › Statistical Theory I - Probability and Distribution Theory › Gaussian Regression Residuals and Independence

Gaussian Conditioning and Linear Maps · Tutorial 733 of 994

Gaussian Regression Residuals and Independence

Learn to construct the Gaussian linear regression predictor, calculate its residual covariance, and prove residual independence even when the predictor covariance is singular.

Advanced 9 min read

What You'll Learn

  • Define the Gaussian linear predictor and residual from covariance blocks
  • Use the Moore–Penrose inverse when the predictor covariance is singular
  • Derive the residual covariance and verify it is positive semidefinite
  • Prove residual independence from the predictor block using characteristic functions
  • Interpret the conditional mean and conditional covariance through the residual
  • Recognize why collinear predictors can give nonunique coefficients but a unique predictor

Introduction

In Gaussian regression, a response is decomposed into a part explained linearly by a predictor block and a remaining residual. For jointly Gaussian variables, this decomposition has a strong property: the residual is not merely uncorrelated with the predictors; it is independent of them. That property makes the linear predictor especially useful for understanding conditional distributions.

The construction depends only on the means and covariance blocks of the joint Gaussian vector. It also works when the predictor covariance matrix is singular, as can happen when predictors are exact linear combinations of one another. We will derive the predictor and residual covariance, and prove independence directly for this construction.

Definition of the Gaussian Regression Residual

Let \(Y\in\mathbb{R}^q\) be a response vector and \(X\in\mathbb{R}^p\) a predictor vector, with \((Y,X)\) jointly Gaussian. Write their means and covariance blocks as

$$ E[Y]=\mu_Y,\qquad E[X]=\mu_X,\qquad \operatorname{Cov}\begin{pmatrix}Y\\X\end{pmatrix} = \begin{pmatrix} \Sigma_{YY}&\Sigma_{YX}\\ \Sigma_{XY}&\Sigma_{XX} \end{pmatrix}, \qquad \Sigma_{XY}=\Sigma_{YX}^{\mathsf T}. $$

The matrices \(\Sigma_{YY}\) and \(\Sigma_{XX}\) are symmetric and positive semidefinite. If \(\Sigma_{XX}\) is invertible, the regression coefficient matrix is \(\Sigma_{YX}\Sigma_{XX}^{-1}\). For a possibly singular \(\Sigma_{XX}\), use its Moore–Penrose inverse, denoted \(\Sigma_{XX}^{+}\).

Definition: The Gaussian linear predictor and its residual are
$$ \widehat Y_{\mathrm{lin}} =\mu_Y+\Sigma_{YX}\Sigma_{XX}^{+}(X-\mu_X), \qquad R=Y-\widehat Y_{\mathrm{lin}}. $$
The residual covariance is
$$ \Omega =\Sigma_{YY}-\Sigma_{YX}\Sigma_{XX}^{+}\Sigma_{XY}. $$

When \(q=1\), the response is scalar and \(\Sigma_{YX}\) is a row vector. The predictor is then an intercept plus a weighted sum of the centered predictors. The formula uses centered variables so that the predictor has mean \(\mu_Y\); the intercept in an uncentered expression is \(\mu_Y-\Sigma_{YX}\Sigma_{XX}^{+}\mu_X\).

Why the Formula Works, Including in the Singular Case

The singular case requires one compatibility fact: the cross-covariance with \(Y\) cannot point in a direction where \(X\) has zero variance. To see this, suppose \(v\in\mathbb{R}^p\) satisfies \(\Sigma_{XX}v=0\). Then

$$ \operatorname{Var}\bigl(v^{\mathsf T}(X-\mu_X)\bigr) =v^{\mathsf T}\Sigma_{XX}v=0. $$

A random variable with zero variance equals its mean almost surely, so \(v^{\mathsf T}(X-\mu_X)=0\) almost surely. It follows that \(\operatorname{Cov}(Y,v^{\mathsf T}X)=\Sigma_{YX}v=0\). Thus every vector in the null space of \(\Sigma_{XX}\) is also in the null space of \(\Sigma_{YX}\). Since \(\Sigma_{XX}\) is symmetric, its row space is the orthogonal complement of its null space. Consequently, the rows of \(\Sigma_{YX}\) lie in the row space of \(\Sigma_{XX}\), and

$$ \Sigma_{YX}\Sigma_{XX}^{+}\Sigma_{XX}=\Sigma_{YX}. $$
Theorem: For jointly Gaussian \((Y,X)\), the residual \(R=Y-\mu_Y-\Sigma_{YX}\Sigma_{XX}^{+}(X-\mu_X)\) has mean zero and covariance \(\Omega=\Sigma_{YY}-\Sigma_{YX}\Sigma_{XX}^{+}\Sigma_{XY}\). It is independent of \(X\). Therefore
$$ E[Y\mid X]=\mu_Y+\Sigma_{YX}\Sigma_{XX}^{+}(X-\mu_X), \qquad \operatorname{Cov}(Y\mid X)=\Omega $$
almost surely.

Deriving the Residual Covariance and Independence

Set \(A=\Sigma_{YX}\Sigma_{XX}^{+}\) and \(X_c=X-\mu_X\). Then \(R=(Y-\mu_Y)-AX_c\), so \(E[R]=0\). Using the compatibility identity above,

$$ \begin{aligned} \operatorname{Cov}(R,X) &=\Sigma_{YX}-A\Sigma_{XX}\\ &=\Sigma_{YX}-\Sigma_{YX}\Sigma_{XX}^{+}\Sigma_{XX}\\ &=0. \end{aligned} $$

Expanding the covariance of \(R\) gives

$$ \begin{aligned} \operatorname{Cov}(R) &=\Sigma_{YY}-A\Sigma_{XY}-\Sigma_{YX}A^{\mathsf T} +A\Sigma_{XX}A^{\mathsf T}\\ &=\Sigma_{YY}-\Sigma_{YX}\Sigma_{XX}^{+}\Sigma_{XY} =\Omega. \end{aligned} $$

For the second equality, \(\Sigma_{XX}^{+}\) is symmetric, and \(A\Sigma_{XX}=\Sigma_{YX}\); hence the last two terms involving \(A\) combine to subtract one copy of \(\Sigma_{YX}\Sigma_{XX}^{+}\Sigma_{XY}\). In particular, \(\Omega\) is positive semidefinite: it is the covariance matrix of \(R\).

To establish independence, note that \(R\) and \(X_c\) are affine transformations of the jointly Gaussian vector \((Y,X)\). They are therefore jointly Gaussian, including when their joint covariance is singular. Their cross-covariance is zero, as just calculated. For any \(t\in\mathbb{R}^q\) and \(s\in\mathbb{R}^p\), their joint characteristic function is

$$ \begin{aligned} E\left[\exp\{i(t^{\mathsf T}R+s^{\mathsf T}X_c)\}\right] &=\exp\left\{-\frac12 \begin{pmatrix}t\\s\end{pmatrix}^{\mathsf T} \begin{pmatrix}\Omega&0\\0&\Sigma_{XX}\end{pmatrix} \begin{pmatrix}t\\s\end{pmatrix}\right\}\\ &=\exp\left(-\frac12t^{\mathsf T}\Omega t\right) \exp\left(-\frac12s^{\mathsf T}\Sigma_{XX}s\right). \end{aligned} $$

The final expression is the product of the marginal characteristic functions of \(R\) and \(X_c\). The factorization holds for all \(t,s\), so uniqueness of characteristic functions implies that \(R\) and \(X_c\), and therefore \(R\) and \(X\), are independent.

Finally, \(Y=\widehat Y_{\mathrm{lin}}+R\), where \(R\) is independent of \(X\) and has mean zero. Taking conditional expectations gives the stated formula for \(E[Y\mid X]\). The conditional covariance is the covariance of \(R\), namely \(\Omega\), because the predictor is determined by \(X\). The characteristic-function argument also shows that the residual has the same Gaussian distribution conditionally on \(X\) as it has marginally. This proves the theorem. \(\square\)

Worked Examples

Worked Example: One Predictor and a Scalar Response

Suppose \(X\sim N(3,4)\), and let \(Y=5+1.5(X-3)+\varepsilon\), where \(\varepsilon\sim N(0,7)\) is independent of \(X\). Find the linear predictor, the residual variance, and the relationship between the residual and \(X\).

The means are \(E[X]=3\) and \(E[Y]=5\). Since \(Y\) is the stated linear function of \(X\) plus independent noise,

$$ \operatorname{Cov}(Y,X)=1.5\operatorname{Var}(X)=1.5(4)=6, \qquad \operatorname{Var}(Y)=1.5^2(4)+7=9+7=16. $$

The regression coefficient is \(6/4=1.5\), so \(\widehat Y_{\mathrm{lin}}=5+1.5(X-3)\). Subtracting this from \(Y\) gives \(R=\varepsilon\), and the residual variance formula agrees:

$$ \operatorname{Var}(R)=16-\frac{6^2}{4}=16-9=7. $$

Here independence is explicit from the model: \(\varepsilon\) was assumed independent of \(X\). The general theorem guarantees the same conclusion from joint Gaussianity and the covariance calculation.

Worked Example: Two Correlated Predictors

Let \(X\) have mean \(\mu_X=(1,-2)^{\mathsf T}\) and covariance \(\Sigma_{XX}=\begin{pmatrix}4&1\\1&2\end{pmatrix}\). Suppose \(E[Y]=4\), \(\operatorname{Var}(Y)=10\), and \(\Sigma_{YX}=(3,2)\). Find the predictor and residual variance.

The determinant of \(\Sigma_{XX}\) is \(4(2)-1(1)=7\), so it is invertible, with

$$ \Sigma_{XX}^{-1}=\frac17 \begin{pmatrix}2&-1\\-1&4\end{pmatrix}. $$

Multiplication gives the coefficient row:

$$ \Sigma_{YX}\Sigma_{XX}^{-1} =(3,2)\frac17\begin{pmatrix}2&-1\\-1&4\end{pmatrix} =\left(\frac47,\frac57\right). $$

Thus \(\widehat Y_{\mathrm{lin}}=4+\frac47(X_1-1)+\frac57(X_2+2)\). The reduction in variance is \((3,2)\Sigma_{XX}^{-1}(3,2)^{\mathsf T}=(3,2)(4/7,5/7)^{\mathsf T}=22/7\). Therefore

$$ \operatorname{Var}(R)=10-\frac{22}{7}=\frac{48}{7}. $$

This value is positive, as required for a valid residual variance. The response and predictor block can, for example, be constructed by taking a Gaussian \(X\) with the stated covariance and adding an independent \(N(0,48/7)\) residual to the displayed predictor. The residual is independent of both predictors jointly, not just uncorrelated with each one separately.

Worked Example: Exact Collinearity and a Singular Predictor Covariance

Let \(Z\sim N(0,1)\), \(X=(Z,2Z)^{\mathsf T}\), and \(Y=4+3Z+\varepsilon\), where \(\varepsilon\sim N(0,2)\) is independent of \(Z\). Compute the predictor using the generalized inverse and identify the residual.

The predictor covariance is singular:

$$ \Sigma_{XX}=\begin{pmatrix}1&2\\2&4\end{pmatrix}, \qquad \Sigma_{XX}^{+}=\frac1{25}\begin{pmatrix}1&2\\2&4\end{pmatrix}. $$

The stated pseudoinverse is verified by observing that \(\Sigma_{XX}=uu^{\mathsf T}\) for \(u=(1,2)^{\mathsf T}\), whose squared length is \(u^{\mathsf T}u=5\); the pseudoinverse is \(uu^{\mathsf T}/25\). Also, \(E[X]=(0,0)^{\mathsf T}\), \(E[Y]=4\), and \(\Sigma_{YX}=(3,6)\). Hence

$$ \Sigma_{YX}\Sigma_{XX}^{+} =(3,6)\frac1{25}\begin{pmatrix}1&2\\2&4\end{pmatrix} =\left(\frac35,\frac65\right). $$

The predicted centered response is \(\frac35X_1+\frac65X_2=3Z\), so \(\widehat Y_{\mathrm{lin}}=4+3Z\). The residual is \(R=\varepsilon\), with variance \(2\). The covariance formula confirms this: \(\Sigma_{YY}=9+2=11\), and \((3,6)\Sigma_{XX}^{+}(3,6)^{\mathsf T}=9\), giving \(11-9=2\). Although many coefficient pairs produce the same fitted value when \(X_2=2X_1\), the predictor itself is unique almost surely.

Interpretation and a Common Pitfall

The residual covariance \(\Omega\) measures the response variation left after the predictor block has been used. Its value is no larger than the original response covariance in the positive-semidefinite sense: the removed term \(\Sigma_{YX}\Sigma_{XX}^{+}\Sigma_{XY}\) is positive semidefinite. When the predictor covariance is nonsingular and the response is scalar, this reduces to the familiar variance subtraction \(\operatorname{Var}(Y)-\Sigma_{YX}\Sigma_{XX}^{-1}\Sigma_{XY}\).

A frequent mistake is to argue that zero covariance alone proves independence. In general, that is false: uncorrelated random variables need not be independent. The correction here is specific and important. The residual and predictors are jointly Gaussian, and the characteristic-function factorization proves their independence. Without joint Gaussianity, the same linear predictor can have an uncorrelated residual without an independent one.

Another potential confusion is treating the coefficients as uniquely determined when the predictors are linearly dependent. With singular \(\Sigma_{XX}\), coefficient representations can differ, but the fitted predictor is unique almost surely: any difference between valid coefficient matrices has zero variance when applied to \(X-\mu_X\). It is the prediction and its residual covariance, rather than a particular coefficient representation, that carry the statistical content.

Key takeaway: For a jointly Gaussian response and predictor block, subtracting the covariance-based linear predictor leaves a Gaussian residual independent of the predictors. Its covariance is the Schur-complement expression \(\Sigma_{YY}-\Sigma_{YX}\Sigma_{XX}^{+}\Sigma_{XY}\), valid for both nonsingular and singular predictor covariance.

Check Your Understanding

Use the definitions and derivations above to answer these questions.

  1. For scalar \(Y\) and scalar \(X\) with \(\operatorname{Var}(X)>0\), express the regression coefficient and residual variance using covariance notation.
  2. Why must \(\Sigma_{YX}v=0\) whenever \(\Sigma_{XX}v=0\) in a jointly Gaussian block system?
  3. What feature of the Gaussian distribution allows zero residual-predictor covariance to establish independence in the proof?
  4. If two predictors are exact linear multiples of each other, what can fail to be unique, and what remains unique almost surely?
  5. Does the Gaussian residual-independence conclusion automatically hold for a non-Gaussian response and predictor block? Explain.