setup_ci_plot {robmed} | R Documentation |
Set up information for a dot plot with confidence intervals
Description
Extract the relevant information for a dot plot with confidence intervals of selected effects from (robust) mediation analysis. Information on p-values of the selected effects can be included in addition to confidence intervals.
Usage
setup_ci_plot(object, ...)
## S3 method for class 'boot_test_mediation'
setup_ci_plot(
object,
parm = c("direct", "indirect"),
type = c("boot", "data"),
p_value = FALSE,
digits = 4L,
...
)
## S3 method for class 'sobel_test_mediation'
setup_ci_plot(
object,
parm = c("direct", "indirect"),
level = 0.95,
p_value = FALSE,
...
)
## S3 method for class 'list'
setup_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 estiamates and
confidence intervals to plot: those based on the bootstrap distribution
( |
p_value |
a logical indicating whether to include information on the
p-values in addition to the 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
This function is used internally by ci_plot()
. It may also
be useful for users who want to produce a similar plot, but who want more
control over what information to display or how to display that information.
Value
An object of class "setup_ci_plot"
with the following
components:
ci |
a data frame consisting of column |
p_value |
a data frame consisting of column |
level |
numeric; the confidence level used for the confidence intervals of the indirect effect(s). |
have_methods |
a logical indicating whether a list of
|
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()
, ci_plot()
Examples
data("BSG2014")
# run fast-and-robust bootstrap test
boot <- test_mediation(BSG2014,
x = "ValueDiversity",
y = "TeamCommitment",
m = "TaskConflict")
# set up information for plot
setup <- setup_ci_plot(boot, parm = "Indirect")
# plot only density and confidence interval
ggplot() +
geom_hline(yintercept = 0, color = "darkgrey") +
geom_pointrange(aes(x = "Robust bootstrap", y = Estimate,
ymin = Lower, ymax = Upper),
data = setup$ci) +
labs(x = NULL, y = "Indirect effect")