Let $Y = f(X, W)$ for two discrete random variables $X$ and $W$. If I know $P(Y = y |X=x, W)$, how can I get $$E[Y | X=x]$$.
Is the following correct: $$E[Y|X=x] = \sum _w P(X=x, W=w) * f(x,w)$$
And is this equivalent to (1): $$E[Y|X=x] = E[W=w]*E[Y|X=x, W=w]$$
We have:
$p(y|x)=\sum_w p(y,w|x)=\sum_w p(y|w,x)p(w|x)$
So that:
$E[Y|X=x]=\sum_y y p(y|x)=\sum_w \sum_y y p(y|w,x)p(w|x)$
Since $y$ is a deterministic function of $w$ and $x$, we have $p(y|w,x)=\delta_{y,f(x,w)}$ so that:
$E[Y|X=x]=\sum_w f(x,w)p(w|x)$
so I have a conditional distribution where you have a joint.