library(manymome)
library(flextable)
# List of indirect effects
dat <- data_med_mod_a
lm_m <- lm(m ~ x*w + c1 + c2, dat)
lm_y <- lm(y ~ m + x + c1 + c2, dat)
fit_lm <- lm2list(lm_m, lm_y)
# Should set R to 5000 or 10000 in real research
boot_out_lm <- do_boot(fit_lm,
R = 100,
seed = 54532,
parallel = FALSE,
progress = FALSE)
out_xmy_on_w <- cond_indirect_effects(wlevels = "w",
x = "x",
y = "y",
m = "m",
fit = fit_lm,
boot_ci = TRUE,
boot_out = boot_out_lm)
std_xmy_on_w <- cond_indirect_effects(wlevels = "w",
x = "x",
y = "y",
m = "m",
fit = fit_lm,
boot_ci = TRUE,
boot_out = boot_out_lm,
standardized_x = TRUE,
standardized_y = TRUE)
ft1 <- as_flextable(out_xmy_on_w,
var_labels = c(w = "Moderator"))
ft1
ft2 <- as_flextable(std_xmy_on_w,
var_labels = c(w = "Moderator"),
se = FALSE,
digits = 3)
ft2
Run the code above in your browser using DataLab