ci_plot {robmed} | R Documentation |
Dot plot with confidence intervals
Description
Produce a dot plot with confidence intervals of selected effects from (robust) mediation analysis. In addition to confidence intervals, p-values of the selected effects can be plotted as well.
Usage
ci_plot(object, ...)
## Default S3 method:
ci_plot(object, parm = c("direct", "indirect"), ...)
## S3 method for class 'boot_test_mediation'
ci_plot(
object,
parm = c("direct", "indirect"),
type = c("boot", "data"),
p_value = FALSE,
digits = 4L,
...
)
## S3 method for class 'sobel_test_mediation'
ci_plot(
object,
parm = c("direct", "indirect"),
level = 0.95,
p_value = FALSE,
...
)
## S3 method for class 'list'
ci_plot(
object,
parm = c("direct", "indirect"),
type = c("boot", "data"),
level = 0.95,
p_value = FALSE,
digits = 4L,
...
)
## S3 method for class 'setup_ci_plot'
ci_plot(object, ...)
Arguments
object |
an object inheriting from class
|
... |
additional arguments to be passed down. |
parm |
an integer, character or logical vector specifying which
effects to include in the plot. In case of a character vector, possible
values are |
type |
a character string specifying which point estimates and
confidence intervals to plot: those based on the bootstrap distribution
( |
p_value |
a logical indicating whether to include dot plots of the
p-values in addition to those with confidence intervals. The default is
|
digits |
an integer determining how many digits to compute for
bootstrap p-values of the indirect effects (see |
level |
numeric; the confidence level of the confidence intervals
from Sobel's test. The default is to include 95% confidence intervals.
Note that this is not used for bootstrap tests, as those require to specify
the confidence level already in |
Details
Methods first call setup_ci_plot()
to extract all necessary
information to produce the plot, then the "setup_ci_plot"
method is called to produce the plot.
Value
An object of class "ggplot"
.
Author(s)
Andreas Alfons
References
Alfons, A., Ates, N.Y. and Groenen, P.J.F. (2022) Robust Mediation Analysis: The R Package robmed. Journal of Statistical Software, 103(13), 1–45. doi:10.18637/jss.v103.i13.
See Also
test_mediation()
, setup_ci_plot()
density_plot()
, ellipse_plot()
,
weight_plot()
, plot()
Examples
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
ci_plot(robust_boot)
ci_plot(robust_boot, color = "#00BFC4")
# run OLS bootstrap test
ols_boot <- test_mediation(BSG2014,
x = "ValueDiversity",
y = "TeamCommitment",
m = "TaskConflict",
robust = FALSE)
# compare robust and OLS bootstrap tests
boot_list <- list("OLS bootstrap" = ols_boot,
"ROBMED" = robust_boot)
ci_plot(boot_list)
# the plot can be customized in the usual way
ci_plot(boot_list) +
geom_hline(yintercept = 0, color = "darkgrey") +
coord_flip() + theme_bw() +
labs(title = "OLS bootstrap vs ROBMED")