Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: bootstrap coefficient vector from 2SLS IV regression


From   Daniella Perlroth <dperl@stanford.edu>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: bootstrap coefficient vector from 2SLS IV regression
Date   Tue, 24 Nov 2009 14:49:51 -0800

I'm having trouble bootstrapping standard errors of a coefficient vector from a 2SLS regression, where the first stage is mlogit with 5 instrumental variables, put into a second stage linear regression equation.  The code goes like this:

        capture program drop proca_reg
        program define proca_reg, eclass

                tempvar p1 p2 p3 p4 p5  *the instrumental variables
                tempname coefs

                mlogit treatment age age65plus northeast midwest west year hhinc99 married urban preyear_exp_def ncicombined_index urologypop3d radoncpop3d imrtpop brachypop           *1st stage

                predict `p1', outcome(1)     *predicted values for instrumental variables
                predict `p2', outcome(2)
                predict `p3', outcome(3)
                predict `p4', outcome(4)
                predict `p5', outcome(5)

                regress totyear1_2_exp_def `p1' `p2' `p3' `p4' `p5' age age65plus northeast midwest west year hhinc99 married urban preyear_exp_def ncicombined_index   *2nd stage

                mat def `coefs' = e(b)
                ereturn post `coefs'
                ereturn local cmd = "bootstrap"
end

bootstrap "proca_reg" _b                *bootstrap coefficients coming from the above program

When I used the above code for the first run, I got coefficients for ALL variables but I only got the bootstrapped standard errors for the regressors that are NOT the instrumental variables.  It wouldn't bootstrap standard errors for coefficients for p1, p2, p3, p4, p5.  The STATA error code says something about missing observations or values.
**Does anyone know what is going on here?  Or better yet, how to fix this?

Also, when I repeated the code, it won't generate anything, it stops staying "_000006 already define".  I looked around the dataset and there are now several dummy variables that I think correspond to the predicted outcomes for the instrumental variables, which the program or code isn't clearing each time the bootstrap is run without saving.  Also, any ideas how to fix this?

Thanks for your thoughts

Daniella

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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