sens {paths} | R Documentation |
Sensitivity Analysis for Unobserved Confounding on Path-Specific Causal Effects
Description
sens
implements a set of bias formulas detailed in Zhou and Yamamoto (2020) for assessing
the sensitivity of estimated path-specific effects to an unobserved confounder U
of a mediator-outcome
relationship. The user provides a fitted paths
object, the mediator whose relationship
with the outcome is potentially confounded, the estimand whose sensitivity to unobserved
confounding is being investigated, type of estimator, type of decomposition, and possible values of
the \gamma
and \eta
parameters.
Usage
sens(
object,
confounded = "M1",
estimand = "via M1",
estimator = c("pure", "hybrid"),
decomp = c("Type I", "Type II"),
gamma_values = NULL,
eta_values = NULL
)
Arguments
object |
a fitted model object returned by the |
confounded |
a character string indicating the mediator whose relationship with the outcome
is potentially confounded. One of { |
estimand |
a character string indicating the estimand whose sensitivity to unobserved
confounding is being investigated. One of { |
estimator |
type of estimator, the pure imputation estimator ( |
decomp |
type of decomposition, |
gamma_values |
potential values of the |
eta_values |
potential values of the |
Value
A list containing the following elements
- original
original estimate of the corresponding path-specific effect.
- adjusted
a data frame where each row represents a potential combination of
\gamma
and\eta
, the corresponding bias, bias-adjusted estimate, and an indicator for whether the bias-adjusted estimate is of the opposite sign to the original estimate.
References
Zhou, Xiang and Teppei Yamamoto. 2020. "Tracing Causal Paths from Experimental and Observational Data".
See Also
Examples
data(tatar)
m1 <- c("trust_g1", "victim_g1", "fear_g1")
m2 <- c("trust_g2", "victim_g2", "fear_g2")
m3 <- c("trust_g3", "victim_g3", "fear_g3")
mediators <- list(m1, m2, m3)
formula_m0 <- annex ~ kulak + prosoviet_pre + religiosity_pre + land_pre +
orchard_pre + animals_pre + carriage_pre + otherprop_pre + violence
formula_m1 <- update(formula_m0, ~ . + trust_g1 + victim_g1 + fear_g1)
formula_m2 <- update(formula_m1, ~ . + trust_g2 + victim_g2 + fear_g2)
formula_m3 <- update(formula_m2, ~ . + trust_g3 + victim_g3 + fear_g3)
formula_ps <- violence ~ kulak + prosoviet_pre + religiosity_pre +
land_pre + orchard_pre + animals_pre + carriage_pre + otherprop_pre
####################################################
# Causal Paths Analysis using GLM
####################################################
# outcome models
glm_m0 <- glm(formula_m0, family = binomial("logit"), data = tatar)
glm_m1 <- glm(formula_m1, family = binomial("logit"), data = tatar)
glm_m2 <- glm(formula_m2, family = binomial("logit"), data = tatar)
glm_m3 <- glm(formula_m3, family = binomial("logit"), data = tatar)
glm_ymodels <- list(glm_m0, glm_m1, glm_m2, glm_m3)
# propensity score model
glm_ps <- glm(formula_ps, family = binomial("logit"), data = tatar)
# causal paths analysis using glm
# note: For illustration purposes only a small number of bootstrap replicates are used
paths_glm <- paths(a = "violence", y = "annex", m = mediators,
glm_ymodels, ps_model = glm_ps, data = tatar, nboot = 3)
# sensitivity analysis for the path-specific effect via M1
sens_glm <- sens(paths_glm, confounded = "M1", estimand = "via M1",
gamma_values = - seq(0, 0.5, 0.005), eta_values = seq(-0.5, 0.5, 0.005))
plot(sens_glm)