Cox Proportional Hazards Model
Instead of looking only at whether an event happened, it analyzes how risk factors relate to the time until the event.
Why does the time to readmission differ among patients who had the same heart surgery? Are patients with comorbidities readmitted sooner? Can we also use the information from patients who were not readmitted by the end of observation?
The method for analyzing the relationship between the time until an event and risk factors is the Cox proportional hazards model.
If you only compare whether patients were readmitted, you lose the information about how many days after surgery they were readmitted. The Cox model uses the time of the event and the length of follow-up, and it also handles censored data, where the event was not observed during follow-up. The effect of a variable is expressed as a hazard ratio (HR), which compares the instantaneous risk at a given time.
It is used not only in medical research but in any situation where the timing of an event matters, such as machine failure, customer churn, or the time it takes to find a job. In this lesson we use readmission after heart surgery as an example to cover censored data, interpreting hazard ratios, how the model differs from Kaplan–Meier and AFT models, the proportional hazards assumption, and reporting the results.
What is the Cox proportional hazards model?
It links the time until an event to explanatory variables.
The Cox proportional hazards model is a survival analysis method that analyzes the relationship between the timing of patients’ readmission and risk factors. Rather than simply comparing whether patients were readmitted, it also uses the length of follow-up and the information from patients who have not yet been readmitted.
The model estimates how much the hazard, the instantaneous event rate among people who have not yet had the event at a given time, changes with the explanatory variables.
Why do we need the Cox proportional hazards model?
It handles patients with different observation periods and censored data together.
If a patient readmitted 30 days after surgery and a patient not readmitted over 120 days are treated the same, important time information is lost. Some patients may also drop out of the study during follow-up or reach the end of observation.
How does the Cox proportional hazards model work?
It combines a baseline hazard function with the relative effects of the explanatory variables.
The Cox model expresses the hazard function as h(t|X) = h₀(t) × exp(β₁X₁ + ··· + βₖXₖ). h₀(t) is the baseline hazard function, and the exponential of each coefficient, exp(β), is the hazard ratio (HR).
| Component | Meaning in this analysis |
|---|---|
| Time t | Time from the date of surgery to readmission or censoring |
| Event indicator | Readmission observed = 1, end of observation or loss to follow-up = 0 |
| Explanatory variables | Age, comorbidity, type of surgery |
| Hazard ratio HR | Relative size of the instantaneous readmission risk when the other variables are held equal |
The Cox model is a semiparametric method that estimates the regression coefficients using the partial likelihood, without specifying the shape of the baseline hazard function in advance.
A real-world example: risk of readmission after heart surgery
We compare readmission risk by age, comorbidity and type of surgery.
Suppose 300 hypothetical heart surgery patients were followed for up to 120 days after surgery. For each patient, we record the last date they were seen and whether they were readmitted. The numbers below are hypothetical results to illustrate the flow of the analysis, not the results of fitting real patient data.
| Variable | Type | Example |
|---|---|---|
| Follow-up time | Continuous, in days | 15 days, 72 days, 120 days |
| Readmitted | Event indicator | Readmitted 1 / Censored 0 |
| Age | Continuous | Interpreted per 10-year increase |
| Comorbidity | Categorical | No / Yes |
| Type of surgery | Categorical | A / B |
How do you interpret the hazard ratio (HR)?
The HR is the relative size of the risk, not a ratio of probabilities or of times.
HR = 1 means the two conditions being compared have the same risk. HR > 1 means the risk is higher, and HR < 1 means it is lower. For example, HR = 1.85 is the model’s statement that, adjusting for other factors, the instantaneous risk of readmission is about 85% higher at any point in time.
How are censored patients handled?
The fact that an event was not observed is also used in the analysis.
| Patient | What was observed | Information entered into the model |
|---|---|---|
| A | Readmitted 28 days after surgery | Time 28 days, event 1 |
| B | Not readmitted through day 120 | Time 120 days, event 0 (administrative censoring) |
| C | Lost to follow-up on day 80 | Time 80 days, event 0 (censored during follow-up) |
Censored patients provide the information that the event had not occurred by the time of censoring. It is not assumed that they were never readmitted after censoring. Also, if patients can die before being readmitted, consider whether treating this as simple censoring is valid, and consider a competing risks analysis.
Which numbers do you check in Cox regression results?
Check not only the hazard ratios but also their uncertainty and the model assumptions.
| Explanatory variables | HR | 95% confidence interval | p-value |
|---|---|---|---|
| Age (per 10 years) | 1.30 | 1.10–1.54 | .002 |
| With comorbidity | 1.85 | 1.34–2.56 | < .001 |
| Surgery type B (vs. A) | 1.20 | 0.88–1.64 | .247 |
In these hypothetical results, age and comorbidity are associated with a higher risk of readmission. Surgery type B has an HR above 1, but its confidence interval includes 1, so it is hard to conclude there is a clear difference. These are teaching numbers set to be consistent with one another, not estimates fitted to data.
How do the Cox model and Kaplan–Meier analysis differ?
Distinguish a method for comparing survival curves from a method for adjusting for several factors at once.
| Comparison | Kaplan–Meier / log-rank test | Cox Proportional Hazards Model |
|---|---|---|
| Main purpose | Show the event-free proportion over time and compare groups | Estimate hazard ratios accounting for several covariates |
| Explanatory variables | Mainly group categories | Continuous and categorical covariates together |
| Main output | Survival curves, log-rank test | HR, 95% CI, regression coefficients |
| Key conditions | Assumptions about censoring | Censoring assumptions + proportional hazards assumption, etc. |
How do the Cox model and AFT models differ?
The difference is whether you look at a ratio of risks or at how much the time to the event is stretched or shortened.
The Cox model describes the instantaneous hazard ratio (HR) of the event when other conditions are equal. The accelerated failure time (AFT) model focuses on how much the explanatory variables stretch or shorten the time until the event.
| Method | Typical interpretation | Suitable question |
|---|---|---|
| Cox | HR = 1.30 → instantaneous risk 30% higher | Which patients have a higher risk of readmission? |
| AFT | Time ratio = 0.80 → time to the event is 0.8 times as long | How much shorter is the time to readmission? |
The two models rest on different assumptions, so rather than choosing one just because it is easier to interpret, choose based on the data and the research question.
Things to watch out for with the Cox proportional hazards model
If you don’t check the assumptions, a single HR may not be an adequate summary.
Proportional hazards assumption: assumes that each explanatory variable’s HR is constant over time. Check Schoenfeld residuals, interactions with time and so on; if the assumption does not hold, consider time-varying effects or a stratified Cox model.
Linearity: for continuous variables such as age, check whether the relationship with the log hazard is linear. You can also use splines.
Censoring and event definitions: clearly define the reasons for dropout, what counts as readmission, the start of follow-up, and competing events such as death.
Causation: hazard ratios from observational data show adjusted associations and do not remove the influence of unmeasured confounders.
What extensions of Cox analysis are there?
Extend the model to fit the follow-up structure and any violations of assumptions.
| Method | Suitable situation |
|---|---|
| Stratified Cox model | When the baseline hazard differs across levels of some variables |
| Cox model with time-varying covariates | When explanatory variables, such as medication status, change during follow-up |
| Time-varying coefficient model | When the effect (HR) of an explanatory variable changes with follow-up time |
| Recurrent event models | When the same patient can be readmitted several times |
| Competing risks models | When events compete, such as death before readmission |
How do you report Cox proportional hazards results?
Report the number of patients, the follow-up period, the event definition and the hazard ratios together.
When writing up the results, present the study population, the follow-up period, the definitions of the event and censoring, the covariates, the hazard ratios and confidence intervals, and the results of checking the proportional hazards assumption.
A Cox proportional hazards model was fitted to examine risk factors for readmission among heart surgery patients (hypothetical data, N = 300, maximum follow-up 120 days). Adjusting for the other variables, the risk of readmission was higher with each 10-year increase in age (HR = 1.30, 95% CI [1.10, 1.54], p = .002), and patients with a comorbidity also had a higher risk of readmission (HR = 1.85, 95% CI [1.34, 2.56], p < .001). The difference between surgery types B and A was not clear (HR = 1.20, 95% CI [0.88, 1.64], p = .247).
A real paper should add information produced by the actual analysis, such as the number of events, the number censored, and the results of checking the proportional hazards assumption. This example does not claim that those diagnostics were carried out.
Where can the Cox proportional hazards model be used?
It is used in studies where timing matters and follow-up periods differ.
| Field | Research question |
|---|---|
| Medicine | What factors are related to the time until readmission or death after surgery? |
| Industrial safety | How does the working environment affect the time until equipment fails? |
| Customer analytics | What characteristics affect the time until a subscription is canceled? |
| Employment | How is completing a training program related to the time it takes to find a job? |
| Public health | How are risk factors related to the time until disease onset? |
The Cox proportional hazards model looks at the time until an event and risk factors together.
It uses censored observations too, and summarizes the relationship between several explanatory variables and the instantaneous risk as HRs. When reading the results, always check the proportional hazards assumption and the confidence intervals as well.
The Cox proportional hazards model estimates the relationship between explanatory variables and the instantaneous risk, taking into account not only whether an event happened but when. In the example of readmission after heart surgery, it described the relationship of patients’ age, comorbidity and type of surgery with the time until readmission in terms of hazard ratios (HR).
A hazard ratio does not directly mean the probability of readmission over a given period or the average time to readmission. When interpreting it, check the confidence interval and the definitions of the event and censoring, and examine the proportional hazards assumption that the hazard ratio is constant over time. If the assumption does not hold, also consider methods that allow effects to change over time.
Analyze not only whether an event happened but the time until it happened. Information from patients whose event has not yet been observed is also used, as censored data. The HR is not a probability but the relative size of the instantaneous risk. Interpret it against HR = 1, and read it together with the 95% confidence interval. Examine the proportional hazards assumption. If effects change over time, a different model or an extension may be needed.