If $E[X|Y=y]=y$, does $E[X]=E[Y]$? Similarly, if $E[X|Y=y]=y^2$, does $E[X]=E[Y^2]$?

I'm having some trouble with this conditional expectation concept, although it seems intuitively true

-
The notation $E[X\mid Y=y]=y$ means that the conditional expectation of $X$ with respect to $Y$ is $Y$. Since $\Omega$ in $\sigma(Y)$, we have $E[X]=\int_{\Omega}E[X\mid Y]dP=\int_{\Omega}YdP=E[Y]$, if these two random variables are integrable. – Davide Giraudo Dec 18 '11 at 17:47
Thank you Davide! Does that also hold for the Y^2 case? – DumbQuestion Dec 18 '11 at 17:58
$E[X]=\int_{\Omega}E[X\mid Y]dP=\int_{\Omega}Y^2dP=E[Y^2]$, so these results are true if $X$ is integrable and $Y$ square integrable. – Davide Giraudo Dec 18 '11 at 18:02

We assume that $X$ is integrable and $Y$ is square integrable. The notation $E[X\mid Y=y]=g(y)$ means that $E[X\mid Y]=g(Y)$ (Doob's theorem ensures us it's possible, since $E[X\mid Y]$ is $\sigma(Y)$-measurable.

If $E[X\mid Y=y]=g(y)$, since $\Omega\in\sigma(Y)$, we have $$E[X]=\int_{\Omega}E[X\mid Y]\mathrm{d}\mathbb P=\int_{\Omega}g(Y)\mathrm{d}\mathbb P=E[g(Y)],$$ and applying it to $g(x)=x$ and $g(x)=x^2$, we get your results.

-

Yes, you’re right. Davide gave you a precise and quick answer, I’ll try to elaborate a little bit (edit: when I started, Davide just wrote a comment, his answer was written a moment later).

First, to better understand the conditional expectation concept, you may think to this situation as follows : we first draw the value y of Y, following the law of Y, and then the value x of X, using a law for X which depends on which y was drawn.

I will use discrete notations but for the general case you can just replace everything by fancy integrals. The law of X, given Y = y, the law used to draw a value of X knowing that Y = y, is denoted $P(X = x\ |\ Y = y)$. The conditional expectation $E(X \ |\ Y=y)$ is of course $\sum_x P(X = x\ |\ Y = y)$.

Now turn to the law of X: $P(X = x) = \sum_y P(X=x\ |\ Y=y) P(Y=y)$ (this is simply the formula of total probability). The expectation of X is then $$E(X) = \sum_x x P(X = x) = \sum_x x \left(\sum_y P(X = x\ |\ Y=y) P(Y=y)\right)$$ $${} = \sum_y \left( \sum_x x P(X=x\ |\ Y= y) \right) P(Y=y) = \sum_y E(X\ |\ Y =y) P(Y=y).$$ I hope that this makes the sense of this formula clear.

Know denote $E(X | Y=y) = f(y)$. Then $E(X) =\sum_y f(y) P(Y = y) = E\bigl( f(Y) \bigr)$, which answers your question.

HTH

-
Typo? You wrote The conditional expectation $E(X | Y=y)$ is of course $\sum_x P(X=x | Y=y)$. You must have meant $\sum_x xP(X=x | Y=y)$. – Michael Hardy Dec 18 '11 at 19:10
But then you repeated it: $E(X)=\sum_xP(X=x)$. That's wrong. It should say $E(X)=\sum_x xP(X=x)$. – Michael Hardy Dec 18 '11 at 19:11
I've downvoted for now; I'll rescind that if this gets fixed. – Michael Hardy Dec 18 '11 at 19:12
Oups, of course it’s a typo – I wrote too fast. It’s fixed. – Elvis Dec 18 '11 at 20:45