A First Note on Cox Regression

Effects and Time V − A First Note on Cox Regression
Keywords: effect measure, probability model, survival & competing risks
Cox regression is a model of proportional hazards
Me: “Dad, I admit the survival-curve equations were hard. But one thing bothered me. This formula is a hazard ratio, right?”
\[ HR=\frac{\lambda_1}{\lambda_2} \]
Me: “Is this the same idea as Cox regression? Or is Cox regression doing something different?”
Dad: “It is related, but this is not the Cox model yet. For a simple two-group Cox model, the proportional hazards assumption is often expressed like this:”
\[ HR=\frac{\lambda_1(x)}{\lambda_2(x)} \]
Me: “The \(x\) is time, right? So \(\lambda_1(x)\) and \(\lambda_2(x)\) are the hazard functions for the two groups. I can see that the hazards are allowed to change over time. But it still looks like an ordinary division.”
Dad: “That is how it looks if you read the formula without the surrounding model. In the exponential example, each hazard was already constant before we wrote the ratio. In Cox regression, \(\lambda_1(x)\) and \(\lambda_2(x)\) may each be complicated functions of time. What the model imposes is that their ratio stays constant over time.”
Me: “So the moment we write the ratio as a constant, we have introduced the proportional hazards assumption.”
Dad: “Exactly. The formula is not just a calculation carried out inside coxph(). It is a compact way of saying what structure the model assumes.”
Me: “So the formula is not just a definition of the hazard ratio. It is the model.”
Dad: “Exactly. For a simple two-group comparison, that expression represents the Cox model itself.”
The usual textbook form is:
\[ \lambda(x)=\lambda_0(x)\exp(Z \beta) \]
Dad: “One strength of Cox regression is that the baseline hazard, \(\lambda_0(x)\), can have almost any shape. That flexibility is why it is so useful. But the proportional hazards assumption still matters. Before reporting Cox regression results, you need to check whether the assumption is plausible: for example, whether Kaplan-Meier curves cross or whether log-minus-log plots are roughly parallel.”
Me: “So Cox regression is convenient, but it is not magic.”
Cox regression is not the only way to connect binary outcomes over time with hazard ratios. In a discrete-time framework, a generalized linear model with the complementary log-log link (binomial(link = "cloglog")) can also estimate hazard ratios.
To see the structure, suppose two survival functions under exponential hazards are:
\[ S_1(x)=\exp(-\lambda_1 x) \]
\[ S_2(x)=\exp(-\lambda_2 x) \]
Taking logs and changing signs gives:
\[ -\log\{S_1(x)\}=\lambda_1 x \]
\[ -\log\{S_2(x)\}=\lambda_2 x \]
Taking logs again and subtracting:
\[ \log[-\log\{S_1(x)\}]-\log[-\log\{S_2(x)\}]=\log(\lambda_1 x)-\log(\lambda_2 x)=\log(HR)=\beta \]
Under proportional hazards, the time \(x\) cancels out and the regression coefficient \(\beta\) remains. This is the idea behind log-minus-log plots: if proportional hazards is plausible, transformed survival curves should look roughly parallel.

Who is this?
- Kaplan
- Meier
- Cox
- Wilcoxon
Next episodes and R script
Episodes in this series
- Silent Confusions Hidden in Percentages
- Who Is This Percentage About? Target Populations and Attributable Fractions
- When Odds Ratios Approximate Risk Ratios—and When They Fail
- From Risk and Rate to Survival and Hazard
- A First Note on Cox Regression
- After Cox Regression: A Case Study and R Demonstration
Earlier series
Glossary