# Can we calculate $E[Y|Z]$ if we know $f(Y|X)$ and $f(X|Z)$?

While reading Jennifer Hill (2011), p. 220, in the context of conditional average treatment effect, the author is able to calculate $E[Y|Z]$ from $f(Y|X)$ and $f(X|Z)$.

My attempt to replicate the author's calculation is as follows: \begin{align} E[Y|Z] &= \int y f(y|z) dy \\ &= \int y \int f(y, x| z) dx dy \\ &= \int y \int f(y|x, z) f(x|z) dx dy\\ &= \int y \int f(y|x) f(x|z) dx dy \end{align}

where the last equation is true because $y$ is independent from $z$ once conditional on $x$.

However, this integration is rather nightmarish even with the Gaussian distributions, i.e. $f(x|z=1) \sim N(40, 10^2)$ and $f(y|x) = N(72 + 3 \sqrt x, 1)$. I tried Mathematica, which couldn't give the numerical result either.

Is this the correct approach to calculate $E[Y|Z]$, or there is a more sensible approach?

• So you occasionally get complex means for $y$? – Taylor Jun 19 '16 at 13:20

Continuing from your last statement, we have $$\int_y y \int_x f(y|x) f(x|z) dx dy$$ $$=\int_x\left[\int_y y f(y|x) dy \right] f(x|z) dx$$ $$=\int_x E[Y|X] f(x|z) dx$$ and that's it.
But, if by any chance everything is Gaussian, then $$E[Y|X]=E[Y]+\alpha (X-E[X])$$ where $\alpha=\frac{cov(X,Y)}{var(X)}$. So we have $$= \int_x \left[ \mu_Y + \alpha x -\alpha \mu_X \right] f(x|z) dx$$ $$= \mu_Y -\alpha \mu_X + \alpha \int_x x f(x|z) dx$$ $$= \mu_Y -\alpha \mu_X + \alpha E[X|Z]$$ which can be expressed easily using the same method, if it is Gaussian.
• How does $X$ and $Y$ being normal lead to that way of calculating $E[Y|X]$? I think that's only true when $X, Y$ are bivariate normal. – Heisenberg Jun 19 '16 at 15:54
• Thanks a lot! Using $\int_x E[Y|X] f(x|z) dx$ Mathematica did manage to give the definite integral this time. Is it because we've simplified the integral? – Heisenberg Jun 19 '16 at 16:42