plot.multimed: Plotting the Results of Causal Mediation Analysis for...

Description Usage Arguments Details Author(s) References See Also Examples

View source: R/multimed.R

Description

Function to plot results from multimed. Most standard plotting options are available.

Usage

1
2
3
4
5
6
7
8
## S3 method for class 'multimed'
plot(x, type = c("point", "sigma", "R2-residual", "R2-total"),
     tgroup = c("average", "treated", "control"),
     effect.type = c("indirect", "direct", "total"),
     ask = prod(par("mfcol")) < nplots,
     xlab = NULL, ylab = NULL, xlim = NULL, ylim = NULL, main = NULL,
     lwd = par("lwd"), pch = par("pch"), cex = par("cex"), las = par("las"),
     col.eff = "black", col.cbar = "black", col.creg = "gray", ...)

Arguments

x

object of class multimed, typically output from the multimed funciton.

type

type of plot(s) required. The default is to produce all, i.e., the point estimates of the effects under the homogenous interaction assumpton ("point") and bounds as function of the sigma ("sigma"), R square star ("R2-residual") and R square tilde ("R2-total") parameters.

tgroup

treatment group(s) for which the estimates are produced. The default is to plot all, i.e., the average causal mediation effect when treated ("treated"), control ("control") and the simple average of these two effects ("average").

effect.type

a vector indicating which quantities of interest to plot for the point estimates. Only plotting total effects is not available.

ask

a logical value. If 'TRUE', the user is asked for input before a new figure is plotted. Default is to ask only if the number of plots on current screen is fewer than necessary.

xlab

label for the x axis. Default labels are used if 'NULL'.

ylab

label for the y axis. Default labels are used if 'NULL'.

xlim

limits of the x axis. If 'NULL' default values are used.

ylim

limits of the y axis. If 'NULL' default values are used.

main

main title for the plot. If 'NULL', default titles are used.

lwd

width of the lines used in graphs. For the "point" plot this is the width of confidence bars. For sensitivity plots this is the width of the lines for the bounds.

pch

plotting points used for the "point" plots.

cex

magnification factor for the plotting points in the "point" plots.

las

style of the y axis labels in the "point" plots.

col.eff

color of the points in the "point" plots and/or the bounds in sensitivity plots.

col.cbar

color of the confidence bars in the "point" plots.

col.creg

color of the confidence regions in sensitivity plots.

...

additional arguments to be passed to plotting functions.

Details

'type' and 'tgroup' can contain multiple character strings, in which case multiple plots are produced. For the use of graphical parameters see plot and the links it contains.

Author(s)

Teppei Yamamoto, Massachusetts Institute of Technology, [email protected].

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. and Yamamoto, T. (2012) Identification and Sensitivity Analysis for Multiple Causal Mechanisms: Revisiting Evidence from Framing Experiments, typescript.

See Also

multimed, plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 

# Replicates Figure 3 (right column) of Imai and Yamamoto (2012)
# Note: # of bootstrap samples set low for quick illustration

data(framing)
Xnames <- c("age", "educ", "gender", "income")
res <- multimed("immigr", "emo", "p_harm", "treat", Xnames,
               data = framing, sims = 10)
summary(res)
plot(res, type = "point")
plot(res, type = c("sigma", "R2-total"), tgroup = "average")


## End(Not run)

mediation documentation built on July 12, 2017, 1:02 a.m.