# Variance of truncated bivariate normal

Suppose I have two non-independent gaussian random variables

$$(X,Y)\sim \text{BiNormal}[(\mu_X,\mu_Y),(\sigma_X,\sigma_Y),\rho]$$

It's a well known result for the bivariate normal distribution with zero means and unit variances that

$$\operatorname {E}(X\mid Y

Similar expressions are also available for the non-zero non-unit variance conditional expectation.

Is there a similarly convenient parameterisation for $$\operatorname {Var}(X\mid Y ? I'm interested in the general case (non-zero means & non-unit variances).

NB. I am aware that, for Gaussian families, conditioning acts as a linear projection. As explained here, that means that $$\operatorname {Var}(X\mid X)=\sigma_Y^2(1-\rho^2)$$. This is what makes me believe there might be a parameterisation for the variance in the truncated case.

• The conditional expectation formula is correct but only when $\mu_X=\mu_Y=0$ and $\sigma_X=\sigma_Y=1$. – JimB Oct 22 '19 at 5:37
• When $\mu_X=\mu_Y=0$ and $\sigma_X=\sigma_Y=1$ the conditional variance is $1-\frac{\rho ^2 \phi (y) y \Phi (y)+\phi (y))}{\Phi (y)^2}$. Do you just need the answer for non-zero means and non-unity variances or do you need all of the steps? – JimB Oct 22 '19 at 13:10
• Yes, you are correct of course – the expectation I included from Wikipedia is a special case (centered case with unit variances). I've edited the OP to make this clear. I just need the answer for the general case (non-zero means & non-unity variances). I don't need the proof/steps. Thanks! – EOO Oct 22 '19 at 13:42

Here is what I found using Mathematica. First, the constant of integration is found for the truncated bivariate distribution, then the first two moments are found followed by the variance. Then the variance is simplified such that we end up with the usual notation.

Here are the results:

$$E(X|Y

$$V(X|Y

If $$\mu_X=\mu_Y=1$$ and $$\sigma_X=\sigma_Y=1$$, then

$$E(X|Y

$$V(X|Y

Here is the code:

(* Define bivariate normal distribution *)
d = BinormalDistribution[{μX, μY}, {σX, σY}, ρ];

(* Get constant of integration for truncated distribution *)
c = 1/Integrate[PDF[d, {x, y}], {y, -∞, y0}, {x, -∞, ∞},
Assumptions -> y0 ∈ Reals && σX > 0 && σY > 0 && μX ∈ Reals && μY ∈ Reals && -1 < ρ < 1];

(* Mean *)
ex = c Integrate[x PDF[d, {x, y}], {y, -∞, y0}, {x, -∞, ∞},
Assumptions -> y0 ∈ Reals && σX > 0 && σY > 0 && μX ∈ Reals && μY ∈ Reals && -1 < ρ < 1];

(* Expectation of X^2 *)
ex2 = c Integrate[x^2 PDF[d, {x, y}], {y, -∞, y0}, {x, -∞, ∞},
Assumptions -> y0 ∈ Reals && σX > 0 && σY > 0 && μX ∈ Reals && μY ∈ Reals && -1 < ρ < 1];

(* V(X|Y<y *)
var = ex2 - ex^2

(* Now attempt to simplify and write in terms of usual notation *)
var = var // FullSimplify
var = var /. Erfc[z_] -> 1 - Erf[z] //. Erf[Abs[z_]/(Sqrt[2] σY)] Sign[z_]^3 ->
Erf[z/(Sqrt[2] σY)]
var = var /. E^(-((y0 - μY)^2/(2 σY^2))) -> Sqrt[2 π] ϕ[(y0 - μY)/σY] /.
Erf[z_] -> -1 + 2 Φ[Sqrt[2] z] /. y0 -> y // FullSimplify

(* E(X|Y<y) *)
expectation = ex /. E^(-((y0 - μY)^2/(2 σY^2))) -> Sqrt[2 π] ϕ[(y0 - μY)/σY] /.
Erf[z_] -> -1 + 2 Φ[Sqrt[2] z] /. y0 -> y // FullSimplify