Post-hoc model
An auxiliary function which generates p-value based on outcome and mediation model.
StepThree(X, M, C, time, status, X_sel_Y_s1, M_X_sel_s2)
X
: An n by p matrix of exposures.M
: An n by p matrix of mediators.C
: An n by p matrix of covariates. If there are no covariates, set C = NULL.time
: A vector of survival time of samples.status
: A vector of status indicator: 0=alive, 1=dead.X_sel_Y_s1
: Outputs from StepOne: A vector of selected X for Y.M_X_sel_s2
: Outputs from StepTwo: A data table with selected M, X pairs and related effect size.A list with the following components: - p_beta_m: p-values generated from outcome model
p_alpha_x: p-values generated from mediation modell
outcome_model: coefficient estimates from outcome model
med_results: coefficient estimates from mediation model
data(example_dat) surv_dat <- example_dat$surv_dat res_step1 <- StepOne(X = example_dat$X, M = example_dat$M, time = surv_dat$time, status = surv_dat$status, model_option = "MCP") M_X_sel_s2 <- StepTwo(X = example_dat$X, M = example_dat$M, time = surv_dat$time, status = surv_dat$status, X_sel_Y_s1 = res_step1$X_sel_Y_s1, M_X_s1 = res_step1$M_X_s1, M_sel_Y_s1 = res_step1$M_sel_Y_s1) res_step3 <- StepThree(X = example_dat$X, M = example_dat$M, C = example_dat$C, time = surv_dat$time, status = surv_dat$status, X_sel_Y_s1 = res_step1$X_sel_Y_s1, M_X_sel_s2 = M_X_sel_s2)
Useful links