The code Arne supplies is an example of how to get the answer
requested by Paolo, but that answer is still incorrect. Just run that
code (including the variable s in both first and second stages, since
I think its omission was an oversight) to get:
. qui use http://fmwww.bc.edu/ec-p/data/hayashi/griliches76.dta, clear
. qui regress iq med kww s expr tenure rns smsa
. qui predict double iq_hat
. gen double intact = iq_hat*expr
. qui regress lw iq_hat intact s expr tenure rns smsa
. replace iq_hat = iq
. qui replace intact = iq*expr
. predict double res, residual
. gen double res2 = res^2
. qui sum res2
. scalar iv_mse = r(mean)*r(N)/e(df_r)
. matrix b = e(b)
. matrix V = e(V)*(iv_mse/e(rmse)^2)
. ereturn post b V
. ereturn display
------------------------------------------------------------------------------
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
iq_hat | .0151927 .0061657 2.46 0.014 .0031081 .0272772
intact | -.0005875 .0008488 -0.69 0.489 -.0022512 .0010762
s | .0595681 .0188307 3.16 0.002 .0226605 .0964757
expr | .1018824 .0848968 1.20 0.230 -.0645121 .268277
tenure | .0295226 .0085698 3.44 0.001 .0127262 .046319
rns | -.0440594 .0349568 -1.26 0.208 -.1125736 .0244547
smsa | .1269817 .0301617 4.21 0.000 .0678657 .1860976
_cons | 3.104997 .4183089 7.42 0.000 2.285127 3.924868
------------------------------------------------------------------------------
and then compare to the IV estimate:
. ivreg lw s expr tenure rns smsa (iq inta=kww med)
------------------------------------------------------------------------------
lw | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
iq | .1019604 .7498967 0.14 0.892 -1.370186 1.574107
intact | -.031272 .2663122 -0.12 0.907 -.554078 .4915341
s | -.0457328 .9088715 -0.05 0.960 -1.829968 1.738502
expr | 3.17964 26.70891 0.12 0.905 -49.25347 55.61275
tenure | .0273913 .0324433 0.84 0.399 -.0362991 .0910818
rns | -.0274002 .1739247 -0.16 0.875 -.3688374 .314037
smsa | -.0344371 1.379771 -0.02 0.980 -2.743109 2.674235
_cons | -4.338579 64.363 -0.07 0.946 -130.6916 122.0145
------------------------------------------------------------------------------
Note particularly the SEs and p-values on the two endog vars.
I believe this impulse to "plug in" y2hat in various incorrect ways
comes from conceiving of the IV estimator as a two-step estimator,
which it is not. The better two-step estimator analogy uses the
control function approach, IMHO, since folks are less likely to apply
it incorrectly in a nonlinear second stage, or to square or interact
y2hat.
Arne, do you concur?
On 3/23/06, Arne Risa Hole <[email protected]> wrote:
> I suppose an alternative approach would be to do something like this:
>
> use http://fmwww.bc.edu/ec-p/data/hayashi/griliches76.dta, clear
> qui regress iq med kww expr tenure rns smsa
> predict double iq_hat
> gen double intact = iq_hat*expr
> qui regress lw iq_hat intact s expr tenure rns smsa
> replace iq_hat = iq
> replace intact = iq*expr
> predict double res, residual
> gen double res2 = res^2
> qui sum res2
> scalar iv_mse = r(mean)*r(N)/e(df_r)
> matrix b = e(b)
> matrix V = e(V)*(iv_mse/e(rmse)^2)
> ereturn post b V
> ereturn display
>
> i.e. get the forecast y2hat (iq_hat in the example) from the
> first-stage regression and interact this with the exogenous RHS var x1
> (expr in the example). Then you replace the interaction with y2*x1
> before calculating the residuals/MSE.
>
> Austin's suggestion is probably the better one though, but this seems
> to me to be ok.
>
> Cheers
> Arne
>
> On 23/03/06, Austin Nichols <[email protected]> wrote:
> > If your endog RHS var y2 is interacted with an exog RHS var x1, then
> > you have a "new" endog RHS var y2x1, and you may need additional
> > excluded instruments. Use -ivreg- as suggested.
*
* 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/