data("BSG2014")
# run fast-and-robust bootstrap test
robust_boot <- test_mediation(BSG2014,
                              x = "ValueDiversity",
                              y = "TeamCommitment",
                              m = "TaskConflict",
                              level = 0.9,
                              robust = TRUE)
# create plot for robust bootstrap test
density_plot(robust_boot)
density_plot(robust_boot, color = "#00BFC4", fill = "#00BFC4")
# run OLS bootstrap test
ols_boot <- test_mediation(BSG2014,
                           x = "ValueDiversity",
                           y = "TeamCommitment",
                           m = "TaskConflict",
                           level = 0.9,
                           robust = FALSE)
# compare robust and OLS bootstrap tests
boot_list <- list("OLS bootstrap" = ols_boot,
                  "ROBMED" = robust_boot)
density_plot(boot_list)
# the plot can be customized in the usual way
density_plot(boot_list) + theme_bw() +
  labs(title = "OLS bootstrap vs ROBMED")
Run the code above in your browser using DataLab