<p>(i) I think your idea makes sense. Under the null, $[X,Z]$ is orthogonal to $\varepsilon$. Under the alternative, $X$ is correlated with $\varepsilon$. (ii) Your statement that it's "basically a test of whether the OLS residual are orthogonal to $Z$" is exactly what I think. (iii) Your thought about the power depending on the relevance of $Z$ also makes sense. If $Z$ is irrelevant, then the moment restrictions $E[Z_i' (y_i - \alpha - X_i \beta)] = 0$ hold for any $\beta$ (due to the uncorrelatedness of $Z_i$ and $X_i$) so the OLS residuals should appear to be uncorrelated with the instruments although the OLS estimator is inconsistent. I think this test is closely related with standard methods explained below, although I have not done any derivation in this regard.</p>

<p>(iv) As you would be aware, there are textbook methods to test endogeneity. Stata implements some. See <code>help ivregress postestimation</code>. You will see <code>estat endogenous</code> there. There, for the 2SLS estimation, OLS and 2SLS can be compared; or $y$ is regressed on $[X,\hat{\eta}]$, after which the statistical significance of $\hat\eta$ is tested.</p>

CC BY-SA 3.0
2017-12-21T09:35:22.317Z
Thanks. Regarding the textbook methods you mentioned - is the Sargan/Hansen test I suggested equivalent to a Wu-Hausman test? Yes/no? If no, what is the difference?
bbecon
CC BY-SA 3.0
2017-12-21T09:47:49.517Z
Well I’m curious myself. I’ll have a look when I have more time. Please let me know if you find it.
chan1142
CC BY-SA 3.0
2018-01-26T02:52:49.833Z
I did - see my reply to my own post
bbecon
CC BY-SA 3.0
2017-12-21T05:03:16.040Z
2017-12-21T05:03:16.040Z
chan1142
<p>I looked a bit more into this and I think I found the confirmation of my suspicion into this article, which describes the command ivreg2 in STATA.
I am not a super-techy econometrician but from my understanding it can apparently be done using the orthog() option, and under certain conditions it is equivalent to a Hausman test.</p>

<p><a href="http://www.stata-journal.com/sjpdf.html?articlenum=st0030_3" rel="nofollow noreferrer">http://www.stata-journal.com/sjpdf.html?articlenum=st0030_3</a></p>

<p>One advantage of doing the test as a Sargan test, which turned out useful for my work, is that, if you implement the model yourself in STATA using the GMM engine you can perform it even when you have fewer instruments than endogenous variables (that's because you're performing the test under the null that the supposedly-endogenous variable are actually exogenous)</p>

CC BY-SA 3.0
2018-01-26T02:51:32.297Z
2018-01-26T02:51:32.297Z
bbecon
<p>I apologize if this question is very basic. I have the following plain vanilla Instrumental Variable model. </p>

<p>$Y=\alpha+X\beta+\varepsilon$</p>

<p>$X=\delta+Z\gamma+\eta$</p>

<p>$\varepsilon\perp\eta,\quad Z\perp\eta \quad$ true</p>

<p>I am interested in testing $\varepsilon\perp X$, that is, whether X is a valid instrument for the first equation (very informally stated, one might say I want to test whether $X$ is exogenous, or whether I need to instrument $X$ with $Z$)</p>

<p>My idea is: estimate the IV model using 2SLS or GMM, using both $X$ and $Z$ as instruments, and then perform a Sargan/Hansen test. My guess is that the test's power will depend on how strongly $Z$ predictx $X$ (that is, on how relevant of an instrument $Z$ is for $X$). In 2SLS, the first stage will fit perfectly and the test will be basically a test of whether the OLS residual are orthogonal to $Z$. Is this reasoning correct? Is the Sargan/Hansen test a valid test for $
\varepsilon\perp X$?</p>

