Internal helper function to compute HR and CI for a subgroup. Uses robust (sandwich) standard errors for consistency with cox_summary().
compute_sg_hr(
df,
sg_name,
outcome.name,
event.name,
treat.name,
E.name,
C.name,
z_alpha = qnorm(0.975),
conf.level = 0.95
)Data frame with single row of HR estimates, or NULL if model fails.
Data frame for the subgroup.
Character. Name of the subgroup.
Character. Name of survival time variable.
Character. Name of event indicator variable.
Character. Name of treatment variable.
Character. Label for experimental arm.
Character. Label for control arm.
Numeric. Z-multiplier for CI (default: qnorm(0.975) for 95% CI).
Numeric. Confidence level for intervals (default: 0.95).