* do-file accompanying "Instrumental variables and GMM: * Estimation and testing", CF Baum, ME Schaffer, S Stillman * 29 Oct 2002 * This do-file illustrates usage of the four Stata commands * described in the article: * ivreg2 extended ivreg * ivhettest heteroskedasticity tests in IV context * overid overidentification tests * ivendog tests for endogenity of IV regressors * reproduce Hayashi, Econometrics, IV and GMM results * Hayashi Table 3.3 p.255 uses Blackburn-Neumark sample use http://fmwww.bc.edu/ec-p/data/hayashi/griliches76.dta,clear summarize xi i.year * line 4 of table via Stata's standard ivreg ivreg lw expr tenure rns smsa _I* (iq s = med kww mrt age) * line 4 of table via ivreg2, small ivreg2 lw expr tenure rns smsa _I* (iq s = med kww mrt age) , small * ivreg2 with asymptotic standard errors ivreg2 lw expr tenure rns smsa _I* (iq s = med kww mrt age) * robust option: Sargan statistic changes to Hansen J ivreg2 lw expr tenure rns smsa _I* (iq s = med kww mrt age) , robust small * GMM option: reproduce line 5 of table ivreg2 lw expr tenure rns smsa _I* (iq s = med kww mrt age), gmm * orthog option ("Diff-Sargan" C statistic) * test H0: rns is a proper instrument ivreg2 lw expr tenure rns smsa _I* (iq s = med kww mrt age), orthog(rns) * test H0: kww is a proper instrument ivreg2 lw expr tenure rns smsa _I* (iq s = med kww mrt age), orthog(kww) * cannot test a set of instruments that would unidentify the equation ivreg2 lw expr tenure rns smsa _I* (iq s = med kww mrt age), orthog(kww mrt) * cluster option: must reduce number of instruments below number of clusters * in order to calculate the variance-covariance matrix * (although standard ivreg does not impose that constraint) ivreg2 lw expr tenure rns smsa _I* (iq s = med kww mrt age), robust cluster(age) ivreg lw expr tenure rns smsa (iq s = med kww mrt age) , robust cluster(age) ivreg2 lw expr tenure rns smsa (iq s = med kww mrt age) , small robust cluster(age) * first and ffirst options ivreg2 lw expr tenure rns smsa _I* (iq s = med kww mrt age) , ffirst ivreg2 lw expr tenure rns smsa _I* (iq s = med kww mrt age) , first * heteroskedasticity tests ivhettest, all * hypothesize that heteroskedasticity is only related to these factors ivhettest expr tenure rns smsa * endogeneity tests: * test H0: all endogenous regressors may be considered exogenous ivendog * test H0:iq may be considered exogenous ivendog iq * test H0: s may be considered exogenous ivendog s * overidentification test: in this case ivreg and overid should * produce the same Sargan statistic as did ivreg2 ivreg2 ivreg lw expr tenure rns smsa _I* (iq s = med kww mrt age) overid, all