sens: Sensitivity Analysis for Unobserved Confounding on...

Description Usage Arguments Value References See Also Examples

View source: R/sens.R

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 γ and η parameters.

Usage

1
2
3
4
5
6
7
8
9
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 paths function.

confounded

a character string indicating the mediator whose relationship with the outcome is potentially confounded. One of {"M1", "M2", ...}.

estimand

a character string indicating the estimand whose sensitivity to unobserved confounding is being investigated. One of {"M1", "M2", ...} or "direct".

estimator

type of estimator, the pure imputation estimator ("pure") or the imputation-based weighting estimator ("hybrid").

decomp

type of decomposition, "Type I" or "Type II".

gamma_values

potential values of the γ parameter, which denotes the average effect of the unobserved confounder U on the outcome given pretreatment covariates X, treatment A, and mediators M_1,…, M_k. If not provided, it is defaulted to a range of 20 values from -\textup{sd}(Y) to \textup{sd}(Y), where sd denotes standard deviation and Y denotes the outcome variable.

eta_values

potential values of the η parameter, which denotes the difference in the prevalence of the unobserved confounder U between treated and untreated units given pretreatment covariates X and mediators M_1,…, M_k. If not provided, it is defaulted to a range of 20 values from -sd(A) to sd(A), where sd denotes standard deviation and A denotes the treatment variable.

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 γ and η, 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

paths, plot.sens

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
27
28
29
30
31
32
33
34
35
36
37
38
39
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)

paths documentation built on June 18, 2021, 9:07 a.m.