Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: RE: SEM with bootstrapping for analysis of mediation


From   "Iyer, Neeraj N" <niyer@purdue.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: RE: SEM with bootstrapping for analysis of mediation
Date   Wed, 11 Jul 2012 14:46:04 -0400

Hello,

I was able to run the code for obtaining obtain bootstrap standard errors and confidence intervals for my SEM analysis.  Just for reference, I used this code  "indireff.ado" from http://www.ats.ucla.edu/stat/stata/faq/sem_mediation.htm.

For a simple mediation model i.e. sem (MV <- IV)(DV <- MV IV), obtaining the bootstrap confidence intervals (normal-based, percentile and bias-corrected) for direct, indirect and total effects was intuitive.  

However when I ran a mediation model with one IV and 4 other covariates i.e. sem (MV <- IV CV1 CV2 CV3 CV4 )(DV <- MV IV CV1 CV2 CV3 CV4), the bootstrap confidence intervals I obtained were for the overall direct, indirect and total effects and not broken down by each variable.  I wish to obtain the bootstrap CI separately for my IV adjusted for other covariates.  Any thoughts about approaching this problem?

Another question is why is the seed set at 358395?  What is this number's significance?

Thanks in advance,
Regards,
Neeraj

My code is below:

program indireff, rclass
 sem (MV <- IV CV1 CV2 CV3 CV4 ) (DV <- MV IV CV1 CV2 CV3 CV4)
 estat teffects
 mat bi = r(indirect)
 mat bd = r(direct)
 mat bt = r(total)
 return scalar indir  = el(bi,1,3)
 return scalar direct = el(bd,1,3)
 return scalar total  = el(bt,1,3)
end

sem (MV <- IV CV1 CV2 CV3 CV4 ) (DV <- MV IV CV1 CV2 CV3 CV4)
quietly estat teffects

matrix list r(indirect)
matrix list r(direct)
matrix list r(total)

set seed 358395

bootstrap r(indir) r(direct) r(total), reps(200): indireff
estat bootstrap, percentile bc



On Tue, Jun 19, 2012 at 12:13 PM, Iyer, Neeraj N <niyer@purdue.edu> wrote:
Thank you Billy.  I will try the program out now.

Regards,
Neeraj


**********************

On Tue, Jun 19, 2012 at 12:06 PM, William Buchanan <william@williambuchanan.net> wrote:
Hi Neeraj,

The program that you mentioned is typed out explicitly for you on the site that you referenced:

program indireff, rclass
 sem (read <- math)(science <- read math)
 estat teffects
 mat bi = r(indirect)
 mat bd = r(direct)
 mat bt = r(total)
 return scalar indir  = el(bi,1,3)
 return scalar direct = el(bd,1,3)
 return scalar total  = el(bt,1,3)
end

Copy the syntax (with appropriate substitution of variable names and returned scalars) and save it as indireff.ado in your Personal directory of your Stata installation, then run it the same way that they outlined on the website.  If you have difficulty with things, you should look at the programming manual and the material about referencing individual elements in matrices (so you can pull out the correct scalars).

HTH,
Billy



On Jun 19, 2012, at 8:56 AM, Iyer, Neeraj N wrote:

> Hello Stata users,
>
> I am conducting a Structural Equation Modeling (sem) for analysis of mediation.  I would like to obtain bootstrap standard errors and confidence intervals.  Does anyone have experience calculating bootstrap intervals for testing indirect effects.
>
> I did find description of the program "indireff.ado" on http://www.ats.ucla.edu/stat/stata/faq/sem_mediation.htm but was unable to locate the the .ado file.  Any guidance regarding the download or the procedure would be appreciated.
>
> Thanks in advance.
>
> Regards,
> Neeraj
> *
> *   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/


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



--
Neeraj

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



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