I'm currently trying to re-teach myself some econometrics (last studied about 10 years ago) by reading Causal Inference, the mixtape and the classic Mostly Harmless Econometrics.
I'm currently running through the three arguments as to why we should think that linear regression is a sensible thing to do. The first of these is presented, in both texts, as the Linear Conditional Expectation Function (CEF) theorem.
The Linear CEF theorem states that if the CEF is linear, then it is the same as the population regression.
The proof runs as follows:
First lets assume that the CEF is linear, so that we have $E(y_i\vert X)=\beta^* X_i$.
The proof the asks us to recall that by the CEF decomposition we have: $$E(X_i(y_i-E(y_i\vert X_i)))=E(X_i(y_i-\beta^*X_i))=0$$
My question is, where does this last line come from? As far as I'm concerned the CEF decomposition tells us that we have $y_i=E(y_i\vert X_i) + \epsilon_i$, where $\epsilon_i$ is mean independent of $X_i$ and uncorrelated with any function of $X_i$.
I'm really not clear how that gives us the second line of the above proof.