Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re:


From   "Arne Risa Hole" <arnehole@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Re:
Date   Thu, 23 Mar 2006 12:20:26 +0000

Hi Paolo,

You can try the following code:

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
qui regress s med kww expr tenure rns smsa
predict double s_hat
qui regress lw iq_hat s_hat expr tenure rns smsa
replace iq_hat = iq
replace s_hat = s
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

This replicates:

ivreg lw expr tenure rns smsa (iq s=med kww)

If you want to remove some of the instruments simply drop them from
the first stage regressions. Note that not using all the exogenous
variables as instruments is probably not a good idea - see
http://www.stata.com/support/faqs/stat/ivreg.html.

Cheers,
Arne

On 23/03/06, Paolo Caruso <P.Caruso@warwick.ac.uk> wrote:
> This is a question with regards to IV's.
>
> I am using STATA in order to do a 2SLS. STATA does not allow you to specify which variables to include or not include in the first stage. This means that I have to complete the regression in the separate two stages.
>
> I know how to adjust the MSE when I have one variable that I want to instrument, however, I do not know how to do it when I have more than one.
>
> The command lines in stata to adjust the MSE for one variable are as follows:
> regress d7unit variable list instrument(s)
> predict double d7unithat
> regress loginc variable list d7unithat
> rename d7unithat d7unithold
> rename d7unit d7unithat
> predict double res, residual
> rename d7unithat d7unit
> rename d7unithold d7unithat
> replace res = res^2
> summarize res
> scalar realmse = r(mean)*r(N)/e(df_r)
> matrix bmatrix = e(b)
> matrix Vmatrix = e(v)
> matrix Vmatrix = e(v)* realmse / e(rmse)^2
> ereturn post bmatrix Vmatrix, noclear
> ereturn display
>
> where d7unit is the variable that I want to instrument and loginc is the dependant variable.
>
> I would also like to instrument d7unit^2 and this is where I am unsure what the relevant command lines would be in order to ensure that the correct MSE is used.
>
> Any help would be much appreciated.
>
> Regards,
>
> Paolo
>
> *
> *   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/



© Copyright 1996–2020 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index