TransHDM: TransHDM: High-Dimensional Mediation Analysis with Transfer...

View source: R/9_TransHDM.R

TransHDMR Documentation

TransHDM: High-Dimensional Mediation Analysis with Transfer Learning

Description

The TransHDM function performs high-dimensional mediation analysis under a transfer learning framework. It identifies and estimates indirect (mediation) effects of a high-dimensional set of mediators between an exposure and an outcome by integrating a target dataset with one or more source datasets. Multiple source datasets are row-bound into a single source before screening and estimation.

Usage

TransHDM(
  target_data,
  source_data = NULL,
  Y,
  D,
  M,
  X,
  transfer = FALSE,
  verbose = TRUE,
  ncore = 1,
  topN = NULL,
  use_SIS = TRUE,
  p_cutoff = 0.05
)

Arguments

target_data

A data frame containing the target dataset. All variables must be numeric.

source_data

A data frame, or a list of data frames, containing source datasets (optional, default: NULL). All variables must be numeric and use the same column names as target_data. A list is row-bound into one source dataset before screening and estimation.

Y

Character string specifying the outcome variable name.

D

Character string specifying the exposure (treatment) variable name.

M

Character vector specifying mediator variable names.

X

Character vector specifying covariate variable names..

transfer

A logical value (default: FALSE) indicating whether to enable transfer learning by incorporating information from source_data.

verbose

A logical value (default: TRUE) controlling whether progress messages are printed to the console.

ncore

An integer (default: 1) specifying the number of CPU cores to use for parallel computation when fitting mediator models.

topN

An integer (default: NULL) specifying the number of mediators to retain after Sure Independence Screening (SIS). If NULL, the number is determined automatically based on the data dimensions.

use_SIS

A logical value (default: TRUE) indicating whether to apply Sure Independence Screening (SIS) for initial variable screening. When FALSE, the full set of mediators is used in estimation and inference.

p_cutoff

A numeric value (default: 0.05) specifying the maximum p-value threshold for determining significant mediators.

Details

TransHDM implements a three-step workflow that can also be executed step-by-step using the individual components:

  1. Step 1 — Screening: SIS performs Sure Independence Screening to reduce dimensionality by ranking mediators based on their marginal associations.

  2. Step 2 — De-biased estimation: mediation_inference fits de-biased lasso models to estimate exposure-mediator (alpha) and mediator-outcome (beta) effects.

  3. Step 3 — Multiple testing: joint_test applies joint multiple testing with FDR control to identify significant mediators and computes effect summaries.

Set use_SIS = FALSE to skip Step 1 and use all mediators directly. A list of source datasets is row-bound into one source before these steps. Estimation then proceeds exactly as in the single-source procedure.

The variance estimator follows Algorithm 3 of Tian and Feng (2023). For Gaussian linear models, it assumes unit error variance. Under the required source-target heterogeneity conditions, pooled source and target design information is used to estimate the correlation structure, while the debiasing correction is based on target-domain data. This assumption is not automatically verified by the function.

Value

A list with the following components:

  • contributions: A data frame of identified mediators containing:

    • mediator: Mediator name

    • alpha: Estimated exposure mediator effect

    • alpha_pv: P-value for the exposure mediator effect

    • beta: Estimated mediator outcome effect

    • beta_pv: P-value for the mediator outcome effect

    • alpha_beta: Estimated indirect (mediation) effect

    • ab_pv: Joint p-value, max(alpha_pv, beta_pv)

    • fdr_est: Pointwise FDR from HDMT::fdr_est

    • pa: Proportion of the total effect mediated

  • effects: A data frame summarizing the total indirect effect, direct effect, total effect, and proportion mediated.

  • IDE_est: A numeric vector of indirect effect estimates for all specified mediators, with non-selected mediators set to zero.

  • DE_est: The estimated direct effect of the exposure on the outcome.

  • all_mediators: A data frame of all SIS-screened mediators (including non-significant ones) with columns mediator, alpha, alpha_pv, beta, beta_pv, and significant (logical).

References

Pan L, Liu Y, Huang C, Lin R, Yu Y, Qin G. Transfer learning reveals the mediating mechanisms of cross-ethnic lipid metabolic pathways in the association between APOE gene and Alzheimer's disease. Brief Bioinform. 2025;26(5):bbaf460. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/bib/bbaf460")}

See Also

SIS, mediation_inference, joint_test

Examples


set.seed(123)

# Target data
target_data <- gen_simData_homo(n = 50, p_x = 3, p_m = 20, rho = 0.1)$data

# Source data
source_data <- gen_simData_homo(n = 100, p_x = 3, p_m = 20, rho = 0.1, source = TRUE,
transferable = TRUE)$data

# Run TransHDM
result <- TransHDM(
  target_data = target_data,
  source_data = source_data,
  Y = "Y",
  D = "D",
  M = paste0("M", 1:20),
  X = paste0("X", 1:3),
  transfer = TRUE,
  ncore = 1,
  topN = 10
)
summary(result)



TransHDM documentation built on Nov. 24, 2026, 9:06 a.m.