Statalist


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

st: re: bootstrap coefficient vector from 2SLS IV regression


From   Kit Baum <[email protected]>
To   [email protected]
Subject   st: re: bootstrap coefficient vector from 2SLS IV regression
Date   Tue, 24 Nov 2009 20:13:03 -0500

<>
Problem seems to arise when you put tempvars into a regression and then return the coefficients: my guess is that the matrix stripes are messed up by the fact that these tempvar names do not exist outside the program, and when bootstrap gets the coeff vector back its names are poorly defined. Works fine with explicit variables:

webuse sysdsn1, clear

        capture program drop proca_reg
        program define proca_reg, eclass

 		tempvar es  
                tempname beta
                mlogit insure age male nonwhite 
		capt drop p1 p2
                predict p1, outcome(1)     
                predict p2, outcome(2)
 //              predict `p3', outcome(3)  don't need all outcomes in regression

                regress patid p1 p2 age male nonwhite 
		g byte es = e(sample)
                mat `beta' = e(b)
                ereturn post `beta', esample(es)
end

bootstrap _b, saving(regmlogit,replace) : proca_reg


Note that you do not need all the predicted outcomes in the model, as they are collinear. You can calculate the missing outcome with lincom.

Kit Baum   |   Boston College Economics & DIW Berlin   |   http://ideas.repec.org/e/pba1.html
                              An Introduction to Stata Programming  |   http://www.stata-press.com/books/isp.html
   An Introduction to Modern Econometrics Using Stata  |   http://www.stata-press.com/books/imeus.html


*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index