Does random sampling cause zero conditional mean? In the lecture notes of my development economics class, it says that
&quot; In the regression model : Yi = β0 + β1Xi + ui,
if Xi is randomly assigned, then Xi
is independent of ui, i.e., E(ui|Xi) = 0, so OLS yields an unbiased estimator of β1.&quot;
And the professor says the same thing in his lecture recording.
I really don't understand this statement, because in econometrics (linear regression part)
I thought random sampling and zero conditional mean (E(ui|Xi) = 0) were two separate assumptions which led to the OLS unbiased estimator theory, not one affecting the other.
But the lecture note is saying that random sampling causes zero conditional mean, instead of my
previous notion that the two are separate assumptions which are used together to derive the unbiasedness.
Is the lecture note correct in that random sampling actually causes zero conditional mean? If it is, could anyone explain to me why this is the case instead of them being two separate assumptions as stated in a
standard econometrics textbook?
random sampling causes the sample Xis to be iid but that still doesn't have anything to do with ui, and I thought that was why the additional assumption of zero conditional mean was added to ensure the unbiasedness of the OLS. I would appreciate it if someone could tell me what the lecture note is trying to say here.
The $E(u_i|X_i) = 0$ can hold even without having simple random sample or random assignment. However, random assignment guarantees this will hold (in expectations). A violation of $E(u_i|X_i) \neq 0$ is typically consequence of omitted variable bias. For example, in regression of education on wages reason why $E(u_i|X_i) \neq 0$ can be that experience also affects wages and if people with different education have different experience this will result in $E(u_i|X_i) \neq 0$.
Random assignment of $X$ solves this issue. For example, lets consider $X_i$ to be treatment status $X_i = \{0,1\}$ following Angrist and Pischke Mostly Harmless Econometrics. Now let $Y_{i}$ be potential outcome based on $X_i$ so that we have:
$$ Y_i \begin{cases}
Y_{1i} \text{ if } X_i=1 \\[2ex] 
Y_{0i} \text{ if } X_i=0
\end{cases} $$
As a consequence observed outcomes will be given by:
$$Y_{i} = \underbrace{Y_{0i}}_{\beta_0 } + \underbrace{(Y_{1i}-Y_{0i})}_{\beta_1}X_i\tag{1} $$
Now the above in expectation notation implies that:
$$\underbrace{E[Y_i | X_i = 1] - E[Y_i | X_i = 0]}_{\text{observed difference}} = \underbrace{E[Y_{1i} | X_{i} = 1] - E[Y_{0i} | X_i = 0]}_{\text{Average treatment Effect on Treated}} + \underbrace{E[Y_{0i} | X_{i} = 1] - E[Y_{0i} | X_i = 0]}_{\text{Selection Bias}} \tag{2}$$
Presence of selection bias would cause $E(u_i|X_i) \neq 0$.
However, note if we use random assignment of $X_i$ it eliminates the problem as it makes  $X_i$ independent of potential outcomes. If they are independent then $E[Y_{0i} | X_i = 1] = E[Y_{0i} | X_i = 1]$. Substituting this back to the 2 we get:
$$E[Y_i | X_i = 1] - E[Y_i | X_i = 1]= E[Y_{1i} | X_{i} = 1] - E[Y_{0i} | X_i = 1] \\ 
= E[Y_{1i}- Y_{0i}  | X_{i} = 1] \\ = E[Y_{1i}- Y_{0i}] .$$
This eliminates selection bias and ensures $E(u_i|X_i) = 0$ (although note random assignment is no silver bullet,  there could be various different issues that are still).