Learn R Programming

robmed (version 1.2.1)

weight_plot: Diagnostic plot of robust regression weights

Description

Produce 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

weight_plot(object, ...)

# S3 method for default weight_plot(object, outcome = NULL, npoints = 1000, ...)

# S3 method for setup_weight_plot weight_plot(object, ...)

Value

An object inheriting from class "ggplot".

Arguments

object

an object inheriting from class "fit_mediation" or "test_mediation" containing results from robust mediation analysis. Only mediation analysis objects fitted with the robust MM-estimator are supported.

...

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 NULL (the default) to include all regressions of the mediation model.

npoints

the number of grid points used to evaluate and draw the expected percentages. The default is to use 1000 grid points.

Author

Andreas Alfons

Details

The horizontal axis contains different weight thresholds, and the vertical axis displays the percentage of observations that have a weight below this threshold. For comparison, a reference line is drawn for the expected percentages under normally distributed errors. Observations with negative and positive residuals are shown separately to make it possible to distinguish between symmetric and asymmetric deviations from normality.

If the plot reveals more downweighted observations than expected, but roughly the same amounts in both tails, the residual distribution is symmetric but with heavy tails. If the plot shows that observations in one tail are downweighted more heavily than those in the other tail, the residual distribution is skewed.

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(), setup_weight_plot()

ci_plot(), density_plot(), ellipse_plot(), plot()

Examples

Run this code
data("BSG2014")

# obtain robust fit of mediation model
fit <- fit_mediation(BSG2014,
                     x = "ValueDiversity",
                     y = "TeamCommitment",
                     m = "TaskConflict")

# create diagnostic plot of robust regression weights
weight_plot(fit) +
  scale_color_manual("", values = c("black", "#00BFC4")) +
  theme(legend.position = "top")

# plot only the regression model for the hypothesized mediator
weight_plot(fit, outcome = "TaskConflict") +
  scale_color_manual("", values = c("black", "#00BFC4")) +
  theme(legend.position = "top")

Run the code above in your browser using DataLab