I understand that E[X|Y] is a random variable. But I am kind of confused about the following :
$$ \int_{\{Y=y_i\}} E[X|Y] dP = E[X|Y=y_i]P(Y=y_i) $$
In the above, P is a probability measure , then when you integrate the E[X|Y] over the regioan of {Y=yi} , I can write $\int E[X|Y]*I_{(Y=yi)}dP$ , but I still don't see the above. Please explain
Recall that the conditional expectation ${\rm E}[X\mid Y]$ has the property that $$ \int_A {\rm E}[X\mid Y]\,\mathrm dP=\int_A X\,\mathrm dP,\quad A\in\sigma(Y). $$ Since $\{Y=y\}\in \sigma(Y)$ for all $y$, we have $$ \int_{\{Y=y\}}{\rm E}[X\mid Y]\,\mathrm dP=\int_{\{Y=y\}}X\,\mathrm dP=\int_\Omega X\mathbf{1}_{\{Y=y\}}\,\mathrm dP. $$ At last, recall that if $A\subseteq \Omega$ with $P(A)>0$, then the conditional expectation given $A$ is given by $$ {\rm E}[X\mid A]=\frac{1}{P(A)}\int_{\Omega}X\mathbf{1}_A\,\mathrm dP. $$ Use this with $A=\{Y=y\}$ to conclude.