Model Formula
| Component | Type | Description |
|---|---|---|
| Non-parametric | Baseline hazard (distribution ignored) | |
| Parametric | Covariate contribution, parameters estimated |
Hazard Ratio
For subjects A and B:
Interpretation
| Meaning | ||
|---|---|---|
| Higher risk | ||
| No effect | ||
| Protective |
By Covariate Type
| Type | change in | HR |
|---|---|---|
| Numeric | +1 unit | |
| Binary (1 vs 0) | Condition present | |
| Numeric | + units |
Dummy Variable Construction
For categorical with levels, create dummies, one level as reference:
| Stage | Model | Hazard vs Reference |
|---|---|---|
| Ref | ||
| Level |
PH Assumption Check
Log-cumulative-hazard plot: Plot by group. Parallel curves → PH holds.
library(survival)
fit <- survfit(Surv(time, status) ~ group)
plot(fit, fun = "cloglog", col = c("blue", "red"))Formal test: cox.zph(fit) — significant p-value → PH violated.
Partial Likelihood
No Ties
- : number of distinct event times
- : risk set at
- : covariate of subject with event at
With Ties ( events at )
| Method | Formula |
|---|---|
| Breslow | |
| Efron | |
| Discrete |
where
| Method | Accuracy | Speed |
|---|---|---|
| Breslow | Good for few ties | Fast |
| Efron | Better | Moderate (R default) |
| Discrete | Exact | Slow |
Model Construction
Numeric Only
Categorical (Dummy) Only
Mixed (Numeric + Categorical)
With Interactions
For categorical × numeric: each dummy multiplied by numeric variable.
R Quick Reference
library(survival)
# Fit Cox PH model
fit <- coxph(Surv(time, status) ~ age + sex + stage, data = dat)
# Results
summary(fit) # coefficients, HR, CI, p-values
exp(coef(fit)) # hazard ratios
exp(confint(fit)) # CI for HR
# PH assumption test
cox.zph(fit) # Schoenfeld residuals test
# Prediction (baseline survival)
base_surv <- survfit(fit)
plot(base_surv)