<p>Let <span class="math-container">$X_1$</span> be the <span class="math-container">$(n \times k_1)$</span> matrix for the endogenous variables and <span class="math-container">$X_2$</span> the exogenous <span class="math-container">$(n \times k_2)$</span> matrix for the additional exogenous variables.</p>
<p>Then the residuals from regressing <span class="math-container">$X_1$</span> on <span class="math-container">$X_2$</span> is given by:
<span class="math-container">$$
M_{X_2} X_1,
$$</span>
where
<span class="math-container">$$
M_{X_2} = (I - X_2(X_2'X_2)^{-1}X_2'))
$$</span>
Where <span class="math-container">$I$</span> is the identity matrix.</p>
<p>So you replace <span class="math-container">$X_1$</span> by <span class="math-container">$M_{X_2}X_1$</span> in the regression.</p>
<p>Alternatively, you can regress every variable in <span class="math-container">$X_1$</span> on all the variables in <span class="math-container">$X_2$</span> (i.e. running <span class="math-container">$k_1$</span> regressions). Then take the residuals of these regressions in the second stage.</p>

CC BY-SA 4.0
2023-07-25T09:19:52.767Z
2023-07-25T09:19:52.767Z
tdm
<p>I am conducting IV Regression and to make sure that my instrument is not weak, I want to use Montiel Olea &amp; Pflueger (2013) robustness test. (see: <a href="https://www.tandfonline.com/doi/abs/10.1080/00401706.2013.806694" rel="nofollow noreferrer">Paper by Montiel Olea &amp; Plueger (2013)</a> ).
To do so, you need their stata ado &quot;weakivtest&quot;, which is an post-regression command. However, in their paper they specify 4 steps how to conduct this test (without stata ado). The first steps says the following: <em>If there are additional exogenous regressors, replace all variables by their projection residuals onto those exogenous regressors. Normalize instruments to be orthonormal.</em> (see Montiel Olea &amp; Pflueger, 2013: p.360).</p>
<p>How do I do that? Do I have to run a regression and simply use the residuals? Which regression to run: first stage or second stage or...? Or don't I need to do any of this because the stata ado takes care about it? (note that normalizing my instrument is not a problem).</p>
<p>Thank you very much!</p>

<applied-econometrics><stata><instrumental-variable>
What does it mean to "replace all variables with the residuals after projections on any additional exogenous regressors"
Susn
# What does it mean to "replace all variables with the residuals after projections on any additional exogenous regressors"

(Asked by: username_0 on 2023-05-23)

I am conducting IV Regression and to make sure that my instrument is not weak, I want to use Montiel Olea & Pflueger (2013) robustness test. (see: [Paper by Montiel Olea & Plueger (2013)](https://www.tandfonline.com/doi/abs/10.1080/00401706.2013.806694) ).
To do so, you need their stata ado "weakivtest", which is an post-regression command. However, in their paper they specify 4 steps how to conduct this test (without stata ado). The first steps says the following: *If there are additional exogenous regressors, replace all variables by their projection residuals onto those exogenous regressors. Normalize instruments to be orthonormal.* (see Montiel Olea & Pflueger, 2013: p.360).

How do I do that? Do I have to run a regression and simply use the residuals? Which regression to run: first stage or second stage or...? Or don't I need to do any of this because the stata ado takes care about it? (note that normalizing my instrument is not a problem).

Thank you very much!

**Tags:** applied-econometrics, stata, instrumental-variable


---

## 1 answers

### Answer by username_1 on 2023-07-25. Score: 1

Let $X\_1$ be the $(n \times k\_1)$ matrix for the endogenous variables and $X\_2$ the exogenous $(n \times k\_2)$ matrix for the additional exogenous variables.

Then the residuals from regressing $X\_1$ on $X\_2$ is given by:
$$
M\_{X\_2} X\_1,
$$
where
$$
M\_{X\_2} = (I - X\_2(X\_2'X\_2)^{-1}X\_2'))
$$
Where $I$ is the identity matrix.

So you replace $X\_1$ by $M\_{X\_2}X\_1$ in the regression.

Alternatively, you can regress every variable in $X\_1$ on all the variables in $X\_2$ (i.e. running $k\_1$ regressions). Then take the residuals of these regressions in the second stage.


---

