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" <>
To   <>
Subject   st: RE: bootstrapped std errors in two stage estimation
Date   Thu, 20 Oct 2005 13:13:35 -0500

Arin Dube [] 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".
>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']

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

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.



*   For searches and help try:

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