plot-methods: Plot (robust) mediation analysis results

plot-methodsR Documentation

Plot (robust) mediation analysis results

Description

Visualize results from (robust) mediation analysis.

Usage

## S3 method for class 'fit_mediation'
autoplot(object, which = c("ellipse", "weight"), ...)

## S3 method for class 'test_mediation'
autoplot(object, which = c("ci", "density", "ellipse", "weight"), ...)

## S3 method for class 'fit_mediation'
plot(x, which = c("ellipse", "weight"), ...)

## S3 method for class 'test_mediation'
plot(x, which = c("ci", "density", "ellipse", "weight"), ...)

Arguments

object, x

an object inheriting from class "fit_mediation" or "test_mediation" containing results from (robust) mediation analysis.

which

a character string specifying which plot to produce. Possible values are "ci" for a dot plot of selected effects together with confidence intervals (see ci_plot()), "density" for a density plot of the indirect effect(s) (see density_plot()), "ellipse" for a diagnostic plot of the data together with a tolerance ellipse (see ellipse_plot()), and "weight" for a diagnostic plot of robust regression weights (see weight_plot()).

...

additional arguments to be passed down.

Details

The "fit_mediation" method calls ellipse_plot() or weight_plot(), depending on the argument which.

The "test_mediation" method calls ci_plot(), density_plot(), ellipse_plot(), or weight_plot(), depending on the argument which.

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

fit_mediation(), test_mediation()

ci_plot(), density_plot(), ellipse_plot(), weight_plot()

Examples

data("BSG2014")

# run fast-and-robust bootstrap test
boot <- test_mediation(BSG2014,
                       x = "ValueDiversity",
                       y = "TeamCommitment",
                       m = "TaskConflict")

# create plots for robust bootstrap test
plot(boot, which = "ci")
plot(boot, which = "density")
plot(boot, which = "ellipse")
plot(boot, which = "weight")


robmed documentation built on July 9, 2023, 6:29 p.m.