# Conditional expectation in the multivariate normal distribution

Suppose $(X_1, X_2, X_3)^T$ is multivariate normal.

What is the conditional expectation $E(X_1 \mid X_2, I(X_3 > 0))$?

Here, $I(X_3>0)$ is the random variable that takes the value one when $X_3 > 0$ and zero otherwise. I know that, without using any properties of the normal distribution, $$E(X_1 \mid I(X_3>0)) = I(X_3 > 0)\frac{E[ X_1I(X_3 > 0)]}{P(X_3 > 0)}+ I(X_3 \leq 0)\frac{E[ X_1I(X_3 \leq 0)]}{P(X_3 \leq 0)}.$$

Based on this, I'm tempted to infer that,

$$E(X_1\mid X_2, I(X_3> 0)) = I(X_3 > 0)\frac{E[ X_1I(X_3 > 0) \mid X_2]}{P(X_3 > 0\mid X_2)} + I(X_3 \leq 0)\frac{E[ X_1I(X_3 \leq 0)\mid X_2]}{P(X_3 \leq 0 \mid X_2)},$$

but am unable to confirm or refute this. If this is true, one could proceed using properties of conditional distributions for multivariate normal vectors to get more specific expressions.

• The joint distribution of $(X_1,X_2,Z_3=\mathbb I_{X_3>0})$ has density $$p(x_1,x_2|\mathbf \mu,\mathbf \Sigma)\Phi(-\mathbb E[X_3|x_1,x_2]/\text{sd}(X_3|x_1,x_2))^{z_3}\Phi(\mathbb E[X_3|x_1,x_2]/\text{sd}(X_3|x_1,x_2))^{1-z_3}$$ Commented Nov 1, 2019 at 15:58
• As a sanity check, observe that by definition this conditional expectation is a function of both $X_2$ and the set of possible values of $I(X_3\gt 0)$ -- namely, $\{0,1\}.$ Thus any correct answer can be expressed as one function of $X_2$ corresponding to $X_3\gt 0$ and another function of $X_2$ corresponding to $X_3\le 0.$
– whuber
Commented Mar 6 at 21:06

Let's start with the properties of the multivariate Normal distribution and see where that leads us.

The "unconstrained" conditional expectation is a random variable, say $$W$$, and a function of both $$X_2$$ and $$X_3$$, $$W \equiv E(X_1 \mid X_2, X_3) = \mu_1 + c_2(X_2-\mu_2) + c_3(X_3-\mu_3),$$

