Learn R Programming

HIMA (version 2.2.0)

hima: 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,
  ...
)

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 procedure).

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

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'. See ncvreg.

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.

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

Run this code
if (FALSE) {
# When Y is continuous and normally distributed
# Example 1 (continuous outcome): 
data(Example1)
head(Example1$PhenoData)

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

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

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

Run the code above in your browser using DataLab