Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plot.mediate

Plotting Indirect, Direct, and Total Effects from Mediation Analysis


Description

Function to plot results from mediate. The vertical axis lists indirect, direct, and total effects and the horizontal axis indicates the respective magnitudes. Most standard options for plot function available.

Usage

## S3 method for class 'mediate'
plot(x, treatment = NULL, labels = NULL,
  effect.type = c("indirect", "direct", "total"), xlim = NULL,
  ylim = NULL, xlab = "", ylab = "", main = NULL, lwd = 1.5,
  cex = 0.85, col = "black", ...)

Arguments

x

object of class mediate or mediate.order as produced by mediate.

treatment

a character string indicating the baseline treatment value of the estimated causal mediation effect and direct effect to plot. Can be either "control", "treated" or "both". If 'NULL' (default), both sets of estimates are plotted if and only if they differ.

labels

a vector of character strings indicating the labels for the estimated effects. The default labels will be used if NULL.

effect.type

a vector indicating which quantities of interest to plot. Default is to plot all three quantities (indirect, direct and total effects).

xlim

range of the horizontal axis.

ylim

range of the vertical axis.

xlab

label of the horizontal axis.

ylab

label of the vertical axis.

main

main title.

lwd

width of the horizontal bars for confidence intervals.

cex

size of the dots for point estimates.

col

color of the dots and horizontal bars for the estimates.

...

additional parameters passed to 'plot'.

Value

mediate returns an object of class "mediate". The function summary is used to obtain a table of the results. The plot function plots these quantities.

Author(s)

Dustin Tingley, Harvard University, dtingley@gov.harvard.edu; Teppei Yamamoto, Massachusetts Institute of Technology, teppei@mit.edu.

References

Tingley, D., Yamamoto, T., Hirose, K., Imai, K. and Keele, L. (2014). "mediation: R package for Causal Mediation Analysis", Journal of Statistical Software, Vol. 59, No. 5, pp. 1-38.

Imai, K., Keele, L. and Tingley, D. (2010) A General Approach to Causal Mediation Analysis, Psychological Methods, Vol. 15, No. 4 (December), pp. 309-334.

Imai, K., Keele, L. and Yamamoto, T. (2010) Identification, Inference, and Sensitivity Analysis for Causal Mediation Effects, Statistical Science, Vol. 25, No. 1 (February), pp. 51-71.

Imai, K., Keele, L., Tingley, D. and Yamamoto, T. (2009) "Causal Mediation Analysis Using R" in Advances in Social Science Research Using R, ed. H. D. Vinod New York: Springer.

See Also


mediation

Causal Mediation Analysis

v4.5.0
GPL (>= 2)
Authors
Dustin Tingley <dtingley@gov.harvard.edu>, Teppei Yamamoto <teppei@mit.edu>, Kentaro Hirose <hirose@princeton.edu>, Luke Keele <ljk20@psu.edu>, Kosuke Imai <kimai@princeton.edu>, Minh Trinh <mdtrinh@mit.edu>, Weihuang Wong <wwong@mit.edu>
Initial release
2019-9-13

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.