hima {HIMA} | R Documentation |
hima
is used to estimate and test high-dimensional mediation effects.
hima(X, Y, M, COV.XM = NULL, COV.MY = COV.XM, family = c("gaussian",
"binomial"), penalty = c("MCP", "SCAD", "lasso"), topN = NULL,
parallel = FALSE, ncore = 1, verbose = FALSE, ...)
X |
a vector of exposure. |
Y |
a vector of outcome. Can be either continuous or binary (0-1). |
M |
a |
COV.XM |
a |
COV.MY |
a |
family |
either 'gaussian' or 'binomial', depending on the data type of outcome ( |
penalty |
the penalty to be applied to the model. Either 'MCP' (the default), 'SCAD', or
'lasso'. See |
topN |
an integer specifying the number of top markers from sure independent screening.
Default = |
parallel |
logical. Enable parallel computing feature? Default = |
ncore |
number of cores to run parallel computing Valid when |
verbose |
logical. Should the function be verbose? Default = |
... |
other arguments passed to |
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.
adjusted.p: statistical significance of the mediator (Bonferroni procedure).
BH.FDR: statistical significance of the mediator (Benjamini-Hochberg procedure).
n <- 100 # sample size
p <- 500 # the dimension of covariates
# the regression coefficients alpha (exposure --> mediators)
alpha <- rep(0, p)
# the regression coefficients beta (mediators --> outcome)
beta1 <- rep(0, p) # for continuous outcome
beta2 <- rep(0, p) # for binary outcome
# the first four markers are true mediators
alpha[1:4] <- c(0.45,0.5,0.6,0.7)
beta1[1:4] <- c(0.55,0.6,0.65,0.7)
beta2[1:4] <- c(1.45,1.5,1.55,1.6)
# these are not true mediators
alpha[7:8] <- 0.5
beta1[5:6] <- 0.8
beta2[5:6] <- 1.7
# Generate simulation data
simdat_cont = simHIMA(n, p, alpha, beta1, seed=1029)
simdat_bin = simHIMA(n, p, alpha, beta2, binaryOutcome = TRUE, seed=1029)
# Run HIMA with MCP penalty by default
# When Y is continuous (default)
hima.fit <- hima(simdat_cont$X, simdat_cont$Y, simdat_cont$M, verbose = TRUE)
head(hima.fit)
# When Y is binary (should specify family)
hima.logistic.fit <- hima(simdat_bin$X, simdat_bin$Y, simdat_bin$M,
family = "binomial", verbose = TRUE)
head(hima.logistic.fit)