setup_weight_plot {robmed} | R Documentation |
Set up a diagnostic plot of robust regression weights
Description
Extract the relevant information for a diagnostic plot of the regression weights from robust mediation analysis. This plot allows to easily detect deviations from normality assumptions such as skewness or heavy tails.
Usage
setup_weight_plot(object, ...)
## S3 method for class 'test_mediation'
setup_weight_plot(object, ...)
## S3 method for class 'reg_fit_mediation'
setup_weight_plot(object, outcome = NULL, npoints = 1000, ...)
Arguments
object |
an object inheriting from class |
... |
additional arguments to be passed down. |
outcome |
a character vector specifying the outcome variables of the
regressions to be included in the plot. This must be a subset of the
hypothesized mediators and the dependent variable, or |
npoints |
the number of grid points used to evaluate the expected percentages. The default is to use 1000 grid points. |
Details
This function is used internally by weight_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_weight_plot"
with the following
components:
data |
a data frame containing the following information: the outcome
variable of the regression (column |
outcome |
a character vector containing the outcome variables of the regressions to be included in the plot. |
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
fit_mediation()
, test_mediation()
,
weight_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_weight_plot(boot)
# create diagnostic plot of robust regression weights
weight_plot(setup) +
scale_color_manual("", values = c("black", "#00BFC4")) +
theme(legend.position = "top")