# NOT RUN {
data("BSG2014")
# run fast and robust bootstrap test
robust_boot <- test_mediation(BSG2014,
                              x = "ValueDiversity",
                              y = "TeamCommitment",
                              m = "TaskConflict",
                              robust = TRUE)
# create plot for robust bootstrap test
ellipse_plot(robust_boot)
# original data and partial residuals
ellipse_plot(robust_boot, horizontal = "TaskConflict",
             vertical = "TeamCommitment")
ellipse_plot(robust_boot, horizontal = "TaskConflict",
             vertical = "TeamCommitment", partial = TRUE)
# run standard bootstrap test
standard_boot <- test_mediation(BSG2014,
                                x = "ValueDiversity",
                                y = "TeamCommitment",
                                m = "TaskConflict",
                                robust = FALSE)
# compare robust and standard tests
tests <- list(OLS = standard_boot, Robust = robust_boot)
ellipse_plot(tests)
# the plot can be customized in the usual way
ellipse_plot(tests) + theme_bw() +
  labs(title = "OLS vs robust estimation")
# }
Run the code above in your browser using DataLab