Learn R Programming

mediation (version 1.0)

plot.medsens: Plotting results from sensitivity analysis of mediation effects.

Description

Plots results from medsens function. Y axis plots mediation effect and x-axis plots the error correlation rho. Standard options for plot function available.

Usage

## S3 method for class 'medsens':
plot(x, xlab=NULL, ylab=NULL, xlim=NULL, ylim=NULL, main=NULL, pr.plot=FALSE,...) 

# ## S3 method for class 'plot.medsens': print(z)

Arguments

x
Output from medsens function.
xlab
x-axis label.
ylab
y-axis label.
xlim
range for x-axis.
ylim
range for y-axis.
main
main title for graph.
pr.plot
If pr.plot=TRUE then proportion mediated will be plotted.
...
Additional arguments to be passed.

References

Imai, Kosuke, Luke Keele and Dustin Tingley (2009) A General Approach to Causal Mediation Analysis. Imai, Kosuke, Luke Keele and Teppei Yamamoto (2009) Identification, Inference, and Sensitivity Analysis for Causal Mediation Effects.

See Also

See also medsens

Examples

Run this code
#Example with JOBS II Field experiment
#For illustration purposes simulations set to low number.

#Example with JOBS II Field experiment
data(jobs)


#########################################
#continuous mediator and continuous outcome
#########################################

#fit parametric model
model.m <- lm(job_seek ~ treat + depress1 + econ_hard + sex + age  + occp + marital + nonwhite + educ + income, data=jobs)
model.y <- lm(depress2 ~ treat + job_seek + depress1 + econ_hard + sex + age + occp + marital + nonwhite + educ + income, data=jobs)
#pass model objects through medsens function
sens.cont <- medsens(model.m, model.y, T="treat", M="job_seek", INT=FALSE,  DETAIL=FALSE, sims=1000)
#plot mediation effect and 95plot(sens.cont, main="JOBS", ylim=c(-.2,.2))

Run the code above in your browser using DataLab