brainGraph_mediate performs simple mediation analyses in which a given
graph- or vertex-level measure (e.g., weighted global efficiency) is
the mediator M. The outcome (or dependent/response) variable Y
can be a neuropsychological measure (e.g., IQ) or can be a
disease-specific metric (e.g., recovery time).
bg_to_mediate converts the results into an object of class
mediate. In brainGraph, it is only used for
the summary.mediate method, but you can similarly
use its output for the plot.mediate method.
brainGraph_mediate(g.list, covars, mediator, treat, outcome, covar.names,
level = c("graph", "vertex"), control.value = 0, treat.value = 1,
int = FALSE, boot = TRUE, boot.ci.type = c("perc", "bca"),
N = 1000, conf.level = 0.95, long = FALSE, ...)# S3 method for bg_mediate
summary(object, mediate = FALSE, region = NULL,
digits = max(3L, getOption("digits") - 2L), ...)
bg_to_mediate(x, region = NULL)
An object of class bg_mediate with elements:
Either graph or vertex.
A character vector of Study.ID's removed due to incomplete data
Design matrix and numeric array for the model with the
mediator as the outcome variable (X.m) and for the model with the
mediator as an additional predictor (X.y), respectively
Outcome variables for the associated design matrices above.
y.m will be a matrix of size # subj. X # regions
A data.table of the observed values of the point
estimates.
A data.table of the confidence intervals for the
effect estimates.
A data.table of the two-sided p-values for the effect
estimates
Logical, the boot argument.
Character string indicating which type of bootstrap confidence intervals were calculated.
A data.table with N rows of the bootstrap
results for all effects.
Character string of the treatment variable.
Character string of the mediator variable.
Character string of the outcome variable.
Returns NULL; not used in this package.
Logical indicating whether the models included an interaction between treatment and mediator.
The confidence level.
The value of the treatment variable used as the control condition.
The value of the treatment variable used as the treatment condition.
Integer; the number of observations in the models.
Integer; the number of bootstrap replications.
The pre-treatment covariate names.
bg_to_mediate returns an object of class mediate
A brainGraphList object
A data table containing covariates of interest. It must include
columns for getOption('bg.subject_id'), treat,
outcome, and covar.names.
Character string; the name of the graph measure acting as the mediating variable
Character string; the treatment variable (e.g., Group)
Character string; the name of the outcome variable of interest
Character vector of the column name(s) in covars to
include in the models as pre-treatment covariate(s).
Character string; either vertex (default) or
graph
Value of treat to be used as the control
condition. Default: 0
Value of treat to be used as the treatment
condition. Default: 1
Logical indicating whether or not to include an interaction of the
mediator and treatment. Default: FALSE
Logical indicating whether or not to perform bootstrapping. This
should always be done. Default: TRUE
Character string; which type of CI's to calculate.
Default: perc
Integer; the number of bootstrap samples to run. Default:
1e3
Numeric between 0 and 1; the level of the CI's to
calculate. Default: 0.95 for the 2.5 and 97.5 percentiles)
Logical indicating whether or not to return all bootstrap
samples. Default: FALSE
Other arguments passed to brainGraph_GLM_design
(e.g., binarize) (unused in the summary method)
A bg_mediate object
Logical indicating whether or not to use the summary
method from mediate (default: FALSE). If
TRUE, only a single region can be printed.
Character string specifying which region's results to
summarize; only relevant if level='vertex' (default: NULL)
Integer specifying the number of digits to display for P-values
Object output from brainGraph_mediate
Christopher G. Watson, cgwatson@bu.edu
This code was adapted closely from mediate in the
mediation package, and the procedure is exactly the same as theirs
(see the references listed below). If you use this function, please cite
their work.
Tingley, D. and Yamamoto, T. and Hirose, K. and Keele, L. and Imai, K. (2014) mediation: R package for causal mediation analysis. Journal of Statistical Software, 59(5), 1--38. tools:::Rd_expr_doi("10.18637/jss.v059.i05")
Imai, K. and Keele, L. and Yamamoto, T. (2010) Identification inference, and sensitivity analysis for causal mediation effects. Statistical Science, 25(1), 51--71. tools:::Rd_expr_doi("10.1214/10-STS321")
Imai, K. and Keele, L. and Tingley, D. (2010) A general approach to causal mediation analysis. Psychological Methods, 15(4), 309--334. tools:::Rd_expr_doi("10.1037/a0020761")
Imai, K. and Keele, L. and Tingley, D. and Yamamoto, T. (2011) Unpacking the black box of causality: learning about causal mechanisms from experimental and observational studies. American Political Science Review, 105(4), 765--789. tools:::Rd_expr_doi("10.1017/S0003055411000414")
Imai, K. and Yamamoto, T. (2013) Identification and sensitivity analysis for multiple causal mechanisms: revisiting evidence from framing experiments. Political Analysis, 21(2), 141--171. tools:::Rd_expr_doi("10.1093/pan/mps040")
mediate
Other Group analysis functions: Bootstrapping,
GLM, NBS,
brainGraph_permute, mtpc
if (FALSE) {
med.EglobWt.FSIQ <- brainGraph_mediate(g[[5]], covars.med, 'E.global.wt',
'Group', 'FSIQ', covar.names=c('age', 'gender'), N=1e4)
med.strength.FSIQ <- brainGraph_mediate(g[[5]], covars.med, 'strength',
'Group', 'FSIQ', covar.names=c('age', 'gender'), level='vertex')
}
Run the code above in your browser using DataLab