vartest.msmediate {MultisiteMediation} | R Documentation |
Variance testing for multisite causal mediation analysis
Description
This function 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().
Usage
vartest.msmediate(data, y, treatment, mediator, X, site, npermute = 200)
Arguments
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 covariates, 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. |
Value
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().
Author(s)
Xu Qin and Guanglei Hong
References
Qin, X., & Hong, G (2017). A weighting method for assessing between-site heterogeneity in causal mediation mechanism. Journal of Educational and Behavioral Statistics. Journal of Educational and Behavioral Statistics. Journal of Educational and Behavioral Statistics, 42(3), 308-340. doi: 10.3102/1076998617694879
Examples
data(sim)
vartest.msmediate(data = sim, y = "y", treatment = "tr", mediator = "me", X = c("x1",
"x2", "x3", "x4"), site = "site", npermute = 2)