Cox Proportional Hazards
Machine Learning from ScratchAll chapters Cox Proportional HazardsSection view · Sections in this chapter1 / 10 ↓
Reading tools Definitions, links & notes
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Kaplan-Meier and Nelson-Aalen summarize survival and cumulative hazard for a population or stratum. They can describe a mixture of people with different hazards when their censoring assumptions hold; they do not themselves specify how predictors change an individual's hazard. For equipment with different maintenance histories, a regression model lets us ask how the hazard is associated with those histories while retaining censored observations in the appropriate risk sets.
The Cox proportional hazards model, introduced by David Cox in 1972, is the standard regression model for censored outcomes. Its defining feature is simple. Each individual's hazard is written as a shared, unspecified baseline hazard multiplied by an individual-specific factor that depends only on that individual's covariates. The covariate factor scales the hazard up or down by the same amount at every point in time, which is precisely the proportional-hazards assumption. Because the baseline hazard is left entirely unspecified, Cox's model is semiparametric: it makes a strong parametric claim about how covariates act, and no parametric claim about the shape of time.
The method's second insight is what makes it practical. Cox showed that can be estimated by maximizing a partial likelihood that uses only the order in which events occur and who was still at risk when they did. The unknown baseline cancels at every event time, so we never have to specify it. That cancellation is the core idea of the chapter. We will derive it from first principles, build the fitting machinery from scratch with NumPy, and reconstruct the baseline and survival curves afterwards. Along the way, you will see how each formula translates into code and how to check the result against a mature library.
A hazard ratio is not a survival-probability ratio, and it is not an effect size on the probability scale. Even when hazards are strictly proportional, the ratio of survival probabilities at time depends on and on the baseline hazard itself. Holding this distinction straight is essential for correctly communicating results.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!