Title: | An Imputation Approach to Estimating Path-Specific Causal Effects |
---|---|
Description: | In causal mediation analysis with multiple causally ordered mediators, a set of path-specific effects are identified under standard ignorability assumptions. This package implements an imputation approach to estimating these effects along with a set of bias formulas for conducting sensitivity analysis (Zhou and Yamamoto <doi:10.31235/osf.io/2rx6p>). It contains two main functions: paths() for estimating path-specific effects and sens() for conducting sensitivity analysis. Estimation uncertainty is quantified using the nonparametric bootstrap. |
Authors: | Minh Trinh [cre], Teppei Yamamoto [aut], Xiang Zhou [aut] |
Maintainer: | Minh Trinh <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.1.1 |
Built: | 2025-03-05 04:18:26 UTC |
Source: | https://github.com/mdtrinh/paths |
This package implements an imputation approach to estimating path-specific causal effects as detailed in Zhou and Yamamoto (2020). Statistical inference is conducted using the nonparametric bootstrap.
Minh Trinh, Massachusetts Institute of Technology, [email protected]; Teppei Yamamoto, Massachusetts Institute of Technology, [email protected]; Xiang Zhou, Harvard University, [email protected]
Zhou, Xiang and Teppei Yamamoto. 2020. "Tracing Causal Paths from Experimental and Observational Data".
paths
estimates path-specific causal effects in the presence of causally
ordered mediators. It implements the pure imputation estimator and the imputation-based weighting
estimator (when a propensity score model is provided) as detailed in Zhou and Yamamoto (2020).
The user supplies the names of the treatment, outcome, mediator variables,
fitted models
characterizing the conditional mean of the outcome given treatment, pretreatment confounders, and
varying sets of mediators, and a data frame containing all the variables. The function returns
path-specific causal effects that together constitute the total treatment effect.
When
, the path-specific causal effects are identical to the natural direct and indirect
effects in standard causal mediation analysis.
paths( a, y, m, models, ps_model = NULL, data, nboot = 500, conf_level = 0.95, ... ) ## S3 method for class 'paths' print(x, digits = 3, ...)
paths( a, y, m, models, ps_model = NULL, data, nboot = 500, conf_level = 0.95, ... ) ## S3 method for class 'paths' print(x, digits = 3, ...)
a |
a character string indicating the name of the treatment variable. The treatment should be a binary variable taking either 0 or 1. |
y |
a character string indicating the name of the outcome variable. |
m |
a list of |
models |
a list of
The fitted model objects can be of type |
ps_model |
an optional propensity score model for treatment. It can be of type |
data |
a data frame containing all variables. |
nboot |
number of bootstrap iterations for estimating confidence intervals. Default is 500. |
conf_level |
the confidence level of the returned two-sided confidence
intervals. Default is |
... |
additional arguments to be passed to |
x |
a fitted model object returned by the |
digits |
minimal number of significant digits printed. |
An object of class paths
, which is a list containing the
following elements
estimates of direct and path-specific effects via
based on the pure imputation estimator.
estimates of direct and path-specific effects via
based on the imputation-based weighting estimator.
a list of character strings indicating the names of the pretreatment confounders (),
treatment(
), mediators (
), and outcome (
).
formulas for the outcome models.
classes of the outcome models.
model families of the outcome models.
a list containing arguments of the outcome models.
formula for the propensity score model.
class of the propensity score model.
model family of the propensity score model.
arguments of the propensity score model.
the original data.
number of bootstrap iterations.
confidence level for confidence intervals.
output matrix from the bootstrap iterations.
the matched call to the paths
function.
Zhou, Xiang and Teppei Yamamoto. 2020. "Tracing Causal Paths from Experimental and Observational Data".
summary.paths
, plot.paths
, sens
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) #################################################### # Causal Paths Analysis using GBM #################################################### require(gbm) # outcome models gbm_m0 <- gbm(formula_m0, data = tatar, distribution = "bernoulli", interaction.depth = 3) gbm_m1 <- gbm(formula_m1, data = tatar, distribution = "bernoulli", interaction.depth = 3) gbm_m2 <- gbm(formula_m2, data = tatar, distribution = "bernoulli", interaction.depth = 3) gbm_m3 <- gbm(formula_m3, data = tatar, distribution = "bernoulli", interaction.depth = 3) gbm_ymodels <- list(gbm_m0, gbm_m1, gbm_m2, gbm_m3) # propensity score model via gbm gbm_ps <- gbm(formula_ps, data = tatar, distribution = "bernoulli", interaction.depth = 3) # causal paths analysis using gbm # note: For illustration purposes only a small number of bootstrap replicates are used paths_gbm <- paths(a = "violence", y = "annex", m = mediators, gbm_ymodels, ps_model = gbm_ps, data = tatar, nboot = 3)
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) #################################################### # Causal Paths Analysis using GBM #################################################### require(gbm) # outcome models gbm_m0 <- gbm(formula_m0, data = tatar, distribution = "bernoulli", interaction.depth = 3) gbm_m1 <- gbm(formula_m1, data = tatar, distribution = "bernoulli", interaction.depth = 3) gbm_m2 <- gbm(formula_m2, data = tatar, distribution = "bernoulli", interaction.depth = 3) gbm_m3 <- gbm(formula_m3, data = tatar, distribution = "bernoulli", interaction.depth = 3) gbm_ymodels <- list(gbm_m0, gbm_m1, gbm_m2, gbm_m3) # propensity score model via gbm gbm_ps <- gbm(formula_ps, data = tatar, distribution = "bernoulli", interaction.depth = 3) # causal paths analysis using gbm # note: For illustration purposes only a small number of bootstrap replicates are used paths_gbm <- paths(a = "violence", y = "annex", m = mediators, gbm_ymodels, ps_model = gbm_ps, data = tatar, nboot = 3)
paths
ObjectsPlot point estimates and confidence intervals for each individual
path-specific effect from a paths
object.
## S3 method for class 'paths' plot( x, mediator_names = NULL, estimator = c("pure", "hybrid", "both"), decomp = c("Type I", "Type II", "both"), horizontal = (decomp != "both"), ... )
## S3 method for class 'paths' plot( x, mediator_names = NULL, estimator = c("pure", "hybrid", "both"), decomp = c("Type I", "Type II", "both"), horizontal = (decomp != "both"), ... )
x |
an object of class |
mediator_names |
a vector of character strings giving the labels for each
mediator. It must contain as many elements as the number of mediators in the
model. If not supplied, a set of default labels will be constructed from the
fitted |
estimator |
either |
decomp |
either |
horizontal |
a logical variable indicating whether a horizontal plot should be
used. Default is to use a horizontal plot when |
... |
additional arguments. |
a ggplot2
plot, which can be further customized by the user.
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) # plot total, direct, and path-specific effects plot(paths_glm, mediator_names = c("G1 identity", "G2 identity", "G3 identity"), estimator = "both")
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) # plot total, direct, and path-specific effects plot(paths_glm, mediator_names = c("G1 identity", "G2 identity", "G3 identity"), estimator = "both")
sens
ObjectsContour plot for sensitivity analysis objects.
## S3 method for class 'sens' plot( x, outcome_name = "Outcome", x_axis = c("eta_k", "gamma_k"), other = list(`eta_k-1` = NULL, `gamma_k-1` = NULL), ... )
## S3 method for class 'sens' plot( x, outcome_name = "Outcome", x_axis = c("eta_k", "gamma_k"), other = list(`eta_k-1` = NULL, `gamma_k-1` = NULL), ... )
x |
an object of class |
outcome_name |
a character string indicating the name of the outcome. |
x_axis |
sensitivity analysis parameter shown on the x axis. Default is |
other |
a named list indicating the values at which other sensitivity analysis parameters,
namely, |
... |
additional arguments |
a ggplot2
plot, which can be further customized by the user.
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)
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)
Generic function that returns predicted outcomes from lm
, glm
, gbm
, wbart
,
and pbart
objects with new data.
pred(object, newdata, ...) ## S3 method for class 'lm' pred(object, newdata, ...) ## S3 method for class 'glm' pred(object, newdata, ...) ## S3 method for class 'gbm' pred(object, newdata, method = "OOB", ...) ## S3 method for class 'pbart' pred(object, newdata, ...) ## S3 method for class 'wbart' pred(object, newdata, ...)
pred(object, newdata, ...) ## S3 method for class 'lm' pred(object, newdata, ...) ## S3 method for class 'glm' pred(object, newdata, ...) ## S3 method for class 'gbm' pred(object, newdata, method = "OOB", ...) ## S3 method for class 'pbart' pred(object, newdata, ...) ## S3 method for class 'wbart' pred(object, newdata, ...)
object |
a fitted model object, which can be of class |
newdata |
a data frame containing predictor variables. |
... |
additional arguments passed to the |
method |
Method used to determine the optimal number of boosting iterations for |
a vector of expected outcomes for newdata
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 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.
sens( object, confounded = "M1", estimand = "via M1", estimator = c("pure", "hybrid"), decomp = c("Type I", "Type II"), gamma_values = NULL, eta_values = NULL )
sens( object, confounded = "M1", estimand = "via M1", estimator = c("pure", "hybrid"), decomp = c("Type I", "Type II"), gamma_values = NULL, eta_values = NULL )
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 |
A list containing the following elements
original estimate of the corresponding path-specific effect.
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.
Zhou, Xiang and Teppei Yamamoto. 2020. "Tracing Causal Paths from Experimental and Observational Data".
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)
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)
Function to report results from causal paths analysis. Report point estimates and standard errors for the total effect, direct effect, and each individual indirect effect, separately for Type I and Type II decompositions.
## S3 method for class 'paths' summary(object, ...) ## S3 method for class 'summary.paths' print(x, ...)
## S3 method for class 'paths' summary(object, ...) ## S3 method for class 'summary.paths' print(x, ...)
object |
an object of class |
... |
additional arguments to be passed to |
x |
an object of class |
print.summary.paths
tries to smartly format the point
estimates and confidence intervals, and provides 'significance stars'
through the printCoefmat
function.
It also prints out the names of the treatment, outcome, mediator variables as well
as pretreatment covariates, which are extracted from the formulas
argument of the
call to paths
so that users can verify if the model formulas have been
correctly specified.
An object of class summary.paths
, which is a list containing
the call
, varnames
, formulas
, classes
,
args
, ps_formula
, ps_class
, ps_args
,
nboot
, conf_level
components from the paths
object,
plus
number of observations in data
a
list containing four matrices, corresponding to effect estimates obtained
using the pure imputation estimator and the imputation-based weighting
estimator, each with Type I and Type II decompositions. Each matrix
contains the point estimates, standard errors, and confidence intervals of
the total effect, direct effect, and each individual indirect effect
for the corresponding decomposition. The elements in each matrix
are extracted from the paths
object.
paths
, print.paths
, plot.paths
# **For illustration purposes a small number of bootstrap replicates are used** 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) # plot total, direct, and path-specific effects summary(paths_glm)
# **For illustration purposes a small number of bootstrap replicates are used** 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) # plot total, direct, and path-specific effects summary(paths_glm)
A dataset of 427 Crimean Tatars including variables on ancestor victimization, political identities of first-, second- and third-generation respondents, and political attitudes toward Russia's annexation of Crimea (Lupu and Peisakhin 2017).
tatar
tatar
A data frame with 427 rows and 19 columns:
Whether the first-generation respondent had close relatives subject to dekulakization. 0: no; 1: yes.
Whether the first-generation respondent's close relatives privately supported or opposed Soviet authorities. 1: opposed; 2: indifferent; 3: supported.
How important it was for the first-generation respondent's family to follow Islamic customs and traditions while in deportation. 1: not at all important; 2: somewhat important; 3: very important.
Whether the first-generation respondent's close relatives owned agricultural land. 0: no; 1: some; 2: a lot.
Whether the first-generation respondent's close relatives owned orchards. 0: no; 1: yes.
Whether the first-generation respondent's close relatives owned pasture animals. 0: no; 1: some; 2: a lot.
Whether the first-generation respondent's close relatives owned horse-drawn carriages. 0: no; 1: yes.
Whether the first-generation respondent's close relatives owned other substantial property. 0: no; 1: yes.
Whether the first-generation respondent had a family member who died due to poor conditions during the 1944-45 deportation to Crimea. 0: no; 1: yes.
Whether the first-generation respondent trusts Crimean Tatars more than Russians. 1: trusts Crimean Tatars more; 0: indifferent; -1: trusts Russians more.
Whether the first-generation respondent consider them or their close relatives victims of the Soviet political system. 0: no; 1: yes.
Whether the first-generation respondent started to fear concerning their future after the March referendum. 0: no; 1: yes.
The degree to which second-generation respondents trust Crimean Tatars more than Russians, ranging from -1 to 1 (averaged over multiple respondents).
The degree to which second-generation respondents consider them or their close relatives victims of the Soviet political system, ranging from 0 to 1 (averaged over multiple respondents).
The degree to which second-generation respondents started to fear concerning their future after the March referendum, ranging from 0 to 1 (averaged over multiple respondents).
Whether the third-generation respondent trusts Crimean Tatars more than Russians. 1: trusts Crimean Tatars more; 0: indifferent; -1: trusts Russians more.
Whether the third-generation respondent considers them or their close relatives victims of the Soviet political system. 0: no; 1: yes.
Whether the third-generation respondent started to fear concerning their future after the March referendum. 0: no; 1: yes.
Whether the third-generation respondent supports Russia’s annexation of Crimea. 0: no; 1: yes.
Lupu, Noam and Leonid Peisakhin. 2017. "The Legacy of Political Violence across Generations.” American Journal of Political Science 61(4):836-851.
A dataset of 213 Danish students containing variables on gender, education, political interest, ideology, political knowledge, extremity of political values, treatment assignment (job/poor frame), beliefs about why some people receive welfare benefits, perceived importance of different considerations related to welfare policy, and support for a proposed welfare reform (Slothuus 2008; Imai and Yamamoto 2013).
welfare
welfare
A data frame with 213 rows and 15 columns:
Gender. 0: Female; 1: Male.
Level of education. 1: the municipal primary and lower secondary school before ninth form; 2: the municipal primary and lower secondary school after ninth or tenth form; 3: Basic schooling; 4: Vocational education; 5: Higher preparatory examination course student 6: Upper secondary school student; 7: Higher commercial examination student 8: Higher technical examination student; 9: Short-term further education; 10: Medium-term further education; 11: Long-term further education; 12: Foreign education; 13: Else.
Political interest, measured on a 0-4 scale.
Ideological self-placement on a 1-8 scale. A larger value denotes a more right-wing position.
Political knowledge. 1: low; 2: medium; 3: high.
Extremity of political values. 0: moderate. 1: extreme.
Treatment assignment. Whether the respondent read a newspaper article that highlighted the positive effect of welfare reform on job creation (1) versus one emphasizing its negative effect on the poor (0).
The degree to which the respondent attributes welfare recipiency to internal factors, measured on a 0-1 scale.
The degree to which the respondent attributes welfare recipiency to external factors, measured on a 0-1 scale.
How important the respondent thinks that there should always be an incentive for people to take a job instead of receiving welfare benefits, measured on a 0-1 scale.
How important the respondent thinks that nobody should live in poverty, measured on a 0-1 scale.
How important the respondent thinks that government expenditures on welfare benefits should not be too expensive, measured on a 0-1 scale.
How important the respondent thinks that no defrauder should receive welfare benefits, measured on a 0-1 scale.
How important the respondent thinks that the unemployed should have benefit rates making it possible to maintain a decent standard of living conditions, measured on a 0-1 scale.
Support for the proposed welfare reform, measured on a seven-point scale.
Slothuus, Rune. 2008. "More than Weighting Cognitive Importance: A Dual-process Model of Issue Framing Effects." Political Psychology 29(1):1-28.
Imai, Kosuke and Teppei Yamamoto. 2013. "Identification and Sensitivity Analysis for Multiple Causal Mechanisms: Revisiting Evidence from Framing Experiments." Political Analysis 21(2):141-171.