R mediation
mediation is a bootstrapping software for mediation analysis.
Contents
Installation
install.packages('mediation')
Usage
library(mediation) XonM <- lm(M ~ X, data = data) XMonY <- lm(Y ~ X + M, data = data) mediate(XonM, XMonY, treat='X', mediator='M', boot=TRUE, sims=500)
This displays:
the average causal mediation effects (ACME), the key measure of this bootstrapping method
if significantly different than 0, then there is a significant mediation effect
the average direct effects (ADE)
- the total effect
total effect = ACME + ADE
- the proportion of the total effect that was mediated
prop = ACME / total effect