
UNADJ survival mediation estimator: naive Baron-Kenny with Cox / RMST
Source:R/surv_mediation.R
fit_unadj_mediation_surv.RdStage 1 (OLS): M ~ X -> alpha_M. Stage 2 (Cox / RMST):
survival outcome ~ X + M -> NDE (coef on X), beta_M (coef on M).
NIE = alpha_M * beta_M. No confounding adjustment; bias
reference.
Usage
fit_unadj_mediation_surv(
time,
event,
X,
M,
covars = NULL,
effect_scale = c("loghr", "rmst"),
tau = NULL
)Examples
set.seed(1)
dat <- generate_toy_data(n = 200, outcome_type = "survival",
mo_confounding = 0.8, seed = 1)
fit_unadj_mediation_surv(dat$surv_time, dat$surv_event, dat$X, dat$M)
#> $NDE
#> [1] -0.3825676
#>
#> $NDE_se
#> [1] 0.6821078
#>
#> $NDE_p
#> [1] 0.1793237
#>
#> $NIE
#> [1] 1.002574
#>
#> $NIE_se
#> [1] 2.836666
#>
#> $NIE_p
#> [1] 0.7237632
#>
#> $alpha_M
#> [1] 0.7652063
#>
#> $alpha_se
#> [1] 0.01901884
#>
#> $beta_M
#> [1] 1.310201
#>
#> $beta_M_se
#> [1] 3.706918
#>