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

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

From   Kit Baum <>
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)

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   |
                              An Introduction to Stata Programming  |
   An Introduction to Modern Econometrics Using Stata  |

*   For searches and help try:

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