Cox Proportional Hazards
In Lesson 2 the log-rank test looked at Dr. Rao's two survival curves and returned p = 0.02: the new drug and the standard drug genuinely differ. A real result, but a frustrating one. It never said how much better the new drug is, and it could not answer the first question any cardiologist asks: is the new arm really doing better, or were those patients just younger to begin with?
This lesson fixes both gaps with one model. The Cox proportional hazards model turns "the arms differ" into a single number, the hazard ratio, and lets you adjust that number for age, sex, or anything else you measured. Move the slider below to feel what a hazard ratio does to a survival curve.
By the end of this lesson you will be able to:
- Read a hazard ratio: say exactly what HR = 0.35 means, and what it does not mean
- Write down the Cox model, and explain why it is called "semiparametric": it never has to guess the shape of the baseline hazard
- Fit
coxph()in R, read every column of its output, and adjust a treatment effect for a second variable like age
Prerequisites: Lesson 1 (right-censoring, the Surv() outcome, and the hazard h(t) as the risk of the moment) and Lesson 2 (the at-risk set and the log-rank test). You can run R and read a coefficient table.
One number for how much: the hazard ratio
Recall the hazard from Lesson 1: \(h(t)\) is the risk of the moment, the rate at which patients who have survived to month \(t\) are dying right now. Dr. Rao has one such hazard for the standard arm, \(h_{\text{std}}(t)\), and one for the new arm, \(h_{\text{new}}(t)\). The cleanest way to compare two hazards is to divide them. That ratio is the hazard ratio:
\[ \text{HR} = \frac{h_{\text{new}}(t)}{h_{\text{std}}(t)}. \]
Read it as a multiplier on risk. An HR of 0.35 means a new-drug patient's instantaneous risk of dying is about a third of a standard-drug patient's at the same moment. HR = 1 means identical risk, the drug does nothing. HR = 2 would mean the new arm dies at twice the rate, a drug that harms. So the whole verdict on a treatment collapses into one number: below 1 protective, above 1 harmful, and how far from 1 says how strong.
But look again at the definition. The ratio has a \(t\) in it, so in principle it could drift: the drug might help a lot early and little later. The Cox model makes one clean assumption to avoid that mess, called proportional hazards: the ratio is the same at every time \(t\). One drug's hazard is a fixed multiple of the other's, forever. Toggle the hazard ratio below and watch what that buys you.
The dashed grey line is the baseline arm. When you set HR below 1 the solid curve lifts above it (lower risk, longer survival); above 1 it drops below (higher risk). The one thing the curves never do is cross. That single unmoving gap is the proportional-hazards assumption made visible, and it is exactly what lets a whole survival comparison ride on one number.