# Testing for Endogeneity

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$?

• Post your question to stats.stackexchange.com – london Dec 19 '17 at 18:13
• @london This question is on topic and welcome here. Both sites are valid homes for a question like this. economics.stackexchange.com/help/on-topic – jmbejara Dec 19 '17 at 19:32
• @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 Dec 20 '17 at 13:09
• Cross-posted at CV. – Dimitriy V. Masterov Dec 20 '17 at 21:06

(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.

• 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 Dec 21 '17 at 9:35
• Well I’m curious myself. I’ll have a look when I have more time. Please let me know if you find it. – chan1142 Dec 21 '17 at 9:47
• I did - see my reply to my own post – bbecon Jan 26 '18 at 2:52

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)