joint_test: Joint Multiple Testing for Mediation Analysis

View source: R/11_joint_test.R

joint_testR Documentation

Joint Multiple Testing for Mediation Analysis

Description

Step 3 (final step) of the TransHDM pipeline: joint multiple testing on the alpha and beta p-values obtained from mediation_inference (Step 2). It estimates the null proportion, controls the false discovery rate via HDMT::fdr_est, identifies significant mediators, and summarises the direct, indirect, and total effects into a "TransHDM" object.

Together with SIS (Step 1) and mediation_inference (Step 2), this completes the three-step TransHDM workflow.

Usage

joint_test(inference_result, p_cutoff = 0.05, verbose = TRUE)

Arguments

inference_result

An object of class "mediation_inference" returned by mediation_inference.

p_cutoff

A numeric value (default: 0.05) specifying the maximum FDR threshold for identifying significant mediators.

verbose

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

Value

An object of class "TransHDM" — a list with:

  • contributions: Data frame of identified mediators with columns mediator, alpha, alpha_pv, beta, beta_pv, alpha_beta, ab_pv, fdr_est, pa. ab_pv is the original joint p-value, max(alpha_pv, beta_pv). fdr_est is the pointwise FDR from HDMT::fdr_est.

  • effects: Data frame summarising indirect, direct, total effects and proportion mediated (pe).

  • IDE_est: Named numeric vector of indirect effect estimates for all mediators (non-selected set to zero).

  • DE_est: Estimated direct effect.

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

See Also

TransHDM, mediation_inference, SIS

Examples


set.seed(123)
target_data <- gen_simData_homo(n = 50, p_x = 3, p_m = 20, rho = 0.1)$data
source_data <- gen_simData_homo(n = 100, p_x = 3, p_m = 20, rho = 0.1,
  source = TRUE, transferable = TRUE)$data
M_vars <- paste0("M", 1:20)
X_vars <- paste0("X", 1:3)

# Full pipeline
sis <- SIS(target_data, source_data, Y = "Y", D = "D", M = M_vars,
  X = X_vars, transfer = TRUE, topN = 10)
infer <- mediation_inference(sis, M = M_vars, D = "D", X = X_vars,
  Y = "Y", transfer = TRUE)
result <- joint_test(infer)
plot(result)



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