21

I am wondering if anyone knows of a way to run a multiple mediation model in R. I know the mediation package allows for multiple simple mediation models, but I want to run one model that evaluates multiple mediation models simultaneously.

I am assuming I can do this in an SEM framework (path analysis), but was wondering if anyone new of a package that computed statistics typical of mediation analysis for multiple mediators (indirect effects, Proportion of Total Effect via Mediation, etc.), and could utilize bootstrapping. I know this is a long-shot, but thought I should ask before investing time developing from scratch.

UPDATE: (11/11/2013)

Since asking this question a couple of years ago, I have learned to use the wonderful R package lavaan to do multiple mediation.

here is example code:

model <- '
# outcome model 
outcomeVar ~ c*xVar + b1*medVar1 + b2*medVar2

# mediator models
medVar1 ~ a1*xVar 
medVar2 ~ a2*xVar

# indirect effects (IDE)
medVar1IDE  := a1*b1
medVar2IDE  := a2*b2
sumIDE := (a1*b1) + (a2*b2)

# total effect
total := c + (a1*b1) + (a2*b2)
medVar1 ~~ medVar2 # model correlation between mediators
'

Note that a1,a2,b1,b2, and c are labels. Then run the model:

fit <- sem(model, data=dataframe)

And look at output:

summary(fit, fit.measures=TRUE, standardize=TRUE, rsquare=TRUE)

Finally, generate bootstrap confidence intervals:

boot.fit <- parameterEstimates(fit, boot.ci.type="bca.simple")

See the lavaan website for more details: http://lavaan.ugent.be/

wmmurrah
  • 353
  • 1
  • 2
  • 10
  • Not sure whether the [semPLS](http://cran.r-project.org/web/packages/semPLS/index.html) or [plspm](http://cran.r-project.org/web/packages/plspm/index.html) would allow mediational analysis, but it's worth to check. – chl Dec 09 '11 at 16:04
  • @wmmurrah will piggyback on your question, is the only advantage of bootstraping to obtain the confidence intervals? – lf_araujo Jul 03 '17 at 02:19
  • 1
    @If_araujo If you are into hypothesis testing, the bootstrap confidence intervals should be used instead of the p-values as the latter require normality assumptions that are often violated. The indirect effect, which are the product of two path coefficients, tend to be skewed, making the assumptions of p-values questionable, unless they are large. So even if you do not want to use the intervals they are superior to the p-values. – wmmurrah Jul 04 '17 at 14:15
  • @ If_araujo see: See: Preacher, K. J., & Hayes, A. F. (2008). Asymptotic and resampling strategies for assessing and comparing indirect effects in multiple mediator models. Behavior research methods, 40(3), 879-891. – wmmurrah Jul 04 '17 at 14:17
  • @wmmurrah Thanks for this great post. I'm new to lavaan and multiple mediation in general. In your example here, is there a way to perform a statistical comparison of the indirect effects? E.g., does mediator A have a statistically greater effect than mediator B? – E. Wade Feb 04 '22 at 20:23
  • @E.Wade, I am not sure what you mean by statistically greater. But I suppose you could create a model that constrains the two a path to be equivalent (use `a` in place of both `a1` and `a2`) and the two be paths to be equal (`b` instead of `b1` and `b2`). Then you could compare the two models to see if the model that estimates different a paths and different b paths. `lavaan` if you use the same label on two coefficients I am pretty sure that constrains them to be equal. – wmmurrah Feb 05 '22 at 22:19

1 Answers1

5

The lavaan package is an R package for SEM. You can use it to test for multiple mediation hypothesis, and there is boostrap.

user34609
  • 66
  • 1
  • 2
  • I have recently become a big fan of lavaan. See my update to the question above. I really hope development of lavaan continues! – wmmurrah Nov 11 '13 at 19:56