powered by
A simple mediation model.
data_med
A data frame with 100 rows and 5 variables:
Predictor. Numeric.
Mediator. Numeric.
Outcome variable. Numeric.
Control variable. Numeric.
library(lavaan) data(data_med) mod <- " m ~ a * x + c1 + c2 y ~ b * m + x + c1 + c2 ab := a * b " fit <- sem(mod, data_med, fixed.x = FALSE) parameterEstimates(fit)
Run the code above in your browser using DataLab