Tutorials › Multivariate Statistics (Graduate) › Gaussian Regression as Conditional Expectation

Gaussian Geometry and Conditioning · Tutorial 99 of 975

Gaussian Regression as Conditional Expectation

Learn how covariance blocks determine the Gaussian regression coefficient and why the conditional mean is the optimal affine predictor under squared-error loss.

Intermediate 10 min read

What You'll Learn

  • State the joint Gaussian assumptions needed for an affine conditional mean.
  • Derive the regression coefficient from the predictor covariance and response–predictor covariance.
  • Calculate conditional means and Schur-complement conditional covariances from covariance blocks.
  • Distinguish covariance-based regression coefficients from marginal correlations.
  • Prove that the conditional mean minimizes expected squared prediction error among affine predictors.

Why Gaussian Regression Is a Conditional Mean

In regression, a response is predicted from observed predictors. For a general distribution, the conditional mean can be a nonlinear function of those predictors. Joint Gaussianity gives a particularly structured case: the conditional mean is affine, and its slope is determined entirely by covariance blocks. This makes Gaussian regression a direct consequence of the geometry of the joint distribution, rather than an additional modelling assumption.

Let \(X\) be a \(p\)-dimensional predictor vector and \(Y\) a \(q\)-dimensional response vector. The response may be scalar, but the vector form also allows several outcomes to be predicted at once. Assume that the joint vector \((X^T,Y^T)^T\) is Gaussian, has mean \((\mu_X^T,\mu_Y^T)^T\), and has positive-definite covariance matrix

$$ \Sigma = \begin{pmatrix} \Sigma_{XX} & \Sigma_{XY}\\ \Sigma_{YX} & \Sigma_{YY} \end{pmatrix}, \qquad \Sigma_{YX}=\Sigma_{XY}^T. $$

Here \(\Sigma_{XX}\) is \(p\times p\), \(\Sigma_{YY}\) is \(q\times q\), and \(\Sigma_{YX}\) is \(q\times p\). Positive definiteness ensures that \(\Sigma_{XX}\) is invertible and that the Schur complement used below is positive definite.

Definition: The Gaussian regression coefficient matrix of \(Y\) on \(X\) is \(B=\Sigma_{YX}\Sigma_{XX}^{-1}\). Under the joint Gaussian assumptions above, the conditional mean is \(E[Y\mid X=x]=\mu_Y+B(x-\mu_X)\). The intercept form is \(a+Bx\), where \(a=\mu_Y-B\mu_X\).

Deriving the Conditional Mean from Covariance Blocks

The formula can be obtained from the conditional Gaussian density. Write \(A=\Sigma_{XX}\), \(C=\Sigma_{XY}\), and \(D=\Sigma_{YY}\), and define \(S=D-C^TA^{-1}C\). This is the Schur complement of \(A\) in \(\Sigma\), hence the conditional covariance of \(Y\) given \(X\). The conditional Gaussian law follows by completing the square in the joint density; the key quadratic-form identity is

$$ \begin{pmatrix}u\\v\end{pmatrix}^{T} \Sigma^{-1} \begin{pmatrix}u\\v\end{pmatrix} = u^TA^{-1}u+ \left(v-C^TA^{-1}u\right)^T S^{-1} \left(v-C^TA^{-1}u\right), $$

where \(u=x-\mu_X\) and \(v=y-\mu_Y\). The determinant identity \(\det(\Sigma)=\det(A)\det(S)\) means that, when \(x\) is fixed, the joint density as a function of \(y\) is proportional to a Gaussian density with mean \(\mu_Y+C^TA^{-1}(x-\mu_X)\) and covariance \(S\). Since \(C^T=\Sigma_{YX}\), this gives the regression coefficient in the definition.

Theorem: If \((X^T,Y^T)^T\) is jointly Gaussian with positive-definite covariance \(\Sigma\), then, for every \(x\), the conditional distribution is \(Y\mid X=x\sim N\!\left(\mu_Y+\Sigma_{YX}\Sigma_{XX}^{-1}(x-\mu_X),\ \Sigma_{YY}-\Sigma_{YX}\Sigma_{XX}^{-1}\Sigma_{XY}\right)\). In particular, its conditional mean is affine in \(x\).

For completeness, the density argument also verifies that the stated location is the conditional expectation, not just the centre of a quadratic expression. The conditional density is symmetric about that location, and its centred first moment is zero: after translating by the location, the integrand for each coordinate of the first moment is odd, while the Gaussian density is even and has a finite first moment. Thus integration gives the conditional mean. The covariance is \(S\), which is independent of the observed value \(x\). The affine conditional mean and constant conditional covariance are both consequences of joint Gaussianity.

Worked Example: Scalar Response and One Predictor

Suppose \(X\) and \(Y\) are jointly Gaussian with \(E[X]=2\), \(E[Y]=5\), \(\operatorname{Var}(X)=4\), \(\operatorname{Cov}(Y,X)=3\), and \(\operatorname{Var}(Y)=5\). Find the conditional mean and variance of \(Y\) given \(X=x\).

