data_serial_parallel | R Documentation |
A mediation model with both serial and parallel components.
data_serial_parallel
A data frame with 100 rows and 7 variables:
Predictor. Numeric.
Mediator 1 in Path 1. Numeric.
Mediator 2 in Path 1. Numeric.
Mediator in Path 2. Numeric.
Outcome variable. Numeric.
Control variable. Numeric.
Control variable. Numeric.
library(lavaan)
data(data_serial_parallel)
mod <-
"
m11 ~ a11 * x + c1 + c2
m12 ~ b11 * m11 + x + c1 + c2
m2 ~ a2 * x + c1 + c2
y ~ b12 * m12 + b2 * m2 + m11 + x + c1 + c2
indirect1 := a11 * b11 * b12
indirect2 := a2 * b2
indirect := a11 * b11 * b12 + a2 * b2
"
fit <- sem(mod, data_serial_parallel,
meanstructure = TRUE, fixed.x = FALSE)
parameterEstimates(fit)[c(1, 4, 8, 11, 12, 34:36), ]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.