Assume we have a DGP of the form
$y = \beta_0 + \beta_1 * x_1 + \beta_2 * x_2 + \beta_3 * x_3 + \epsilon$
where $\epsilon$ is a standard i.i.d. error term. Does residualizing $y$ using a linear regression including only an intercept, $x_1$ and $x_2$ and regressing the resulting residuals on $x_3$ give us the same estimate for the coefficient of $x_3$ as in the full specification?
More formally, if you estimate the model in a two step procedure of the form
$y = \bar{\beta_0} + \bar{\beta_1} * x_1 + \bar{\beta_2} * x_2 + \eta$
$\hat{\eta} = \bar{\beta_3} * x_3 + \xi$
where $\eta$ and $\xi$ are error terms and $\hat{\eta}$ are the estimated residuals from the first regression, is it proven that $\bar{\beta_3}$ and $\beta_3$ will be the same?
If I simulate a model in R, it seems to work flawlessly. However, I have a problem when trying to replicate the two step procedure with a real dataset. Now I'm not sure whether I made a coding error or whether this two step procedure is wrong.
Simulation Code
x1 <- rnorm(1000)
x2 <- rnorm(1000)
x3 <- rnorm(1000)
y <- 4 + 3*x1 - 2*x2 + 22*x3 + rnorm(1000)
res <- resid(lm(y~x1+x2))
summary(lm(res~x3-1))