cox_summary: Cox model summary for subgroup (OPTIMIZED)
Description
Called in analyze_subgroup() <-- SG_tab_estimates
Usage
cox_summary(
Y,
E,
Treat,
Strata = NULL,
use_strata = !is.null(Strata),
return_format = c("formatted", "numeric")
)
Value
Character string with formatted HR and CI (or numeric vector if return_format="numeric").
Arguments
Y
Numeric vector of outcome.
E
Numeric vector of event indicators.
Treat
Numeric vector of treatment indicators.
Strata
Vector of strata (optional).
use_strata
Logical. Whether to use strata in the model (default: TRUE if Strata provided).
return_format
Character. "formatted" (default) or "numeric" for downstream use.
Details
Calculates hazard ratio and confidence interval for a subgroup using Cox regression.
Optimized version with reduced overhead and better error handling.