vartest.msmediate.weights: Variance testing for multisite causal mediation analysis in...

Description Usage Arguments Value Author(s) References Examples

View source: R/msmediate.R

Description

This function performs hypothesis testing for the between-site variances of natural direct effect, natural indirect effect, pure indirect effect, and treatment-by-mediator interaction effect in the presence of complex sample and survey designs and non-random nonresponse, besides providing the same output as given by the function msmediate.weights().

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
vartest.msmediate.weights(
  data,
  y,
  treatment,
  mediator,
  response,
  XR1,
  XR0,
  XM1,
  XM0,
  site,
  sample.weight,
  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).

response

The name of the response variable (string), which is equal to 1 if the individual responded and 0 otherwise.

XR1

A vector of variable names (string) of pretreatment covariates in the propensity score model for the response under the treatment condition. For now, the multilevel propensity score model only allows for one random intercept.

XR0

A vector of variable names (string) of pretreatment covariates in the propensity score model for the response under the control condition. For now, the multilevel propensity score model only allows for one random intercept.

XM1

A vector of variable names (string) of pretreatment covariates in the propensity score model for the mediator under the treatment condition. For now, the multilevel propensity score model only allows for one random intercept.

XM0

A vector of variable names (string) of pretreatment covariates in the propensity score model for the mediator under the control condition. For now, the multilevel propensity score model only allows for one random intercept.

site

The variable name for the site ID (string).

sample.weight

The variable name for the sample weight given by design (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, Guanglei Hong, Jonah Deutsch, and Edward Bein

References

Qin, X., Hong, G., Deutsch, J., & Bein, E. (2019). Multisite causal mediation analysis in the presence of complex sample and survey designs and non-random non-response. Journal of the Royal Statistical Society: Series A (Statistics in Society), 182(4), 1343-1370. doi: 10.1111/rssa.12446

Examples

1
2
3
4
5
6
data(sim.weights)

vartest.msmediate.weights(data = sim.weights, y = "y", treatment = "tr", mediator = "me",
    response = "R", XR1 = c("x1", "x2", "x3"), XR0 = c("x1", "x2", "x3"), XM1 = c("x1",
        "x2", "x3"), XM0 = c("x1", "x2", "x3"), site = "site", sample.weight = "WD",
    npermute = 2)

MultisiteMediation documentation built on Sept. 5, 2021, 6:04 p.m.