where $$\mu_j$$ is the unconditional mean of $$X_j$$, $$j=1,2,3$$ and $$c_2,c_3$$ are constants coming from the covariance matrix of all three (see specific formulas in https://en.wikipedia.org/wiki/Multivariate_normal_distribution).

The OP wants to obtain this conditional expectation given that $$X_3 >0$$. Set for compactness $$I_3 \equiv I(X_3 > 0)$$. The Information set $$(X_2, X_3)$$ is bigger than $$(X_2, I_3)$$ so by the tower property we can write

\begin{align} E(X_1 \mid X_2, I_3) &= E\Big[E(X_1 \mid X_2, X_3) \mid \{X_2, I_3\}\Big]\\ &= E\Big[W \mid \{X_2, I_3\}\Big] \\ &= E\Big[\mu_1 + c_2(X_2-\mu_2) + c_3(X_3-\mu_3) \mid \{X_2, I_3\}\Big] \\ & = \mu_1 + c_2(X_2-\mu_2) -c_3\mu_3 + c_3E[X_3 \mid X_2, I_3]. \tag{1} \end{align}

It may appear that our right-hand-side includes a component that is similar in structure to our left-hand-side, and so that we did not make much progress, but this is not correct: the $$X_1$$ variable does not appear in $$E[X_3 \mid X_2, I_3]$$.

We can write \begin{align} E[X_3 \mid X_2, I_3] & = I_3 \cdot E[X_3 \mid X_2, X_3 > 0]\\ & \;\;\; + (1-I_3) \cdot E[X_3 \mid X_2, X_3 \leq 0]\tag{2} \end{align}

With this we have transformed a conditional expectation given two r.v.'s into expressions that involve conditional expectations given one r.v., and truncation.

The conditional distribution of $$X_3 \mid X_2$$ is Normal, and writing $$\phi$$ for the standard Normal density and $$\Phi$$ for the standard Normal distribution function, we have \begin{align} 1&=\int_{-\infty}^{\infty}\frac{1}{\sigma_{3|2}}\phi\left(\frac{x_3-\mu_{3|2}}{\sigma_{3|2}}\right)dx_3\\ &=\int_{-\infty}^{0}\frac{1}{\sigma_{3|2}}\phi\left(\frac{x_3-\mu_{3|2}}{\sigma_{3|2}}\right)dx_3 + \int_{0}^{\infty}\frac{1}{\sigma_{3|2}}\phi\left(\frac{x_3-\mu_{3|2}}{\sigma_{3|2}}\right)dx_3\\ &\implies \int_{0}^{\infty}\frac{1}{\sigma_{3|2}}\phi\left(\frac{x_3-\mu_{3|2}}{\sigma_{3|2}}\right)dx_3 = \Phi\left(\frac{\mu_{3|2}}{\sigma_{3|2}}\right), \tag{3}\\ &{\rm and\;also} \int_{-\infty}^{0}\frac{1}{\sigma_{3|2}}\phi\left(\frac{x_3-\mu_{3|2}}{\sigma_{3|2}}\right)dx_3 = \Phi\left(\frac{-\mu_{3|2}}{\sigma_{3|2}}\right). \tag{4} \end{align}

These are the normalizing factors for the truncated conditional expectations we want to compute. Note that the $$X_2$$ variable lives inside the parameters of the conditional distribution.

Then $$E[X_3 \mid X_2, X_3 > 0] = \frac {1} {\Phi\left(\frac{\mu_{3|2}}{\sigma_{3|2}}\right)} \int_{0}^{\infty}x_3\frac{1}{\sigma_{3|2}}\phi\left(\frac{x_3-\mu_{3|2}}{\sigma_{3|2}}\right)dx_3,$$

and by a standard change-of-variables in the integrating variable, (setting $$z = (x_3 - \mu_{3|2}) / \sigma_{3|2}$$ etc) we obtain

$$E[X_3 \mid X_2, X_3 > 0] = \mu_{3|2} + \sigma_{3|2}\frac{\phi\left(\frac{\mu_{3|2}}{\sigma_{3|2}}\right)}{\Phi\left(\frac{\mu_{3|2}}{\sigma_{3|2}}\right)} \tag{5}$$

In an analogous manner we get

$$E[X_3 \mid X_2, X_3 \leq 0] = \mu_{3|2} - \sigma_{3|2}\frac{\phi\left(\frac{\mu_{3|2}}{\sigma_{3|2}}\right)}{\Phi\left(\frac{-\mu_{3|2}}{\sigma_{3|2}}\right)} \tag{6}$$

Inserting $$(5)$$ and $$(6)$$ in $$(2)$$ we get \begin{align} E[X_3 \mid X_2, I_3] & = I_3 \cdot \left[ \mu_{3|2} + \sigma_{3|2}\frac{\phi\left(\frac{\mu_{3|2}}{\sigma_{3|2}}\right)}{\Phi\left(\frac{\mu_{3|2}}{\sigma_{3|2}}\right)}\right] \;\; + \;\;(1-I_3) \cdot \left[ \mu_{3|2} - \sigma_{3|2}\frac{\phi\left(\frac{\mu_{3|2}}{\sigma_{3|2}}\right)}{\Phi\left(\frac{-\mu_{3|2}}{\sigma_{3|2}}\right)}\right]. \end{align}

Manipulating this while using also the reflection properties of $$\Phi$$ we eventually arrive at

$$E[X_3 \mid X_2, I_3] = \mu_{3|2}\; +\;\sigma_{3|2}\phi\left(\frac{\mu_{3|2}}{\sigma_{3|2}}\right)\frac{I_3 -\Phi\left(\frac{\mu_{3|2}}{\sigma_{3|2}}\right) }{\Phi\left(\frac{\mu_{3|2}}{\sigma_{3|2}}\right)\Phi\left(\frac{-\mu_{3|2}}{\sigma_{3|2}}\right)} \tag{7}$$

Inserting $$(7)$$ into $$(1)$$ we get

\begin{align} E(X_1 \mid X_2, I\{X_3>0\}) &= \mu_1 + c_2(X_2-\mu_2) -c_3\mu_3 \\ &+ c_3\mu_{3|2}\; +\;c_3\sigma_{3|2}\phi\left(\frac{\mu_{3|2}}{\sigma_{3|2}}\right)\frac{I\{X_3>0\} -\Phi\left(\frac{\mu_{3|2}}{\sigma_{3|2}}\right) }{\Phi\left(\frac{\mu_{3|2}}{\sigma_{3|2}}\right)\Phi\left(\frac{-\mu_{3|2}}{\sigma_{3|2}}\right)}, \tag{8} \end{align}

where we remind that $$c_2$$ and $$c_3$$ are constant terms coming from the covariance matrix of all three variables, whose general expressions can be found in the wikipedia page referenced above. In the same link one can find the expressions for $$\mu_{3|2},\,\sigma_{3|2}$$ (that are not constants, since they include $$X_2$$).

Somebody may want to check all these.