Learn R Programming

mediation (version 2.0)

summary.medsens: Summarizing results from sensitivity analysis of mediation effects.

Description

Function to perform sensitivity analysis on mediation effect for violations of sequential ignorability assumption. The procedure estimates the mediation effect allowing for a correlation between the error terms of the outcome model and the mediator model. The extent of this correlation is expressed in terms of the parameter rho. Sensitivity analysis is possible with continuous mediator and continuous outcome and binary outcome and continuous mediator. Future versions of the function will also permit sensitivity analysis for a continuous outcome and binary mediator. Output from the function can be passed through summary or plot functions which display estimated mediation effects for given values of rho.

Usage

## S3 method for class 'medsens':
summary(object, ...) 

## S3 method for class 'summary.medsens': print(x, ...)

Arguments

x
Output from medsens function.
object
Output from medsens function.
...
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
#########################################
#Continuous mediator and continuous outcome
#########################################

#Fit parametric models
model.m <- lm(job_seek ~ treat + depress1, data=jobs)
model.y <- lm(depress2 ~ treat + job_seek + depress1, data=jobs)

#Pass model objects through mediate function
med.cont <- mediate(model.m, model.y, treat="treat", mediator="job_seek", sims=1000)

#Pass mediate output through medsens function
sens.cont <- medsens(med.cont, sims=1000, rho.by=.1)

#Use summary function to display values of rho where 95summary(sens.cont)

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

model.m <- lm(job_seek ~ treat + depress1 + econ_hard + sex + age + occp + marital + nonwhite + educ + income, data=jobs)
model.y <- glm(work1 ~ treat + job_seek + depress1 + econ_hard + sex + age + occp + marital + nonwhite + educ + income, family=binomial(link="probit"), data=jobs)
med.bin <- mediate(model.m, model.y, treat="treat", mediator="job_seek", sims=1000)
sens.bin <- medsens(med.bin, sims=1000, rho.by=.1)
summary(sens.bin)

Run the code above in your browser using DataLab