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/