Can somebody tell me whether the following R code (for econometrics endogenous variables) is for a Hausman test, a Nakamura test, or some other test?


test    <- lm(LWAGE ~ EDUC+EXPER+EXPERSQ+SMSA+SOUTH +residuals(etudes1))
  • $\begingroup$ This is a two-stage least squares (2SLS) model. After you find the endogenous variables in your formula, you should use this model instead of an OLS model. $\endgroup$
    – Deng
    Jul 16, 2019 at 19:23

2 Answers 2


What you have written looks like it could be the Hausman test, if $lwage$ was your main outcome of interest, $educ$ is your potentially endogenous predictor, and $feduc$ and $meduc$ are exogenous instruments (I'm not an R user, but that's what I gathered from your code, at least).

To recap, the Hausman test for endogeneity is carried out in two steps. Given the model you are trying to estimate:

$y_i =\beta_0 + \beta_1x_i + Z\beta + u_i$


  • $y_i$ = main outcome of interest
  • and $x_i$ = endogenous predictor of interest
  • and $Z$ = a vector of exogenous predictors

First, regress $x_i$ on $Z$ and our instrument(s) (let's call it $I$) and save $\hat\nu_i$:

$x_i =\pi_0 + \pi_1I_i + Z\pi + \nu_i$

Because $Z$ and $I$ are exogenous (uncorrelated with $u_i$), it stands to reason that $x_i$ is uncorrelated with $u_i$ IFF $\nu_i$ is uncorrelated with $u_i$ (our main predictor of interest $x_i$ is exogoneous if and only if the two error terms are uncorrelated). Therefore, we need to formally test whether these two error terms are correlated.

Second, run the Hausman test by regressing $y_i$ on $x_i$, $Z$, and $\hat\nu_i$:

$y_i =\beta_0 + \beta_1x_i + Z\beta + \delta\hat\nu_i + error$

For this test $H_0: \delta=0$. If the coefficient on $\hat\nu_i$--that is, $\delta$--is significant, we can conclude that $x_i$ was in fact endogenous because the two error terms were, in fact, correlated.

I imagine most statistical packages today have the Hausman test for endogeneity built-in. What I have provided above is what used to be done manually "back in the day."

Source: Wooldridge, J. 2003. Introductory Econometrics: A Modern Approach. 2nd ed. New York: Thomson Learning


Your code does not provide the Hausman test for endogneity. The hausman.systemfit() from the systemfit package in R should do the trick.

Hope that helps.


  • $\begingroup$ Do you know what kind of test it is? (I think that might help the OP.) $\endgroup$ Jun 6, 2013 at 15:14
  • 1
    $\begingroup$ +1, I think it would help the OP if you would put some of that into your answer & unpack it a little bit. Eg: how what is posted differs from the logic of (say) the Hausman test, etc., whether this test is likely to be useful / accurate, etc. $\endgroup$ Jun 6, 2013 at 15:29
  • $\begingroup$ Thanks for your answer. In a next question I will post in a few minutes I will complete. $\endgroup$ Jun 6, 2013 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.