plot.mediate.mer: Plotting Indirect, Direct, and Total Effects from Mediation...

Description Usage Arguments Author(s) References See Also Examples

View source: R/mediate.R

Description

Function to plot group-specific effects derived from causal mediation analysis of multilevel models.

Usage

1
2
3
4
5
6
7
 
## S3 method for class 'mediate.mer'
plot(x, treatment = NULL, group.plots = FALSE,
                             ask = prod(par("mfcol")) < nplots, 
                             xlim = NULL, ylim = NULL, xlab = "", ylab = "",
                             main = NULL, lwd = 1.5, cex = .85,
                             col = "black", ...)

Arguments

x

object of class 'mediate.mer' 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.

group.plots

a logical value indicating whether group-specific effects should be plotted in addition to the population-averaged effects.

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.

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)

Kentaro Hirose, Princeton University, hirose@princeton.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.

See Also

mediate, summary.mediate.mer.

Examples

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

# **For illustration purposes a small number of simulations are used**
## Not run: 
data(jobs)
require(lme4)

# educ: mediator group
# occp: outcome group

# Varying intercept for mediator 
model.m <- glmer(job_dich ~ treat + econ_hard + (1 | educ), 
             		     family = binomial(link = "probit"), data = jobs)

# Varying intercept and slope for outcome
model.y <- glmer(work1 ~ treat + job_dich + econ_hard + (1 + treat | occp), 
                family = binomial(link = "probit"), data = jobs)

# Output based on mediator group
multilevel <- mediate(model.m, model.y, treat = "treat", 
                      mediator = "job_dich", sims=50, group.out="educ")

#plot(multilevel, group.plots=TRUE)

## End(Not run)

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