CC BY-SA 3.0
2017-12-19T18:13:04.373Z
Post your question to https://stats.stackexchange.com/
london
CC BY-SA 3.0
2017-12-19T19:32:08.327Z
@london This question is on topic and welcome here. Both sites are valid homes for a question like this. https://economics.stackexchange.com/help/on-topic
jmbejara
CC BY-SA 3.0
2017-12-20T13:09:05.277Z
@jmbejara, I thought the OP would get quick answer to his question from econometricians there. I am not saying the questio nis non-topic.
london
CC BY-SA 3.0
2017-12-20T21:06:44.677Z
Cross-posted [at CV](https://stats.stackexchange.com/questions/319698/instrumental-variables-testing-for-endogeneity).
dimitriy
<econometrics><regression><instrumental-variable><endogeneity>
Testing for Endogeneity
bbecon
# Testing for Endogeneity

(Asked by: username_0 on 2017-12-19)

I apologize if this question is very basic. I have the following plain vanilla Instrumental Variable model.

$Y=\alpha+X\beta+\varepsilon$

$X=\delta+Z\gamma+\eta$

$\varepsilon\perp\eta,\quad Z\perp\eta \quad$ true

I am interested in testing $\varepsilon\perp X$, that is, whether X is a valid instrument for the first equation (very informally stated, one might say I want to test whether $X$ is exogenous, or whether I need to instrument $X$ with $Z$)

My idea is: estimate the IV model using 2SLS or GMM, using both $X$ and $Z$ as instruments, and then perform a Sargan/Hansen test. My guess is that the test's power will depend on how strongly $Z$ predictx $X$ (that is, on how relevant of an instrument $Z$ is for $X$). In 2SLS, the first stage will fit perfectly and the test will be basically a test of whether the OLS residual are orthogonal to $Z$. Is this reasoning correct? Is the Sargan/Hansen test a valid test for $
\varepsilon\perp X$?

**Tags:** econometrics, regression, instrumental-variable, endogeneity
> **Comments:**
> **username_1**: Post your question to https://stats.stackexchange.com/  
> **username_2**: @london This question is on topic and welcome here. Both sites are valid homes for a question like this. https://economics.stackexchange.com/help/on-topic  
> **username_1**: @jmbejara, I thought the OP would get quick answer to his question from econometricians there. I am not saying the questio nis non-topic.  
> **username_3**: Cross-posted [at CV](https://stats.stackexchange.com/questions/319698/instrumental-variables-testing-for-endogeneity).  

---

## 2 answers

### Answer by username_4 on 2017-12-21. Score: 1 | Accepted answer

(i) I think your idea makes sense. Under the null, $[X,Z]$ is orthogonal to $\varepsilon$. Under the alternative, $X$ is correlated with $\varepsilon$. (ii) Your statement that it's "basically a test of whether the OLS residual are orthogonal to $Z$" is exactly what I think. (iii) Your thought about the power depending on the relevance of $Z$ also makes sense. If $Z$ is irrelevant, then the moment restrictions $E[Z\_i' (y\_i - \alpha - X\_i \beta)] = 0$ hold for any $\beta$ (due to the uncorrelatedness of $Z\_i$ and $X\_i$) so the OLS residuals should appear to be uncorrelated with the instruments although the OLS estimator is inconsistent. I think this test is closely related with standard methods explained below, although I have not done any derivation in this regard.

(iv) As you would be aware, there are textbook methods to test endogeneity. Stata implements some. See `help ivregress postestimation`. You will see `estat endogenous` there. There, for the 2SLS estimation, OLS and 2SLS can be compared; or $y$ is regressed on $[X,\hat{\eta}]$, after which the statistical significance of $\hat\eta$ is tested.

> **Comments:**
> **username_0**: Thanks. Regarding the textbook methods you mentioned - is the Sargan/Hansen test I suggested equivalent to a Wu-Hausman test? Yes/no? If no, what is the difference?  
> **username_4**: Well I’m curious myself. I’ll have a look when I have more time. Please let me know if you find it.  
> **username_0**: I did - see my reply to my own post  

---

### Answer by username_0 on 2018-01-26. Score: 1

I looked a bit more into this and I think I found the confirmation of my suspicion into this article, which describes the command ivreg2 in STATA.
I am not a super-techy econometrician but from my understanding it can apparently be done using the orthog() option, and under certain conditions it is equivalent to a Hausman test.

<http://www.stata-journal.com/sjpdf.html?articlenum=st0030_3>

One advantage of doing the test as a Sargan test, which turned out useful for my work, is that, if you implement the model yourself in STATA using the GMM engine you can perform it even when you have fewer instruments than endogenous variables (that's because you're performing the test under the null that the supposedly-endogenous variable are actually exogenous)


---

