Skip to content

Deriving a Conditional Gaussian Distribution

Original question

How do I derive the conditional distribution of one Gaussian random variable given another in this problem set?
For jointly Gaussian XX and YY with Var⁡(Y)>0\operatorname{Var}(Y)>0, subtract the linear projection of XX onto YY. The remaining Gaussian residual is independent of YY. Given Y=yY=y, add the fitted conditional mean back to that residual. The resulting normal law has variance Var⁡(X)(1−ρ2)\operatorname{Var}(X)(1-\rho^2) when both marginal variances are positive.

Subtract the best linear prediction and identify the residual law

Let μX=E[X]\mu_X=E[X], μY=E[Y]\mu_Y=E[Y], σXY=Cov⁡(X,Y)\sigma_{XY}=\operatorname{Cov}(X,Y), and σY2=Var⁡(Y)\sigma_Y^2=\operatorname{Var}(Y). Define

a=σXYσY2,R=X−μX−a(Y−μY).a=\frac{\sigma_{XY}}{\sigma_Y^2}, \qquad R=X-\mu_X-a(Y-\mu_Y).
Then Cov⁡(R,Y)=σXY−aσY2=0\operatorname{Cov}(R,Y)=\sigma_{XY}-a\sigma_Y^2=0. The pair (R,Y)(R,Y) is jointly Gaussian because it is an affine transformation of (X,Y)(X,Y). The zero covariance implies independence. Expanding the variance of RR gives σX2−σXY2/σY2\sigma_X^2-\sigma_{XY}^2/\sigma_Y^2, so the conditional law is
X∣Y=y∼N(μX+a(y−μY), σX2−σXY2σY2).X\mid Y=y\sim N\left( \mu_X+a(y-\mu_Y),\ \sigma_X^2-\frac{\sigma_{XY}^2}{\sigma_Y^2} \right).
If the residual variance is zero, the law is a point mass at the conditional mean. The formula describes a regular conditional distribution. This is how conditioning on a particular real value is understood even though a continuous YY assigns probability zero to the event Y=yY=y.
The choice of aa makes the residual uncorrelated with YY. Because (R,Y)(R,Y) is jointly Gaussian, that orthogonality becomes independence. After observing Y=yY=y, the mean part therefore becomes the number μX+a(y−μY)\mu_X+a(y-\mu_Y) while the residual has its original centred Gaussian distribution. This also explains why the conditional variance in the answer does not depend on yy. The observed value changes the location. The correlation and the marginal variances determine how much uncertainty remains.

Using the correlation gives another way to read the calculation. Since σXY=ρσXσY\sigma_{XY}=\rho\sigma_X\sigma_Y, the conditional mean adjustment is ρσX\rho\sigma_X times the number of standard deviations by which yy exceeds μY\mu_Y. In the example, observing 13 is one standard deviation above the mean of 10, so it adds 0.6(2)=1.20.6(2)=1.2 to the mean of XX. For the conditional standard deviation, take the square root of σX2(1−ρ2)\sigma_X^2(1-\rho^2). These two quantities are what you need before standardising the threshold in the tail probability.

Turn one observed signal into a conditional probability

A model gives μX=1\mu_X=1, σX=2\sigma_X=2, μY=10\mu_Y=10, σY=3\sigma_Y=3 and ρ=0.6\rho=0.6. What is the probability XX exceeds 2 when YY is observed at 13?

The covariance is 0.6(2)(3)=3.60.6(2)(3)=3.6, so a=3.6/9=0.4a=3.6/9=0.4. The conditional mean is 1+0.4(13−10)=2.21+0.4(13-10)=2.2. The conditional variance is 4(1−0.62)=2.564(1-0.6^2)=2.56, with standard deviation 1.6. Therefore
P(X>2∣Y=13)=1−Φ(2−2.21.6)≈0.550.P(X>2\mid Y=13)=1-\Phi\left(\frac{2-2.2}{1.6}\right)\approx0.550.

The unconditional probability is about 0.309. Observing a value of YY one standard deviation above its mean shifts the conditional distribution enough to make the event substantially more likely in this example.

The same projection argument extends to several observed variables. Replace the scalar slope by a row vector of covariances multiplied by the inverse of the observations' covariance matrix. In a numerical implementation, solve the corresponding linear system to obtain the slope.

Compute the conditional mean and tail probability

from scipy.stats import norm conditional_mean = 1 + (0.6 * 2 / 3) * (13 - 10) conditional_sd = 2 * (1 - 0.6**2)**0.5 print(norm.sf(2, loc=conditional_mean, scale=conditional_sd))

References and next steps