Learn R Programming

moderate.mediation (version 0.0.11)

sens.plot: Simulation-Based Sensitivity Analysis Plot for Causal Moderated Mediation Analysis

Description

Simulation-Based Sensitivity Analysis Plot for Causal Moderated Mediation Analysis

Usage

sens.plot(object, sens.results, effect)

Value

Sensitivity analysis plots for the causal effects in the causal moderated mediation analysis.

Arguments

object

Output from the modmed function.

sens.results

An output from the modmed.sens function.

effect

The name of the effect whose sensitivity analysis results are to be plotted (string). Only one effect is plotted at a time. It can be specified as "TIE", "PIE", "PDE", "TDE", "INT", "TIE.ref", "PIE.ref", "PDE.ref", "TDE.ref", "INT.ref", "TIE.dif", "PIE.dif", "PDE.dif", "TDE.dif", or "INT.dif". It must be included in sens.effect when running the modmed.sens function.

Author

Xu Qin and Fan Yang

References

Qin, X., & Yang, F. (2020). Simulation-Based Sensitivity Analysis for Causal Mediation Studies.

Examples

Run this code
# \donttest{
data(newws)
modmed.results = modmed(data = newws, treatment = "treat", mediator = "emp",
    outcome = "depression", covariates.disc = c("emp_prior", "nevmar",
        "hispanic", "nohsdip"), covariates.cont = c("workpref", "attitude",
        "depress_prior"), moderators.disc = "CHCNT", moderators.cont = "ADCPC",
    m.model = list(intercept = c("ADCPC", "CHCNT"), treatment = c("ADCPC",
        "CHCNT"), emp_prior = NULL, nevmar = NULL, hispanic = NULL,
        nohsdip = NULL, workpref = NULL, attitude = NULL, depress_prior = NULL),
    y.model = list(intercept = c("ADCPC", "CHCNT"), treatment = c("ADCPC",
        "CHCNT"), mediator = c("ADCPC", "CHCNT"), tm = c("ADCPC",
        "CHCNT"), emp_prior = NULL, nevmar = NULL, hispanic = NULL,
        nohsdip = NULL, workpref = NULL, attitude = NULL, depress_prior = NULL),
    comp.mod.disc.values = 3, ref.mod.disc.values = 2, comp.mod.cont.values = 5050,
    ref.mod.cont.values = 5050, m.scale = "binary", y.scale = "continuous",
    seed = 1)
sens.results = modmed.sens(modmed.results, sens.effect = "TIE.ref",
    U.scale = "binary", grid.b.m = 2, grid.b.y = 2, iter = 2, nsim = 2,
    ncore = 1)
sens.plot(modmed.results, sens.results, "TIE.ref")
# }

Run the code above in your browser using DataLab