For a single predictor, \(\Sigma_{XX}=4\) and \(\Sigma_{YX}=3\), so the regression coefficient is \(B=3/4\). Therefore

$$ E[Y\mid X=x]=5+\frac{3}{4}(x-2) =\frac{7}{2}+\frac{3}{4}x. $$

The conditional variance is the Schur complement:

$$ \operatorname{Var}(Y\mid X) =5-\frac{3}{4}(3) =5-\frac{9}{4} =\frac{11}{4}. $$

The joint covariance is valid: its determinant is \(4(5)-3^2=11>0\), and its diagonal entries are positive. Thus it is positive definite, as required. For example, when \(x=6\), the conditional mean is \(5+(3/4)(6-2)=8\), while the conditional variance remains \(11/4\).

Multiple Predictors: Matrix Calculation

With several predictors, the scalar slope is replaced by a matrix. Each row of \(B\) describes how the conditional mean of one response component changes with all predictor components. The matrix product must be ordered carefully: \(\Sigma_{YX}\) is \(q\times p\), so it multiplies the \(p\times p\) inverse \(\Sigma_{XX}^{-1}\) on the right.

Worked Example: Two Predictors and a Scalar Response

Let \(X=(X_1,X_2)^T\) and let \(Y\) be scalar. Take \(\mu_X=(1,-1)^T\), \(\mu_Y=4\), and covariance blocks

$$ \Sigma_{XX}= \begin{pmatrix}6&1\\1&5/2\end{pmatrix}, \qquad \Sigma_{YX}=\begin{pmatrix}2&1\end{pmatrix}, \qquad \Sigma_{YY}=5. $$

First, \(\det(\Sigma_{XX})=6(5/2)-1=14\), so \(\Sigma_{XX}\) is positive definite and

$$ \Sigma_{XX}^{-1} =\frac{1}{14} \begin{pmatrix}5/2&-1\\-1&6\end{pmatrix}. $$

Multiplying by \(\Sigma_{XY}=(2,1)^T\) gives

$$ \Sigma_{XX}^{-1}\Sigma_{XY} =\frac{1}{14} \begin{pmatrix}5/2&-1\\-1&6\end{pmatrix} \begin{pmatrix}2\\1\end{pmatrix} =\frac{1}{14} \begin{pmatrix}4\\4\end{pmatrix} =\begin{pmatrix}2/7\\2/7\end{pmatrix}. $$

Consequently, the regression coefficient row is \(B=\Sigma_{YX}\Sigma_{XX}^{-1}=(2/7,2/7)\). The conditional mean is

$$ E[Y\mid X=x] =4+\frac{2}{7}(x_1-1)+\frac{2}{7}(x_2+1) =4+\frac{2}{7}(x_1+x_2). $$

The conditional variance calculation uses the same intermediate vector:

$$ \Sigma_{YX}\Sigma_{XX}^{-1}\Sigma_{XY} = \begin{pmatrix}2&1\end{pmatrix} \begin{pmatrix}2/7\\2/7\end{pmatrix} =\frac{4}{7}+\frac{2}{7} =\frac{6}{7}, \qquad \operatorname{Var}(Y\mid X)=5-\frac{6}{7}=\frac{29}{7}. $$

The joint covariance is positive definite because \(\Sigma_{XX}\) is positive definite and its Schur complement is \(29/7>0\). As a numerical check, at \(x=(2,3)^T\), the conditional mean is \(4+(2/7)(5)=38/7\), and the conditional variance remains \(29/7\).

Why This Is a Regression Coefficient

The covariance formula has a second interpretation: it gives the unique best affine predictor under squared-error loss. This connection explains why the same coefficient appears in regression, even when the goal is described as prediction rather than conditioning.

Theorem: Suppose \(E[X]=\mu_X\), \(E[Y]=\mu_Y\), and \(\Sigma_{XX}\) is positive definite, with finite second moments. Among all affine predictors \(a+BX\), where \(a\) is a \(q\)-vector and \(B\) is a \(q\times p\) matrix, the unique minimizer of \(E[\|Y-a-BX\|^2]\) is \(B=\Sigma_{YX}\Sigma_{XX}^{-1}\) and \(a=\mu_Y-B\mu_X\). Joint Gaussianity is not needed for this best-affine-predictor result.

To prove the result, set \(B_*=\Sigma_{YX}\Sigma_{XX}^{-1}\), \(a_*=\mu_Y-B_*\mu_X\), and \(\varepsilon=Y-\mu_Y-B_*(X-\mu_X)\). Then \(E[\varepsilon]=0\), and \(\operatorname{Cov}(\varepsilon,X)=\Sigma_{YX}-B_*\Sigma_{XX}=0\). Also \(\operatorname{Cov}(\varepsilon)=\Sigma_{YY}-\Sigma_{YX}\Sigma_{XX}^{-1}\Sigma_{XY}\). For arbitrary \(a,B\), write \(\Delta=B-B_*\) and \(d=a+B\mu_X-\mu_Y\). The prediction error is \(Y-a-BX=\varepsilon-\Delta(X-\mu_X)-d\). Taking its squared Euclidean norm and expectation, the cross terms vanish: the terms involving \(d\) vanish because both centred random vectors have mean zero, and the term involving \(\varepsilon\) and \(X-\mu_X\) vanishes because their cross-covariance is zero. Hence

