plot.ivmediate: Plotting Local Indirect, Direct, and Total Effects from...

Description Usage Arguments Author(s) References See Also Examples

View source: R/ivmediate.R

Description

Function to plot results from ivmediate. The vertical axis lists the local average causal mediation effects, local average natural direct effects and local average treatment effects and the horizontal axis indicates the respective magnitudes. Most standard options for plot function available.

Usage

1
2
3
4
5
6
7
## S3 method for class 'ivmediate'
plot(x, treatment = NULL, labels = NULL,
                         effect.type = c("indirect","direct","total"),
                         conf.level = x$conf.level[1],
                         xlim = NULL, ylim = NULL, xlab = "", ylab = "",
                         main = NULL, lwd = 1.5, cex = .85,
                         col = "black", ...)

Arguments

x

object of class ivmediate as produced by ivmediate.

treatment

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

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).

conf.level

a numeric value for the level of the confidence intervals to plot. Must equal one of the confidence levels used to produce the ivmediate object.

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'.

Author(s)

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.

Yamamoto, T. (2013). Identification and Estimation of Causal Mediation Effects with Treatment Noncompliance. Unpublished manuscript.

See Also

ivmediate, summary.ivmediate

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
 
# Examples with JOBS II Field Experiment

# ** For illustration purposes a small number of simulations are used **

require(parallel)
require(MASS)

data(jobs)

a <- lm(comply ~ treat + sex + age + marital + nonwhite + educ + income, 
        data = jobs)
b <- glm(job_dich ~ comply + treat + sex + age + marital + nonwhite + educ + income, 
        data = jobs, family = binomial)
c <- lm(depress2 ~ job_dich * (comply + treat) + sex + age + marital + nonwhite + educ + income, 
        data = jobs)

out <- ivmediate(a, b, c, sims = 50, boot = FALSE,
                 enc = "treat", treat = "comply", mediator = "job_dich")
                 
summary(out)
plot(out)

carter-allen/mediation documentation built on Nov. 4, 2019, 8:45 a.m.