### Monday, February 20, 2006

## st: RE: ivreg2 with id matrix in stage 1

Dimitryiy,

> -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of > Dimitriy V. Masterov > Sent: 13 February 2006 05:56 > To: statalist@hsphsun2.harvard.edu > Subject: st: ivreg2 with id matrix in stage 1 > > Hello, > > I am trying to use ivreg2 to perform efficient GMM. I would like for > ivreg2 to use the identity matrix as the weighting matrix in > the first step instead of inv(Z'Z). I realize that any > positive definite matrix will yield consistent estimates, but > I was hoping that there would be an undocumented option of > some sort. I'd like to see how sensitive my results are to > different weighting schemes.

Indeed there is an undocumented option for this. If your weighting matrix is called, say, imat, then

ivreg2 ..., wmatrix(imat)

will do at least some of what you want. The number of rows/columns of imat will be the total number of instruments, i.e., all included exogenous regressors and excluded instruments, including the constant.

A word of warning, though - this option was designed to be used internally by ivreg2 as part of the 2nd step of 2-step efficient GMM. As such, not all the output may be correct; for example, the fiddly degrees-of-freedom adjustments may not be handled correctly. Thus I just compared the results of ivreg2 if you supply inv(Z'Z) by hand vs. the results of ivreg2 doing IV on its own, and whereas the coefficients and SEs are correct, the Sargan statistic is wrong. The reason is that, although the standard IV results are invariant to scaling the weighting matrix, the Sargan statistic is not. If, however, you use, not inv(Z'Z), but inv(Z'Z)N/sigma_sq_hat), then you should the correct Sargan stat as well. Perhaps the easiest way to do this is to run ivreg2 twice, once with wmatrix(imat) as the option, and the second time with wmatrix(imat*e(N)/e(rmse)^2) as the option. But more generally - be careful!

Hope this helps.

Cheers, Mark

> > Thank you in advance for your help. > > Dimitriy Masterov > > * > * For searches and help try: > * http://www.stata.com/support/faqs/res/findit.html > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ > >

* * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

Tag: statalist