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

st: Bootstrapping and delta method

From   John Antonakis <>
Subject   st: Bootstrapping and delta method
Date   Mon, 13 Apr 2009 14:49:32 +0200

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.


------------------ begin example ----------------------
use, 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'
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

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


*   For searches and help try:

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