Calculates Controlled Direct Effect (CDE) hazard ratios from the
super-population potential outcomes (theta_0, theta_1)
and attaches them to the DGM's hazard_ratios list. This enables
automatic CDE detection by build_estimation_table.
Arguments
- dgm
A DGM object (e.g., from
generate_aft_dgm_flexorsetup_gbsg_dgm). The super-population is read fromdgm$df_super_randwhen present (as fromsetup_gbsg_dgm), otherwise fromdgm$df_super(as fromgenerate_aft_dgm_flex); it must have columnstheta_0andtheta_1. If neither data frame is present, or those columns are missing, the function warns and returnsdgmunchanged.- harm_col
Character. Name of the subgroup indicator column in that super-population data frame. If
NULL(default), auto-detected fromflag.harm,flag_harm, orH.
Value
The DGM object with CDE values added to
dgm$hazard_ratios (CDE, CDE_harm,
CDE_no_harm) and to top-level fields (dgm$CDE,
dgm$cde_H, dgm$cde_Hc).
Details
The CDE for subgroup S is defined as:
CDE(S) = mean(exp(theta_1[S])) / mean(exp(theta_0[S]))
which is the ratio of average hazard contributions on the natural scale.
This differs from the AHR (exp(mean(loghr_po))) due to Jensen's
inequality. In the notation of Leon et al. (2024), CDE corresponds to
theta-ddagger.
The function detects the subgroup indicator column automatically,
checking for flag.harm, flag_harm, and H in
the super-population data frame.
Examples
if (FALSE) { # \dontrun{
dgm <- setup_gbsg_dgm(model = "alt", k_inter = 2.0)
dgm <- compute_dgm_cde(dgm)
dgm$hazard_ratios$CDE_harm # theta-ddagger(H)
dgm$hazard_ratios$CDE # theta-ddagger overall
} # }