View source: R/11_joint_test.R
| joint_test | R Documentation |
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.
joint_test(inference_result, p_cutoff = 0.05, verbose = TRUE)
inference_result |
An object of class |
p_cutoff |
A numeric value (default: 0.05) specifying the maximum FDR threshold for identifying significant mediators. |
verbose |
A logical value (default: |
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).
TransHDM, mediation_inference, SIS
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.