Package 'ccmEstimator'

Title: Comparative Causal Mediation Estimation
Description: Functions to perform comparative causal mediation analysis to compare the mediation effects of different treatments via a common mediator. Results contain the estimates and confidence intervals for the two comparative causal mediation analysis estimands, as well as the ATE and ACME for each treatment. Functions provided in the package will automatically assess the comparative causal mediation analysis scope conditions (i.e. for each comparative causal mediation estimand, a numerator and denominator that are both estimated with the desired statistical significance and of the same sign). Results will be returned for each comparative causal mediation estimand only if scope conditions are met for it. See details in Bansak(2020)<doi:10.1017/pan.2019.31>.
Authors: Kirk Bansak [aut], Xiaohan Wu [aut, cre]
Maintainer: Xiaohan Wu <[email protected]>
License: GPL-3
Version: 1.0.0
Built: 2024-11-09 03:37:04 UTC
Source: https://github.com/xiw021/ccmestimator

Help Index


Subsidiary Function for Comparative Causal Mediation Analysis

Description

Subsidiary function to check correctness of data structure and return final data for analysis

Usage

checkData(Y,T1,T2,M,data = NULL)

Arguments

Y

numeric outcome variable. Should be a vector if a data frame is not provided through the data argument, or the ("character") name of the variable in the data frame if provided.

T1

binary indicator for first treatment. Should be a vector if a data frame is not provided through the data argument, or the ("character") name of the variable in the data frame if provided.

T2

binary indicator for second treatment. Should be a vector if a data frame is not provided through the data argument, or the ("character") name of the variable in the data frame if provided.

M

numeric mediator variable. Should be a vector if a data frame is not provided through the data argument, or the ("character") name of the variable in the data frame if provided.

data

an optional data frame containing the variables to be used in analysis.

Value

A data frame that contains the final data to be analyzed in the getCCM() function.

Note

This function is called internally but may be used directly to recover final data set that can be used for analysis in the getCCM() function.

Author(s)

Kirk Bansak and Xiaohan Wu

References

Bansak, K. (2020). Comparative causal mediation and relaxing the assumption of no mediator-outcome confounding: An application to international law and audience costs. Political Analysis, 28(2), 222-243.

Examples

data(ICAapp)
final.dat <- checkData(Y = "dapprp", T1 = "trt1", T2 = "trt2", M = "immorp", data = ICAapp)

Subsidiary Function for Comparative Causal Mediation Analysis

Description

Subsidiary function to assess interactions between treatments and mediator

Usage

checkInteraction(para.df,sigLevel = 0.05)

Arguments

para.df

a data frame containing the final data to be analyzed, generated using checkData().

sigLevel

significance level used to conduct hypothesis tests.

Value

logical. 1 if there is evidence of interaction between treatment(s) and mediator.

Note

This function is called internally and should not be used directly.

Author(s)

Kirk Bansak and Xiaohan Wu

References

Bansak, K. (2020). Comparative causal mediation and relaxing the assumption of no mediator-outcome confounding: An application to international law and audience costs. Political Analysis, 28(2), 222-243.

Examples

data(ICAapp)
final.dat <- checkData(Y = "dapprp", T1 = "trt1", T2 = "trt2", M = "immorp", data = ICAapp)
checkInteraction(final.dat,sigLevel = 0.05)

Subsidiary Function for Comparative Causal Mediation Analysis

Description

Subsidiary function to determine appropriate output and calculate confidence intervals

Usage

decideOutput(para.df,noInteraction = TRUE,
  sigLevel = 0.05,boots = 1000)

Arguments

para.df

a data frame containing the final data to be analyzed, generated using checkData().

noInteraction

logical. If TRUE (the default), the assumption of no interaction between the treatments and mediator is employed in the analysis.

sigLevel

significance level to use in construction of confidence intervals. Default is 0.05 (i.e. 95 percent confidence intervals).

boots

number of bootstrap resamples taken for construction of confidence intervals.

Value

A list containing confidence intervals along with flags indicating the appropriate output to return to getCCM().

Note

This function is called internally and should not be used directly.

Author(s)

Kirk Bansak and Xiaohan Wu

References

Bansak, K. (2020). Comparative causal mediation and relaxing the assumption of no mediator-outcome confounding: An application to international law and audience costs. Political Analysis, 28(2), 222-243.


Comparative Causal Mediation Analysis

Description

Function to perform comparative causal mediation analysis to compare the mediation effects of different treatments via a common mediator. Function requires two separate treaments (as well as a control condition) and one mediator.

Usage

getCCM(Y,T1,T2,M,data = NULL,
  noInteraction = TRUE,sigLevel = 0.05,
  boots = 1000)

Arguments

Y

numeric outcome variable. Should be a vector if a data frame is not provided through the data argument, or the ("character") name of the variable in the data frame if provided.

T1

binary indicator for first treatment. Should be a vector if a data frame is not provided through the data argument, or the ("character") name of the variable in the data frame if provided.