$$ E[\|Y-a-BX\|^2] = \operatorname{tr}\!\left(\operatorname{Cov}(\varepsilon)\right) +\operatorname{tr}(\Delta\Sigma_{XX}\Delta^T) +\|d\|^2. $$

Both additional terms are nonnegative. Since \(\Sigma_{XX}\) is positive definite, \(\operatorname{tr}(\Delta\Sigma_{XX}\Delta^T)=0\) only when \(\Delta=0\); also \(\|d\|^2=0\) only when \(d=0\). These conditions give \(B=B_*\) and \(a=a_*\), proving existence and uniqueness of the minimizer. \(\square\)

For a jointly Gaussian vector, the conditional mean is itself affine and has exactly these coefficients. Thus the best affine predictor is also the conditional mean. The proof uses zero cross-covariance to evaluate the squared-error criterion; it does not require an independence claim.

Worked Example: Several Responses with One Predictor

Let \(X\) be scalar with mean \(1\) and variance \(3\). Let \(Y=(Y_1,Y_2)^T\) have mean \((2,-1)^T\), covariance \(\Sigma_{YY}=\begin{pmatrix}4&1\\1&6\end{pmatrix}\), and cross-covariance \(\Sigma_{YX}=(1,-2)^T\). Assume the joint vector is Gaussian. Find its conditional mean and covariance.

The coefficient matrix is \(B=\Sigma_{YX}\Sigma_{XX}^{-1}=(1,-2)^T/3\). Therefore

$$ E[Y\mid X=x] = \begin{pmatrix}2\\-1\end{pmatrix} + \begin{pmatrix}1/3\\-2/3\end{pmatrix}(x-1). $$

The covariance reduction term is

$$ \Sigma_{YX}\Sigma_{XX}^{-1}\Sigma_{XY} =\frac{1}{3} \begin{pmatrix}1\\-2\end{pmatrix} \begin{pmatrix}1&-2\end{pmatrix} = \begin{pmatrix}1/3&-2/3\\-2/3&4/3\end{pmatrix}. $$

Subtracting it from \(\Sigma_{YY}\) gives

$$ \operatorname{Cov}(Y\mid X) = \begin{pmatrix}11/3&5/3\\5/3&14/3\end{pmatrix}. $$

This matrix is positive definite: its first diagonal entry is positive and its determinant is \((11/3)(14/3)-(5/3)^2=129/9=43/3>0\). For \(x=4\), the conditional mean is \((3, -3)^T\). The covariance matrix is unchanged by this particular predictor value.

Common Mistakes and Interpretation

  • Reversing a covariance block. For vector \(Y\) and predictor \(X\), the coefficient is \(\Sigma_{YX}\Sigma_{XX}^{-1}\), with dimensions \(q\times p\). The transposed block \(\Sigma_{XY}\) has the wrong dimensions for a coefficient matrix in this order.
  • Using covariance alone as the slope. The cross-covariance must be adjusted by the predictor covariance matrix. When predictors are correlated or have different scales, \(\Sigma_{YX}\) alone does not give the regression coefficient.
  • Confusing the conditional mean with the observed response. The formula gives the mean of the conditional distribution, not a claim that every observed \(Y\) lies on the affine function. Conditional variation is described by the Schur complement.
  • Assuming the affine formula holds for every distribution. The best affine predictor has the covariance-block coefficient under finite second moments, but it need not equal the conditional mean unless additional structure, such as joint Gaussianity, makes that conditional mean affine.
  • Making an independence claim from a zero covariance. The calculations above establish a covariance relationship and a conditional mean formula. Independence is a separate conclusion that requires its own argument.
Key takeaway: For a jointly Gaussian response and predictor vector with nonsingular predictor covariance, the conditional mean is \(\mu_Y+\Sigma_{YX}\Sigma_{XX}^{-1}(x-\mu_X)\). The predictor covariance adjusts the cross-covariance into a regression coefficient, while the Schur complement gives the conditional covariance.

Check Your Understanding

Use the covariance-block formula and the assumptions stated in each question.

  1. For a scalar response and scalar predictor, explain why the regression slope is \(\operatorname{Cov}(Y,X)/\operatorname{Var}(X)\), rather than just \(\operatorname{Cov}(Y,X)\).
  2. In the two-predictor worked example, verify the determinant of \(\Sigma_{XX}\) and the Schur complement of the joint covariance.
  3. What assumption lets the best affine predictor be identified with the conditional mean?
  4. For vector \(Y\) and vector \(X\), give the dimensions of \(\Sigma_{YX}\), \(\Sigma_{XX}^{-1}\), and the coefficient matrix \(B\).
  5. Why does a nonzero conditional covariance not contradict the fact that the conditional mean is an affine function of the predictors?
Clinical Biostats