wrap_mediation_AMR: Run mediation analysis on AMR

Description Usage Arguments Details Value Author(s) Examples

View source: R/hdmax2.R

Description

Estimate various quantities for causal mediation analysis for each AMRs, including average causal mediation effects (indirect effect), average direct effects, proportions mediated, and total effect.

Usage

1
wrap_mediation_AMR(X, Y, AMR, U = NULL, sims = 3)

Arguments

X

an explanatory variable matrix with n rows and d columns. Each column corresponds to a distinct explanatory variable (Exposure). Explanatory variables must be encoded as numeric variables.

Y

an explanatory variable matrix with n rows and d columns. Each column corresponds to a distinct explanatory variable (Outcome). Explanatory variables must be encoded as numeric variables.

AMR

a matrix of DMRs from the AMR_build() function (AMR_mean).

U

set of latent factors from mEWAS() function (need include covariable)

sims

number of Monte Carlo draws for nonparametric bootstrap or quasi-Bayesian approximation. 10000 is recommended.

Details

We use the mediate() function of the mediation package on the set of selected AMRs. This function makes it possible to estimate their indirect effects and to test their significance.

Value

Tables of results of mediation analyzes for markers with a qValue below the FDR threshold. Indirect effect (ACME - average causal mediation effect), ADE (average direct effect), PM (proportion mediated) and TE (total effect). Composition of tables: estimated effect, confidence interval and mediation pValue. We also return, We also return the results of the linear regressions. The xm table corresponds to the regressions of X on DMRi and the my table to the regressions of Y on AMRi knowing X. With AMRi corresponding to the different AMRs tested.

Author(s)

Basile Jumentier

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# library(hdma2)
#
# Run mEWAS
#
# res <- mEWAS(X = example$X, Y = example$Y, M = example$M, K = 5)
#
# Keep latent factors for mediation
#
# U <- res$U
#
# Run max2
#
# res <- max2(pval1 = res$pValue[, 1], pval2 = res$pValue[, 2])
#
# lauch AMR_search
#
# res <- AMR_search(chr = example$annotation$chr,
#                   start = example$annotation$start,
#                   end = example$annotation$end,
#                   pval = res$pval,
#                   cpg = example$annotation$cpg, nCores = 1)
#
# lauch AMR_build
#
# tmp <- AMR_build(res, methylation = example$M, nb_cpg = 2)
#
# mediation for each AMR
#
# res <- wrap_mediation_AMR(X = example$X, Y = example$Y, AMR = tmp$AMR_mean, U = U, sims = 3)

jumentib/hdmax2 documentation built on Feb. 25, 2022, 12:58 p.m.