T2

binary indicator for second treatment. Should be a vector if a data frame is not provided through the data argument, or the ("character") name of the variable in the data frame if provided.

M

numeric mediator variable. Should be a vector if a data frame is not provided through the data argument, or the ("character") name of the variable in the data frame if provided.

data

an optional data frame containing the variables to be used in analysis.

noInteraction

logical. If TRUE (the default), the assumption of no interaction between the treatments and mediator is employed in the analysis.

sigLevel

significance level to use in construction of confidence intervals. Default is 0.05 (i.e. 95 percent confidence intervals).

boots

number of bootstrap resamples taken for construction of confidence intervals.

Details

Function will automatically assess the comparative causal mediation analysis scope conditions (i.e. for each comparative causal mediation estimand, a numerator and denominator that are both estimated with the desired statistical significance and of the same sign). Results will be returned for each comparative causal mediation estimand only if scope conditions are met for it. See "Scope Conditions" section in Bansak (2020) for more information. Results will also be returned for the ATE and ACME for each treatment.

If noInteraction = TRUE (the default setting), function will automatically assess the possibility of interactions between treatments and mediator and return a warning in case evidence of such interactions are found.

Value

A ccmEstimation object, which contains the estimates and confidence intervals for the two comparative causal mediation analysis estimands, as well as the ATE and ACME for each treatment. Note, however, that the individual ACME estimates are reported only for descriptive purposes, as the comparative causal mediation analysis methods are not designed to produce unbiased or consistent estimates of the individual ACMEs (see Bansak 2020 for details). Users should consider alternative methods if interested in individual ACME estimates.

User should input the ccmEstimation object into the summary() function to view the estimation results. Note also that the comparative causal mediation analysis results and interpretation of the results will be printed in the console.

Author(s)

Kirk Bansak and Xiaohan Wu

References

Bansak, K. (2020). Comparative causal mediation and relaxing the assumption of no mediator-outcome confounding: An application to international law and audience costs. Political Analysis, 28(2), 222-243.

Examples

#Example from application in Bansak (2020)
data(ICAapp)
set.seed(321, kind = "Mersenne-Twister", normal.kind = "Inversion")
ccm.results <-
   getCCM(Y = "dapprp", T1 = "trt1", T2 = "trt2", M = "immorp", data = ICAapp,
   noInteraction = TRUE, sigLevel = 0.05, boots = 1000)
summary(ccm.results)

Application data

Description

Application data used to illustrate comparative causal mediation analysis methods in Bansak (2020).

Usage

ICAapp

Format

a data frame with 14 variables

respid

Anonymized respondent id.

appr

Approval of U.S. government's decision. Response options include "Approve Strongly" (1), "Approve" (2), "Neither Approve nor Disapprove" (3), "Disapprove" (4), and "Disapprove Strongly" (5).

dapprp

Indicator for disapproval of U.S. government's decision. Dichotomized version of 'appr', with 1 indicating "Disapprove" or "Disapprove Strongly", and 0 otherwise.

vote

Propensity to reward/punish U.S. Senator who supported U.S. government's decision, in the form of increased/decreased willingness to vote for Senator. Response options include "Increase Greatly" (1), "Increase" (2), "Neither Increase nor Decrease" (3), "Decrease" (4), and "Decrease Greatly" (5).

nvotep

Indicator for being less likely to vote for U.S. Senator who supported U.S. government's decision. Dichotomized version of 'vote', with 1 indicating "Decrease" or "Decrease Greatly", and 0 otherwise.

moral

Perceived immorality of U.S. government's decision. Response options include "Definitely Right" (1), "Probably Right" (2), "Not Morally Right or Wrong" (3), "Probably Wrong" (4), and "Definitely Wrong" (5).

immorp

Indicator for perceiving U.S. government's decision to be morally wrong. Dichotomized version of 'moral', with 1 indicating "Probably Wrong" or "Definitely Wrong", and 0 otherwise.

retal

Belief regarding whether U.S. government's decision would encourage adversaries to follow suit in the future. Response options include "Agree Strongly" (1), "Agree" (2), "Neither Agree nor Disagree" (3), "Disagree" (4), and "Disagree Strongly" (5).

retalp

Indicator for belief that U.S. government's decision would encourage adversaries to follow suit in the future. Dichotomized version of 'retal', with 1 indicating "Agree" or "Agree Strongly", and 0 otherwise.

trt1

Indicator for assignment to informal commitment treatment condition.

trt2

Indicator for assignment to legal commitment treatment condition.

age

Age of respondent.

male

Indicator for whether respondent is male (1) or female (0).

educ

Highest level of education achieved by respondent, including less than high school (1), high school (2), some college (3), and college graduate (4).

References

Bansak, K. (2020). Comparative causal mediation and relaxing the assumption of no mediator-outcome confounding: An application to international law and audience costs. Political Analysis, 28(2), 222-243.