data_med_mod_a | R Documentation |
A simple mediation model with a-path moderated.
data_med_mod_a
A data frame with 100 rows and 6 variables:
Predictor. Numeric.
Moderator. Numeric.
Mediator. Numeric.
Outcome variable. Numeric.
Control variable. Numeric.
Control variable. Numeric.
library(lavaan)
data(data_med_mod_a)
data_med_mod_a$xw <-
data_med_mod_a$x *
data_med_mod_a$w
mod <-
"
m ~ a * x + w + d * xw + c1 + c2
y ~ b * m + x + w + c1 + c2
w ~~ v_w * w
w ~ m_w * 1
ab := a * b
ab_lo := (a + d * (m_w - sqrt(v_w))) * b
ab_hi := (a + d * (m_w + sqrt(v_w))) * b
"
fit <- sem(mod, data_med_mod_a,
meanstructure = TRUE, fixed.x = FALSE)
parameterEstimates(fit)[c(1, 3, 6, 11, 12, 31:33), ]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.