# Derivation of the effect of unmodeled confounders on OLS estimates

I'd like to see how not adjusting for confounders affects estimated coefficients in linear regression. Here is what my lecture notes say:

1. Un-adjusted model: $E[Yi] = \beta_0 + \beta_1X_i$
2. Adjusted model: $\quad\ E[Yi] = \gamma_0 + \gamma_1X_i + \gamma_2W$, where $W$ is the confounder.

Let $\hat{\beta_1}$ be the OLS estimate of $\beta_1$. Then under the adjusted model we have:

$$E[\hat{\beta_1}] = \gamma_1 + r_{XW}\sqrt{\frac{{\rm var}(W)}{{\rm var}(X)}}\gamma_2$$

How $E[\hat{\beta_1}]$ was calculated?

I donâ€™t know where you got this last expression from but the derivation of the omitted variable bias formula goes as follows. You want to regress the long regression equation that includes both $X_i$ and $W_i$ but for some reason you do not observe $W_i$. Then your model becomes: \begin{align} y_i &= \alpha + \beta X_i + \gamma W_i + e_i \newline &= \alpha + \beta X_i + u_i \end{align} where $u_i = \gamma W_i + e_i$ and $e_i$ are error terms, with ${\rm Cov}(X_i, e_i ) = 0$. By the Frisch-Waugh theorem, the estimate of $\beta$ will be: \begin{align} \widehat{\beta} &= \frac{{\rm Cov}(y_i, X_i)}{{\rm Var}(X_i)} \newline \ \newline &= \frac{{\rm Cov}(\alpha + \beta X_i + u_i , X_i)}{{\rm Var}(X_i)} \newline \ \newline &= \beta + \frac{{\rm Cov}(u_i, X_i)}{{\rm Var}(X_i)} \newline \ \newline &= \beta + \frac{{\rm Cov}(\gamma W_i + e_i, X_i)}{{\rm Var}(X_i)} \newline \ \newline &= \beta + \gamma \frac{{\rm Cov}(W_i, X_i)}{{\rm Var}(X_i)} \newline \end{align} In the second line replace $y_i = \alpha + \beta X_i + u_i$. In the third line, the covariance was split into the sum of covariances where ${\rm Cov}(\alpha , X_i) = 0$ because the intercept is a constant, and ${\rm Cov}(\beta X_i, X_i) = \beta {\rm Var}(X_i)$. In the fourth line, use the fact that $u_i = \gamma W_i + e_i$ and ${\rm Cov}(e_i, X_i) = 0$ in the last line. This yields the result.
If in the long regression $\gamma = 0$ (i.e., not significantly different from zero) or if ${\rm Cov}(W_i, X_i) = 0$, omitting $W_i$ is not a problem. You can see this from the last expression that was derived here. Otherwise your coefficient of $X_i$ will be biased. Reasoning about the sign of $\gamma$ whether ${\rm Cov}(W_i, X_i)$ is positive or negative, you can have an idea about the direction of the bias and sometimes even about the magnitude.