library(lavaan)
data(data_med_mod_ab1)
dat <- data_med_mod_ab1
dat$"x:w" <- dat$x * dat$w
dat$"m:w" <- dat$m * dat$w
mod <-
"
m ~ x + w + x:w + c1 + c2
y ~ m + w + m:w + x + c1 + c2
"
# Bootstrapping not requested in calling lavaan::sem()
fit <- sem(model = mod, data = dat, fixed.x = FALSE,
se = "none", baseline = FALSE)
fit_boot_out <- fit2boot_out_do_boot(fit = fit,
R = 40,
seed = 1234,
progress = FALSE)
out <- cond_indirect_effects(wlevels = "w",
x = "x",
y = "y",
m = "m",
fit = fit,
boot_ci = TRUE,
boot_out = fit_boot_out)
out
Run the code above in your browser using DataLab