Cox proportional hazards
Estimate associations between covariates and event hazards in right-censored follow-up data.
Concepts and reasoning
Compare rates among people still at risk
In time-to-event analysis, the hazard at a time is an instantaneous rate among people who have not yet experienced the event. It is not a probability and can exceed 1 when expressed per a sufficiently long unit of time. A Cox model relates that rate to predictors while leaving the baseline hazard unspecified.
A treatment hazard ratio of 0.70 says that, conditional on included predictors and under proportional hazards, the modeled instantaneous rate in the treatment group is 70% of the comparison rate. It does not say that 30% fewer people will experience the event by every follow-up time. Absolute risk depends on baseline survival and time. Nor does the ratio mean that survival times are multiplied by 1/0.70.
Learn from who fails, given who could have failed
At an observed event time, the risk set contains participants still under observation and event-free immediately before that time. The partial likelihood compares the predictor values of the person who experiences the event with those of everyone in that risk set. Censored participants contribute while they remain at risk, then leave the risk set; censoring is not recorded as survival forever.
This construction avoids specifying the entire baseline hazard to estimate relative effects. It does not remove the need for assumptions. Censoring must be suitably independent of event time, conditional on modeled information, and covariate effects need an appropriate form. Tied event times also need an explicit likelihood approximation or treatment. The lifelines survival-regression documentation provides worked illustrations.
Mathematical foundations
The proportional-hazards model
For covariate vector
The baseline hazard
Ignoring tied event times for exposition, the event at time
to the partial likelihood.
With a compatible baseline survival function, the model implies
Worked example
Translate a coefficient into two useful interpretations
Suppose a hypothetical treatment coefficient is −0.357 with standard error 0.150. The hazard ratio is
If control survival at two years is 0.80, the proportional-hazards model predicts treatment survival
| Control survival at a chosen time | Predicted treatment survival with HR 0.700 | Absolute survival difference |
|---|---|---|
| 0.800 | 0.855 | 0.055 |
| 0.500 | 0.616 | 0.116 |
The coefficient supplies a relative contrast; baseline survival turns it into a time-specific absolute contrast. Uncertainty in that baseline must be considered when estimating uncertainty in predicted survival.
For a partial-likelihood intuition, imagine a risk set of three participants with relative risk scores 1, 2, and 3. If the participant with score 2 has the event, the model assigns that identity a conditional probability of
Interpreting the results
Translate a coefficient into a conditional comparison
A coefficient is a log hazard ratio. Exponentiating it gives the multiplicative change in event hazard for a one-unit increase in that covariate, holding other included covariates fixed. For a 0/1 treatment indicator, a hazard ratio of 0.75 describes a 25% lower instantaneous event hazard among those still event-free, under proportional hazards. It is not a 25% increase in survival time or a 25-percentage-point survival benefit.
Confidence limits describe uncertainty in the fitted hazard ratio. An interval containing one does not prove no association; examine its width and the effects still compatible with the data. Predictor units matter: an age coefficient per year differs from one per decade.
A survival curve adds an estimated baseline survival function to the covariate effects. State which covariate profile it represents. A curve for average covariates is not automatically the average survival curve of the population, especially for mixtures of distinct groups.
Assumptions and limitations
Check the risk set and the effect model
Follow-up needs a common, defensible time origin and event definition. Ordinary right censoring assumes that, conditional on relevant modeled information, remaining event risk is not systematically different just because observation ends. Delayed entry, recurrent events, or time-varying covariates need methods that represent those features explicitly.
Proportional hazards means the covariate hazard ratio is constant over time, not that either group's hazard is constant. The log-hazard is linear in supplied covariates unless nonlinear transformations are added. Numeric category codes do not automatically define separate category effects.
Independent participant records and sufficient event information are needed for stable estimation. Strong collinearity or separation can make coefficients poorly determined. Adjustment establishes an association conditional on included variables; causal interpretation additionally requires an appropriate study design and assumptions about confounding.
Diagnostics and sensitivity analysis
Use diagnostics to investigate specific departures
Examine proportional-hazards diagnostics alongside clinical expectations and time-related residual patterns. A small diagnostic p-value suggests the constant-effect summary may be inadequate; a large p-value does not establish proportionality, particularly with few events. The lifelines regression documentation describes these checks and alternative model structures.
Review predictor coding, event counts by category, large standard errors, and correlations among covariates. Inspect functional form and influential observations using an analysis environment that supports those diagnostics. Do not delete observations simply because they weaken a preferred association.
Concordance measures ordering of predicted risks, not calibration or causality. A model can rank people reasonably while giving inaccurate absolute survival probabilities. Assess calibration at relevant time points and stability under defensible model specifications before using individual predictions.
References and other material
Read the methodological references and supporting tutorials below. The examples in this lesson are original teaching calculations, not findings from these sources.
- lifelines: survival regression — Worked regression examples and assumption checks.