Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: bootstrapped std errors in two stage estimation


From   "Yulia Marchenko" <[email protected]>
To   <[email protected]>
Subject   st: RE: bootstrapped std errors in two stage estimation
Date   Thu, 20 Oct 2005 13:13:35 -0500

Arin Dube [[email protected]] wrote:

>I am trying to get bootstrapped standard errors for a 2-stage estimation
>procedure. I'd like to write a program ("myprog") that can be called on in
>the bootstrap command that does the following:
>
>	regress treatment  instrument [aw=myweight]
>	predict resid, residual
>	gen treatment_resid = treatment*resid
>	regress depvar treatment resid treatment_resid [aw=myweight]
>
>I'd like to bootstrap "myprog" to get the regression coefficient of
reatment >... passing on (treatment, instrument, myweight) to "myprog".
Fundamentally
>I'm interested in boostrapped standard error of the "treatment" coefficient
>in the second regression.

Below is an example in Stata 9 demonstrating how Arin can obtain the
required bootstrap standard error:

****************************************************************************
	cap program drop myprog
	program myprog
		args depvar trtm instr wgt
		qui {
			regress `trtm' `instr' [aw =`wgt']
			tempvar resid trtmXresid
			predict `resid', residual
			gen `trtmXresid' = `trtm'*`resid'
			regress `depvar' `trtm' `resid' `trtmXresid' [aw=`wgt']
		}
	end

	sysuse auto, clear
	bootstrap _b[weight], r(100): myprog mpg weight length turn
	exit
****************************************************************************

More examples on -bootstrap- can be found in [R] bootstrap.

Arin may also be interested in Stata -ivreg- command that performs two-stage
least squares regression and use it with -bootstrap-. Type

 . help ivreg

for an online help.


Sincerely,
Yulia


--Yulia
[email protected]


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