Title: | Causal Mediation Analysis in Multisite Trials |
---|---|
Description: | We implement multisite causal mediation analysis using the methods proposed by Qin and Hong (in press). It enables causal mediation analysis in multisite trials, in which individuals are assigned to a treatment or a control group at each site. It allows for estimation and hypothesis testing for not only the population average but also the between-site variance of direct and indirect effects. This strategy conveniently relaxes the assumption of no treatment-by-mediator interaction while greatly simplifying the outcome model specification without invoking strong distributional assumptions. |
Authors: | Xu Qin, Guanglei Hong |
Maintainer: | Xu Qin <[email protected]> |
License: | GPL-2 |
Version: | 0.0.1 |
Built: | 2025-02-19 03:58:48 UTC |
Source: | https://github.com/xu-qin/multisitemediation |
Performs causal mediation analysis in multisite trials. It is used to estimate both the population average and between-site variance of direct and indirect effects.
msmediate(data, y, treatment, mediator, X, site)
msmediate(data, y, treatment, mediator, X, site)
data |
The data set for analysis. |
y |
The name of the outcome variable (string). |
treatment |
The name of the treatment variable (string). |
mediator |
The name of the mediator variable (string). |
X |
A vector of variable names (string) of pretreatment confounders, which will be included in the propensity score model. For now, the multilevel propensity score model only allows for one random intercept. |
site |
The variable name for the site ID (string). |
A list contains the estimates of the between-site variance of direct effect, that of indirect effect, and the correlation between the direct and indirect effects across sites ($Random_effects), and the population average direct and indirect effect estimates along with their hypothesis testing results ($Fixed_effects).
Xu Qin and Guanglei Hong
Qin, X., & Hong, G (in press). A weighting method for assessing between-site heterogeneity in causal mediation mechanism. Journal of Educational and Behavioral Statistics.
data(sim) msmediate(data = sim, y = "y", treatment = "tr", mediator = "me", X = c("x1", "x2", "x3"), site = "site")
data(sim) msmediate(data = sim, y = "y", treatment = "tr", mediator = "me", X = c("x1", "x2", "x3"), site = "site")
Performs hypothesis testing for the between-site variance of direct effect and that of indirect effect, besides providing the same output as given by the function msmediate().
vartest.msmediate(data, y, treatment, mediator, X, site, npermute = 200)
vartest.msmediate(data, y, treatment, mediator, X, site, npermute = 200)
data |
The data set for analysis. |
y |
The name of the outcome variable (string). |
treatment |
The name of the treatment variable (string). |
mediator |
The name of the mediator variable (string). |
X |
A vector of variable names (string) of pretreatment confounders, which will be included in the propensity score model. For now, the multilevel propensity score model only allows for one random intercept. |
site |
The variable name for the site ID (string). |
npermute |
The number of permutations for the permutation test. The default value is 200. It may take a long time, depending on the sample size and the length of X. |
A list contains the hypothesis testing results of the between-site variance of the causal effects, besides the same output as given by the function msmediate().
Xu Qin and Guanglei Hong
Qin, X., & Hong, G (in press). A weighting method for assessing between-site heterogeneity in causal mediation mechanism. Journal of Educational and Behavioral Statistics.
data(sim) vartest.msmediate(data = sim, y = "y", treatment = "tr", mediator = "me", X = c("x1", "x2", "x3"), site = "site", npermute = 2)
data(sim) vartest.msmediate(data = sim, y = "y", treatment = "tr", mediator = "me", X = c("x1", "x2", "x3"), site = "site", npermute = 2)