hima: High-dimensional Mediation Analysis

View source: R/hima.R

himaR Documentation

High-dimensional Mediation Analysis

Description

hima is used to estimate and test high-dimensional mediation effects.

Usage

hima(
  X,
  Y,
  M,
  COV.XM = NULL,
  COV.MY = COV.XM,
  Y.family = c("gaussian", "binomial"),
  M.family = c("gaussian", "negbin"),
  penalty = c("MCP", "SCAD", "lasso"),
  topN = NULL,
  parallel = FALSE,
  ncore = 1,
  scale = TRUE,
  verbose = FALSE,
  ...
)

Arguments

X

a vector of exposure. Do not use data.frame or matrix.

Y

a vector of outcome. Can be either continuous or binary (0-1). Do not use data.frame or matrix.

M

a data.frame or matrix of high-dimensional mediators. Rows represent samples, columns represent variables.

COV.XM

a data.frame or matrix of covariates dataset for testing the association M ~ X. Covariates specified here will not participate penalization. Default = NULL. If the covariates contain mixed data types, please make sure all categorical variables are properly formatted as factor type.

COV.MY

a data.frame or matrix of covariates dataset for testing the association Y ~ M. Covariates specified here will not participate penalization. If not specified, the same set of covariates for M ~ X will be applied. Using different sets of covariates is allowed but this needs to be handled carefully.

Y.family

either 'gaussian' (default) or 'binomial', depending on the data type of outcome (Y). See ncvreg

M.family

either 'gaussian' (default) or 'negbin' (i.e., negative binomial), depending on the data type of mediator (M).

penalty

the penalty to be applied to the model. Either 'MCP' (the default), 'SCAD', or 'lasso'.

topN

an integer specifying the number of top markers from sure independent screening. Default = NULL. If NULL, topN will be either ceiling(n/log(n)) if Y.family = 'gaussian', or ceiling(n/(2*log(n))) if Y.family = 'binomial', where n is the sample size. If the sample size is greater than topN (pre-specified or calculated), all mediators will be included in the test (i.e. low-dimensional scenario).

parallel

logical. Enable parallel computing feature? Default = FALSE.

ncore

number of cores to run parallel computing Valid when parallel == TRUE. By default max number of cores available in the machine will be utilized.

scale

logical. Should the function scale the data? Default = TRUE.

verbose

logical. Should the function be verbose? Default = FALSE.

...

other arguments passed to ncvreg.

Value

A data.frame containing mediation testing results of selected mediators.

  • alpha: coefficient estimates of exposure (X) –> mediators (M).

  • beta: coefficient estimates of mediators (M) –> outcome (Y) (adjusted for exposure).

  • gamma: coefficient estimates of exposure (X) –> outcome (Y) (total effect).

  • alpha*beta: mediation effect.

  • % total effect: alpha*beta / gamma. Percentage of the mediation effect out of the total effect.

  • Bonferroni.p: statistical significance of the mediator (Bonferroni-corrected p value).

  • BH.FDR: statistical significance of the mediator (Benjamini-Hochberg FDR).

References

Zhang H, Zheng Y, Zhang Z, Gao T, Joyce B, Yoon G, Zhang W, Schwartz J, Just A, Colicino E, Vokonas P, Zhao L, Lv J, Baccarelli A, Hou L, Liu L. Estimating and Testing High-dimensional Mediation Effects in Epigenetic Studies. Bioinformatics. 2016. DOI: 10.1093/bioinformatics/btw351. PMID: 27357171. PMCID: PMC5048064

Examples

## Not run: 
# Note: In the following examples, M1, M2, and M3 are true mediators.
data(himaDat)

# When Y is continuous and normally distributed
# Example 1 (continuous outcome): 
head(himaDat$Example1$PhenoData)

hima.fit <- hima(X = himaDat$Example1$PhenoData$Treatment, 
                 Y = himaDat$Example1$PhenoData$Outcome, 
                 M = himaDat$Example1$Mediator,
                 COV.XM = himaDat$Example1$PhenoData[, c("Sex", "Age")],
                 Y.family = 'gaussian',
                 scale = FALSE,
                 verbose = TRUE) 
hima.fit

# When Y is binary (should specify Y.family)
# Example 2 (binary outcome): 
head(himaDat$Example2$PhenoData)

hima.logistic.fit <- hima(X = himaDat$Example2$PhenoData$Treatment,
                          Y = himaDat$Example2$PhenoData$Disease,
                          M = himaDat$Example2$Mediator,
                          COV.XM = himaDat$Example2$PhenoData[, c("Sex", "Age")],
                          Y.family = 'binomial',
                          scale = FALSE,
                          verbose = TRUE)
hima.logistic.fit

## End(Not run)


HIMA documentation built on Sept. 10, 2023, 5:06 p.m.