Learn R Programming

robmed (version 0.9.0)

plot-methods: Plot (robust) mediation analysis results

Description

Visualize results from (robust) mediation analysis.

Usage

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

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

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

# S3 method for 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.

Value

An object of class "ggplot".

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.

See Also

fit_mediation(), test_mediation()

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

Examples

Run this code
# NOT RUN {
data("BSG2014")

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

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

# }

Run the code above in your browser using DataLab