Course contentsShow
← Data Science
Lesson 831 of 2,14521. Survival AnalysisFree lesson

Testing the Proportional Hazards Assumption

Assess proportional hazards using Schoenfeld residuals, log-log plots, and time-dependent covariates.

Testing the Proportional Hazards Assumption

What You'll Learn

You'll learn how to verify whether your Cox model's key assumption—that hazard ratios stay constant over time—actually holds for your data.

Why This Matters

Remember from lesson 826 that the Cox model assumes proportional hazards: the effect of a predictor (its hazard ratio) doesn't change over time. But what if age matters more early on, or treatment effects wear off? You need to test this assumption, not just hope it's true.

Three Main Approaches

1. Schoenfeld Residuals

These special residuals check whether each predictor's effect stays constant. You:

  • Calculate residuals for each event time
  • Test if they correlate with time
  • A significant correlation means the proportional hazards assumption is violated for that variable

Think of it like checking if a player's advantage stays the same throughout a game, or if it changes as time passes.

2. Log-Log Plots

Plot log(-log(survival)) versus log(time) for different groups:

  • If hazards are proportional, lines should be roughly parallel
  • Crossing or converging lines suggest violation
  • Visual, intuitive, but somewhat subjective

3. Time-Dependent Covariates

Include interaction terms between predictors and time (e.g., age × log(time)):

  • If the interaction is significant, the effect changes over time
  • This directly tests whether hazard ratios shift

When to Worry

Small violations? Often acceptable. Large violations mean you need to stratify by that variable or use time-dependent models instead.

Key Takeaway: Always test proportional hazards using Schoenfeld residuals, log-log plots, or time interactions—never assume the assumption holds without checking.