Suppose $E(Y|X)$ exists. There exists a disturbance term $\epsilon$ such that $Y=E(Y|X)+\epsilon$ where $E(\epsilon|X)=0$.
I have trouble understanding the following simplifying process:
$E(Y-E(Y|X)|X)=E(Y|X)-E(E(Y|X)|X)$.
The second term on RHS simplifies to:
$E(Y|X)$.
Can someone explain this in detail? Thanks.
Note that $E[Y|X]$ is a shorthand for $E[Y|X=x]=g(x)$, so $E(E(Y|X)|X=x)=E(g(X)|X=x))=g(x)$.