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 |
Subsidiary function to check correctness of data structure and return final data for analysis
checkData(Y,T1,T2,M,data = NULL)
checkData(Y,T1,T2,M,data = NULL)
Y |
numeric outcome variable. Should be a vector if a data frame is not provided through the |
T1 |
binary indicator for first treatment. Should be a vector if a data frame is not provided through the |
T2 |
binary indicator for second treatment. Should be a vector if a data frame is not provided through the |
M |
numeric mediator variable. Should be a vector if a data frame is not provided through the |
data |
an optional data frame containing the variables to be used in analysis. |
A data frame that contains the final data to be analyzed in the getCCM()
function.
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.
Kirk Bansak and Xiaohan Wu
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.
data(ICAapp) final.dat <- checkData(Y = "dapprp", T1 = "trt1", T2 = "trt2", M = "immorp", data = ICAapp)
data(ICAapp) final.dat <- checkData(Y = "dapprp", T1 = "trt1", T2 = "trt2", M = "immorp", data = ICAapp)
Subsidiary function to assess interactions between treatments and mediator
checkInteraction(para.df,sigLevel = 0.05)
checkInteraction(para.df,sigLevel = 0.05)
para.df |
a data frame containing the final data to be analyzed, generated using |
sigLevel |
significance level used to conduct hypothesis tests. |
logical. 1 if there is evidence of interaction between treatment(s) and mediator.
This function is called internally and should not be used directly.
Kirk Bansak and Xiaohan Wu
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.
data(ICAapp) final.dat <- checkData(Y = "dapprp", T1 = "trt1", T2 = "trt2", M = "immorp", data = ICAapp) checkInteraction(final.dat,sigLevel = 0.05)
data(ICAapp) final.dat <- checkData(Y = "dapprp", T1 = "trt1", T2 = "trt2", M = "immorp", data = ICAapp) checkInteraction(final.dat,sigLevel = 0.05)
Subsidiary function to determine appropriate output and calculate confidence intervals
decideOutput(para.df,noInteraction = TRUE, sigLevel = 0.05,boots = 1000)
decideOutput(para.df,noInteraction = TRUE, sigLevel = 0.05,boots = 1000)
para.df |
a data frame containing the final data to be analyzed, generated using |
noInteraction |
logical. If |
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. |
A list containing confidence intervals along with flags indicating the appropriate output to return to getCCM()
.
This function is called internally and should not be used directly.
Kirk Bansak and Xiaohan Wu
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.
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.
getCCM(Y,T1,T2,M,data = NULL, noInteraction = TRUE,sigLevel = 0.05, boots = 1000)
getCCM(Y,T1,T2,M,data = NULL, noInteraction = TRUE,sigLevel = 0.05, boots = 1000)
Y |
numeric outcome variable. Should be a vector if a data frame is not provided through the |
T1 |
binary indicator for first treatment. Should be a vector if a data frame is not provided through the |
T2 |
binary indicator for second treatment. Should be a vector if a data frame is not provided through the |
M |
numeric mediator variable. Should be a vector if a data frame is not provided through the |
data |
an optional data frame containing the variables to be used in analysis. |
noInteraction |
logical. If |
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. |
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.
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.
Kirk Bansak and Xiaohan Wu
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.
#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)
#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 used to illustrate comparative causal mediation analysis methods in Bansak (2020).
ICAapp
ICAapp
a data frame with 14 variables
Anonymized respondent id.
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).
Indicator for disapproval of U.S. government's decision. Dichotomized version of 'appr', with 1 indicating "Disapprove" or "Disapprove Strongly", and 0 otherwise.
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).
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.
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).
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.
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).
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.
Indicator for assignment to informal commitment treatment condition.
Indicator for assignment to legal commitment treatment condition.
Age of respondent.
Indicator for whether respondent is male (1) or female (0).
Highest level of education achieved by respondent, including less than high school (1), high school (2), some college (3), and college graduate (4).
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.