mediate_medfix {hdmed}R Documentation

Mediation Analysis via Fixed Effects Model

Description

mediate_medfix fits a high-dimensional mediation model with the adaptive LASSO approach as proposed by Zhang (2021) for the special case of MedFix that there is only one exposure variable.

Usage

mediate_medfix(
  A,
  M,
  Y,
  C1 = NULL,
  C2 = C1,
  nlambda = 100,
  nlambda2 = 50,
  nfolds = 10,
  seed = 1
)

Arguments

A

length n numeric vector representing the exposure variable

M

n x p numeric matrix of high-dimensional mediators.

Y

length n numeric vector representing the continuous outcome variable.

C1

optional numeric matrix of covariates to include in the outcome model. Default is NULL.

C2

optional numeric matrix of covariates to include in the mediator model. Default is C1.

nlambda

number of lambdas attempted in the adaptive LASSO. See gcdnet::cv.gcdnet(). The specific sequence of lambdas is chosen by the cv.gcdnet() function.

nlambda2

number of lambda2s attempted in the initial elastic net used for computing adaptive weights prior to adaptive LASSO. Default is 50. See gcdnet::cv.gcdnet() for details on elastic net regression. If 0, lambda2=0 is fed to cv.gcdnet() and the initial fit is based on standard LASSO, not elastic net. If not 0), the specific sequence of lambda2s is given by exp(seq(1e-4,0.02,length.out=nlambda2)), and the lambda2 with the least cross-validated error is chosen.

nfolds

number of folds for cross-validation. See gcdnet::cv.gcdnet(). Default is 10.

seed

numeric random seed.

Details

MedFix performs mediation analysis when there are multiple mediators by applying adaptive LASSO to the outcome model. In order to fit the adaptive LASSO, we first obtain an initial model fit using either LASSO (which deploys the L1 penalty) or elastic net (which deploys both the L1 and L2 penalties) depending on the provided nlambda2. Estimates from this fit are then used to compute the adaptive weights used in the adaptive LASSO. Once the final adaptive LASSO estimates (\beta_m) are obtained for the outcome model, estimates for the p mediator models (\alpha_a) are obtained by linear regression. The mediation contributions are computed as \alpha_a times \beta_m, and the p-value is taken as the maximum of the \alpha_a and beta_m p-values. Last, the global indirect effect is estimated by summing the mediation contributions, and the direct effect is estimated by subtracting the global indirect effect from an estimate of the total effect. This function is specific to applying MedFix to the special case that there is only one exposure; for details on how to apply MedFix when the exposures are high-dimensional, as proposed by the authors, see the supplemental files of the referenced manuscript.

Value

A list containing:

References

Zhang, Q. High-Dimensional Mediation Analysis with Applications to Causal Gene Identification. Stat. Biosci. 14, 432-451 (2021).

Examples

A <- med_dat$Y
M <- med_dat$M
Y <- med_dat$Y

out <- mediate_medfix(A, M, Y, nlambda = 10, nlambda2 = 5, seed = 1)
out$effects
head(out$contributions)


[Package hdmed version 1.0.1 Index]