Statalist


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

[Fwd: st: Bootstrapping and delta method]


From   John Antonakis <john.antonakis@unil.ch>
To   statalist@hsphsun2.harvard.edu
Subject   [Fwd: st: Bootstrapping and delta method]
Date   Tue, 14 Apr 2009 23:29:07 +0200

For those who are interesting, here is how bootstraping using the delta method is done in a simpler way:

use http://www.ats.ucla.edu/stat/stata/notes/hsb2, clear

bootstrap b = ([read]_b[ses]*[write]_b[read]), reps(50) :sureg (read ses) (write read ses)

Regards,
John.

-------- Original Message --------
Subject: 	st: Bootstrapping and delta method
Date: 	Mon, 13 Apr 2009 14:49:32 +0200
From: 	John Antonakis <john.antonakis@unil.ch>
Reply-To: 	statalist@hsphsun2.harvard.edu
Organization: 	UNIL
To: 	statalist@hsphsun2.harvard.edu
References: <827163.73041.qm@web25006.mail.ukl.yahoo.com> <498CC24E.2080807@unil.ch>



Awhile back, Maarten Buis very nicely posted the below syntax to bootstrap an indirect path.

Although the code works well, is there a simpler routine, akin to say doing:

bootstrap, reps (1000): nlcom  [z_read]z_ses*[z_write]z_read

I will have a large amount of indirect paths that I want to test simultaneously, so a simpler way to do this would be great.

Best,
J.

------------------ begin example ----------------------
use http://www.ats.ucla.edu/stat/stata/notes/hsb2, clear
foreach var of varlist read ses write {
  sum `var' if !missing(read,ses,write)
  gen double z_`var' = (`var' - r(mean))/r(sd)
}

capture program drop indir
program define indir, rclass
  tempname b
  reg z_read z_ses
  scalar `b' = _b[z_ses]
  reg z_write z_read z_ses
  return scalar indir = _b[z_read]*`b'
end
indir
bootstrap indir=r(indir), reps(1000): indir
estat bootstrap, bc p norm

qui sureg (z_read z_ses) (z_write z_read z_ses)
nlcom  [z_read]z_ses*[z_write]z_read
*--------------- end example ---------------------------
____________________________________________________

Prof. John Antonakis
Associate Dean Faculty of Business and Economics
University of Lausanne
Internef #618
CH-1015 Lausanne-Dorigny
Switzerland

Tel ++41 (0)21 692-3438
Fax ++41 (0)21 692-3305

____________________________________________________


*
*   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/


--
____________________________________________________

Prof. John Antonakis
Associate Dean Faculty of Business and Economics
University of Lausanne
Internef #618
CH-1015 Lausanne-Dorigny
Switzerland

Tel ++41 (0)21 692-3438
Fax ++41 (0)21 692-3305

Faculty page:
http://www.hec.unil.ch/people/jantonakis&cl=en

Personal page:
http://www.hec.unil.ch/jantonakis
____________________________________________________

*
*   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