IV-RE xtoverid testing both IV validity and RE vs FE? I am running an xtivreg, re and an xtoverid afterwards.
My understanding of the help file and what I found online is that xtoverid basically compares IV-RE with FE (augmented RE). 
The test statistic I get is tiny and therefore p-value massive (0.8 to 0.9).
My plan was to first test for endogeneity and then afterwards test either the RE-IV or RE versus the respective FE or FE-IV. However, the test seems to combine this into one. So does that imply that both the instruments are valid as well as that RE preferable to FE? I find that hard to believe because the FE results differ massively.
 A: The command xtoverid is a test of overidentifying restrictions. When you apply this after xtivreg this is a test for whether your instruments are valid. It does not at the same time whether you should use fixed or random effects but you can use this test also for this purpose but separately. This is because testing fixed versus random effects is similar to testing orthogonality conditions as in the instrumental variables case.
For your problem what you optimally would do is:


*

*compare fixed and random effects using the Hausman test

*for this example say you choose fixed effects; if you are in doubt about endogeneity you can again use the Hausman test to compare fixed effects versus fixed effects with instrumental variables (the instrumental variables regression is consistent whether or not you have an endogeneity problem whilst the usual fixed effects regression is only consistent under exogeneity); use xtoverid afterwards to check whether your instruments are valid

*if they are valid you are done; if they are not valid you need to find a better instrument and then compare fixed effects versus fixed effects with the new instrument. Perhaps you were just rejecting normal fixed effects in step 2 because your first instrument was bad


Here is some code for you to try out:
webuse nlswork
tsset idcode year

// the standard Hausman test (assumes homoscedasticity of the residuals)
xtreg ln_wage tenure age, fe
est store fe

xtreg ln_wage tenure age, re
est store re

hausman fe re, sigmaless

// the test rejects the null that differences in FE and RE are not systematic, so you should use FE

// the xtoverid command is also a Hausman test which you can use without assuming homoscedasticity, e.g. if you want to correct for autocorrelation by clustering on the id variable
xtreg ln_wage tenure age, re cluster(idcode)
xtoverid

// now run the IV fixed effects regression
xtivreg ln_wage age (tenure = south union), fe i(idcode)

// check whether the instruments are valid according to the test
xtoverid

// compare the results with fixed effects; Hausman rejects that the difference between IV fixed effects and fixed effects is not systematic so it's better to use IV (assuming that your instruments are valid)
est store ivfe
hausman ivfe fe

