Conditional Expectation

If fX|Y(x|y) is the conditional probability distribution/density function of X given Y=y at x, the conditional expectation of g(X) given Y=y is

E[g(X)|Y=y]=xg(x)fX|Y(x|y) or if continuous:E[g(X)|Y=y]=g(x)fX|Y(x|y)

Letting g(X)=X, the conditional mean of X given Y=y is

E(X|Y=y)=xxfX|Y(x|y)E(X|Y=y)=xfX|Y(x|y)dx

and the second moment:

E(X2|Y=y)=xx2fX|Y(x|y)E(X2|Y=y)=x2fX|Ydx

The conditional variance of X given Y=y is

Var(X|Y=y)=E(X2|Y=y)[E(X|Y=y)]2