data("BSG2014")
# seed to be used for the random number generator
seed <- 20211117
# perform mediation analysis via robust bootstrap test ROBMED
set.seed(seed)
robust_boot <- test_mediation(BSG2014,
x = "ValueDiversity",
y = "TeamCommitment",
m = "TaskConflict",
robust = TRUE)
# construct LaTeX table of results
to_latex(robust_boot)
# perform mediation analysis via the OLS bootstrap
set.seed(seed)
ols_boot <- test_mediation(BSG2014,
x = "ValueDiversity",
y = "TeamCommitment",
m = "TaskConflict",
robust = FALSE)
# construct LaTeX table of results from both procedures
boot_list <- list(ols_boot, robust_boot)
to_latex(boot_list)
# customize labels for procedures and number of digits
boot_list_named <- list("Non-robust" = ols_boot,
"Robust" = robust_boot)
to_latex(boot_list_named, digits = 4)
Run the code above in your browser using DataLab