R: Bootstrap Method for Inference on Multilevel Mediation...
boot.mlma
R Documentation
Bootstrap Method for Inference on Multilevel Mediation Analysis
Description
Bootstrap samples are selected from the original data set. The bootstrap sample has the same number of groups and in each group, the same number of observations as in the original data set. Based on each bootstrap sample, a multilevel mediation analysis is done and the results saved to make inferences on the total, direct and indirect effects.
True if the outcome is binary, otherwise False. Default is False.
x
the vector of the predictive variable.
levelx
the level of x (1 or 2), 1 by default.
levely
the level of y (1 or 2), 1 by default.
m
the matrix or vector of mediators.
l1
the column numbers of level 1 continuous mediators in m.
l2
the column numbers of level 2 continuous mediators in m.
c1
the column numbers of level 1 categorical mediators in m.
c1r
the reference groups of categorical mediators specified by c1.
c2
the column numbers of level 2 categorical mediators in m.
c2r
the reference groups of categorical mediators specified by c2.
f01y
the transformation function expressions on level 2 predictive variable (x.j) in explaining y (eg, c("x^2","log(x)")).
f10y
the transformation function expressions on level 1 predictive variable (xij-x.j) in explaining y.
f02ky
the transformation-function-expression list on level 2 mediators (m.jk) in explaining y (eg, list(2:3,c("log(x)","sqrt(x)"), "2*x")). The first item lists column numbers of the level 2 mediators in m, which needs to be transformed. By that order, each of the rest items of f01ky list the transformation functional expressions for each mediator. The mediators not specified in the list will not be transformed in any way.
f20ky
the transformation-function-expression list on level 1 mediators (mijk-m.jk) in explaining y.The first item lists column numbers of the level 1 mediators in m, which needs to be transformed. By that order, each of the rest items of f02ky list the transformation functional expressions for each mediator. The mediators not specified in the list will not be transformed in any way.
f01km1
the transformation-function-expression list on level 2 predictor (x.j) in explaining the level 1 mediators. The first item lists column numbers of the level 1 mediators in m, which should be explained by the transformed predictor(s). By that order, each of the rest items of f01km1 lists the transformation functional expressions for the (aggregated) level 2 predictor in explaining each mediator. The mediators not specified in the list will be explained by the original format of the level 2 predictor only.
f01km2
the transformation-function-expression list on level 2 predictor (x.j) in explaining the level 2 mediators. The first item lists column numbers of the level 2 mediators in m, which should be explained by the transformed level 2 predictor(s). By that order, each of the rest items of f01km2 lists the transformation functional expressions for the predictor in explaining each mediator. The mediators not specified in the list will be explained by the original format of the (aggregated) level 2 predictor only.
f10km
the transformation-function-expression list on level 1 predictor (xij-x.j) in explaining the level 1 mediators. The first item lists column numbers of the level 1 mediators in m, which should be explained by the transformed level 1 predictor(s). By that order, each of the rest items of f10km lists the transformation functional expressions for the level 1 predictor in explaining each mediator. The mediators not specified in the list will be explained by the original format of the level 1 predictor only.
level
a vector that record the group number for each observation.
weight
the weight of cases in groups.
random
the random effect part for the full model. random = "(1|level)" by default.
random.m1
the random effect part for model explaining the mediators. All other random effects are random = "(1|level)" if not specified here.
intercept
True if fit an intercept to models, by default.
w2
the weight for observations at level 2, which should be the same order as unique(level[!is.na(level)]).
boot
the number of bootstrapping samples.
seed
set seed, default is 1.
covariates
the covariates matrix to explain the outcome, y, and/or the mediators, m.
cy1
the column numbers of covariates that are level 1 and used to explain y.
cy2
the column numbers of covariates that are level 2 and used to explain y.
cm
the column numbers of covariates that are used to explain m. cm[[1]] gives the mediators (in l1, cl, l2, or c2) that can be partially explained by covariates. Each of the rest items of the cm list shows the column number(s) in covariates that should be used to explain each mediator listed in cm[[1]] and by that order.For example, joint=list(1,c("m.2","m.4")) means find the joint effects of level 1 mediators m.2 and m.4.
joint
the list of group(s) of mediators whose joint mediation effect is of interests. joint[[1]] list the levels of mediators in each group and by the order of the list. Note that if any mediator in the group is of level 2, the level of the group should be 2.
Note that in the models, mathbf{f}(cdot)=(f_1(cdot), f_2(cdot), cdots, f_l(cdot))^T is a set of l transformation functions on cdot, with the corresponding linear coefficients vector oldsymbol{β}=(β_1, β_2, cdots, β_l)^T. mathbf{f} and l are known for model fitting. l may be different with mathbf{f} of different sub- and super-scripts.
Value
Return a "mlma.boot" mode list, which include the following items:
de1
an n by boot matrix, where each column is the level 1 direct effects from one bootstrap sampling. n is the number of observations in the original data.
de2
an g by boot matrix, where each column is the level 2 direct effects from one bootstrap sampling. g is the number of groups in the original data.
ie1
an v1 by n*boot matrix, where each column is the level 1 indirect effects from the boot bootstrap samples for one level 1 mediator. v1 is the number of level 1 mediators.
ie1
an v2 by g*boot matrix, where each column is the level 2 indirect effects from the boot bootstrap samples for one level 2 mediator. v2 is the number of level 2 mediators.
ie12
an v1 by g*boot matrix, where each column is the aggregated level 2 indirect effects from the boot bootstrap samples for one level 1 mediator. v1 is the number of level 1 mediators.
sum.boot1
summary results of level 1 mediation effects from bootstrap sample.
sum.boot2
summary results of level 2 mediation effects from bootstrap sample.
full
an "mlma" results using the original data set.
xboot
a n*boot vector of the level 1 predictors in all boot bootstrap samples.
xjboot
a g*boot vector of the (aggregated) level 2 predictors in all boot bootstrap samples.
levelx
inherited from the same argument.
level
inherited from the same argument.
Author(s)
Qingzhao Yu (qyu@lsuhsc.edu), Bin Li (bli@lsu.edu).