conditional expectation function and residuals Im struggling to understand the relationsship of the conditional expectation function and the residuals. Im readings mostly harmless econometrics, and in theorem 3.1.1 (i) they prove that E (e I X) is 0, see here: http://econ.lse.ac.uk/staff/spischke/mhe/ex_ch3.pdf
However, later in the book they claim this is only true when the CEF is linear, but not in the more general case. The proof they give, however, seems to pertain to all CEF. Can somebody help me?
 A: It would be good to acquire the habit of reserving the word "residuals" for the estimated magnitude  of the "error" from, say, a regression.  
Now, when in the relation
$$y = m(x) + e$$
we define $m(x)\equiv E(y \mid x)$, then $e$ is the Conditional Expectation Funtion error, which has nothing to do with the usuall "error term" we are talking about in a standard "classical" regression setting. The CEF error is actually and exactly "what is left" after we subtract from $y$ its conditional expectation with respect to $x$.
Then, by construction
$$y = E(y\mid x) + e \implies E(y\mid x) = E[E(y\mid x) \mid x] + E(e\mid x)$$
But by basic properties of the Conditional expectation, $E[E(y\mid x) \mid x] = E(y\mid x)$$ and so we obtain 
$$E(y\mid x) = E(y\mid x) + E(e\mid x) \implies E(e\mid x) = 0$$
Always. No matter what functional form does $m(x)$, linear or non-linear. 
Reading the OP's comment, what I suspect the authors of the book say "later on" essentially confounds the classical linear regression set up with the Conditional Expectation Function set up, as well as the error term in the classical linear regression model, with the CEF error.
