data("BSG2014")
# run fast-and-robust bootstrap test
boot <- test_mediation(BSG2014,
x = "ValueDiversity",
y = "TeamCommitment",
m = "TaskConflict",
level = 0.9)
# set up information for plot
setup <- setup_density_plot(boot)
# plot only density and confidence interval
ggplot() +
geom_density(aes(x = Indirect, y = Density), data = setup$density,
stat = "identity") +
geom_rect(aes(xmin = Lower, xmax = Upper,
ymin = -Inf, ymax = Inf),
data = setup$ci, color = NA, alpha = 0.2) +
labs(x = "Indirect effect", y = "Bootstrap density")
Run the code above in your browser using DataLab