wrap_mediation: Run mediation analysis for a set of markers

Description Usage Arguments Details Value Author(s) Examples

View source: R/hdmax2.R

Description

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

Usage

1
wrap_mediation(qval, X, Y, M, U = NULL, FDR = 0.1, sims = 3, ...)

Arguments

qval

set of qValues from max2() function

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.

M

a response variable matrix with n rows and p columns. Each column corresponds to a beta-normalized methylation profile. Response variables must be encoded as numeric. No NAs allowed.

U

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

FDR

FDR threshold to pass markers in mediation analysis

sims

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

...

argument of the mediate function from the mediation package

Details

We use the mediate() function of the mediation package on the set of markers having a qValue lower than the FDR threshold. 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 Mi and the my table to the regressions of Y on Mi knowing X. With Mi corresponding to the different CpGs 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
library(hdmax2)

data(example)

# 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])

# Run mediation (only 3 simulations for estimate and test indirect effect)

res <- wrap_mediation(qval = res$qval,
                            X = example$X,
                            Y = example$Y,
                            M = example$M,
                            U = U, sims = 3,
                            FDR = 0.5)

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