Procedure
Step-by-step procedure to check whether the proportional hazards assumption holds for a covariate.
The Log-Cumulative-Hazard Method
From the Cox PH model:
Taking logarithms twice:
For two groups A and B, the difference:
is constant over time. This means the log-cumulative-hazard curves should be parallel if PH holds.
Procedure
1. Estimate Survival by Group
library(survival)
# Fit KM for each level of the covariate
fit1 <- survfit(Surv(time, status) ~ group)2. Compute Log-Cumulative-Hazard
# Extract and transform
logH <- function(fit) log(-log(summary(fit)$surv))3. Plot Against Time
plot(fit1, fun = "cloglog", col = "blue",
xlab = "Time", ylab = "log(-log(S(t)))")
lines(fit2, fun = "cloglog", col = "red")4. Check for Parallelism
- Curves are parallel → PH assumption holds. Can proceed with Cox PH model.
- Curves intersect or diverge → PH violated. Do not use standard Cox PH; consider stratified Cox or time-dependent covariates.
Interpretation
The
fun = "cloglog"option inplot.survfitplots directly. If the two curves maintain a roughly constant vertical distance, the hazards are proportional.
R Example: Leukemia Data
library(survival)
# Fit KM by treatment group (6-MP vs placebo)
fit <- survfit(Surv(time, status) ~ treat, data = leukemia)
# Log-cumulative-hazard plot
plot(fit, fun = "cloglog", col = c("blue", "red"),
xlab = "Time (weeks)", ylab = "log(-log(S(t)))",
main = "PH Assumption Check: Leukemia Data")
legend("bottomright", c("6-MP", "Placebo"),
col = c("blue", "red"), lty = 1)If the curves are parallel: proceed with Cox PH. The leukemia data shows approximately parallel curves — the PH assumption is reasonable for the treatment variable.
Alternative Formal Tests
- Schoenfeld residuals test:
cox.zph(fit)— tests correlation between scaled Schoenfeld residuals and time - Grambsch-Therneau test: Global and per-covariate tests in
cox.zphoutput
A significant p-value () in cox.zph suggests violation of PH for that covariate.