Wraps survival::coxph() with Efron (default) or Breslow tie handling
and returns a tidy list including hazard ratios, CIs, p-values, and the
Breslow baseline cumulative hazard.
Usage
morie_survival_cox(
data,
duration_col,
event_col,
covariate_cols,
ties = c("efron", "breslow"),
confidence = 0.95,
penalizer = 0
)
Arguments
- data
data.frame.
- duration_col
Name of the time column.
- event_col
Name of the 0/1 event column.
- covariate_cols
Character vector of covariate column names.
- ties
"efron" (default) or "breslow".
- confidence
Confidence level (default 0.95).
- penalizer
L2 penalty (passed via ridge() term in the formula).
Value
A named list with elements coefficients,
standard_errors, hazard_ratios, z_scores,
p_values, ci_lower, ci_upper,
covariate_names, concordance, log_likelihood,
n_events, n_observations, method,
baseline_hazard, .coxph.
Examples
set.seed(1)
df <- data.frame(t = rexp(60), e = rbinom(60, 1, 0.7),
x1 = rnorm(60), x2 = rnorm(60))
fit <- morie_survival_cox(df, "t", "e", c("x1", "x2"))
fit$hazard_ratios
#> x1 x2
#> 0.7610531 0.8695670