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/

  • $\begingroup$ Not sure whether the semPLS or plspm would allow mediational analysis, but it's worth to check. $\endgroup$
    – chl
    Dec 9, 2011 at 16:04
  • $\begingroup$ @wmmurrah will piggyback on your question, is the only advantage of bootstraping to obtain the confidence intervals? $\endgroup$
    – lf_araujo
    Jul 3, 2017 at 2:19
  • 1
    $\begingroup$ @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. $\endgroup$
    – wmmurrah
    Jul 4, 2017 at 14:15
  • $\begingroup$ @ 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. $\endgroup$
    – wmmurrah
    Jul 4, 2017 at 14:17
  • $\begingroup$ @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? $\endgroup$
    – Betsy S.
    Feb 4, 2022 at 20:23

1 Answer 1


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

  • $\begingroup$ I have recently become a big fan of lavaan. See my update to the question above. I really hope development of lavaan continues! $\endgroup$
    – wmmurrah
    Nov 11, 2013 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.