Published  |  Last updated

A cardiology fellow with 340 heart-failure patients and a five-year follow-up window needs more than a comparison of two averages. She needs to know how much faster or slower patients on a new anticoagulant reach stroke or death compared with the old one, adjusting for age, kidney function, and prior events all at once, using every patient’s follow-up time even for the ones still alive when the study closed. The Cox proportional hazards model answers exactly that question. Introduced by British statistician David Cox in 1972, it remains the standard method for time-to-event data across cardiology, oncology, nephrology, and most other fields built on survival outcomes, and it produces the hazard ratio, the single number that turns a follow-up dataset into a statement about relative risk over time.

This guide works through the mechanics behind that hazard ratio, the hazard function, the baseline hazard the model leaves unspecified, and the proportional hazards assumption along with the Schoenfeld residual test used to check it. A full worked example fits a Cox model on a real, publicly documented lung cancer trial dataset, computed directly for this article rather than copied from a secondary source, followed by a second example showing what happens to a hazard ratio when a covariate that changes during follow-up, organ transplant status, gets modeled as if it were fixed at baseline. Covariate selection, continuous versus categorical coding, stratified models, and the events-per-variable question round out the piece, each backed by a citation carrying a specific, checkable number rather than a vague appeal to prior research.

In Simple Words

A Cox model answers one question with a single number. Given two groups, or two values of a measurement like age or blood pressure, how much higher or lower is the instantaneous risk of the event for one compared with the other, at any moment during follow-up? That number is the hazard ratio. A hazard ratio of 2.0 means twice the risk at every moment; 0.5 means half the risk. The model never needs to know the exact shape of the risk curve over time, only that the ratio between groups stays constant, which is the “proportional” in proportional hazards. When that assumption breaks down, a single hazard ratio stops telling the whole story, so testing it is not optional.

Key Takeaways

  • The Cox proportional hazards model estimates a hazard ratio for each covariate without assuming any particular shape for the baseline hazard over time, the property that makes it semi-parametric rather than fully parametric.
  • Fitted directly on the 228-patient NCCTG lung cancer trial dataset for this guide, a three-covariate Cox model returns a hazard ratio of 1.590 (95% CI 1.273 to 1.986) per one-point rise in ECOG performance status and 0.575 (95% CI 0.414 to 0.799) for female versus male sex.
  • Schoenfeld residuals, tested through the cox.zph function built into R’s survival package, remain the standard way to check whether the proportional hazards assumption holds for each covariate and for the model as a whole.
  • Modeling a covariate that changes during follow-up, such as receiving an organ transplant, as though it were fixed at enrollment inflated an apparently protective hazard ratio of 0.180 in a demonstration on real Stanford heart transplant data later in this guide, compared with a hazard ratio of 1.016 once the same covariate was coded correctly as time-varying.
  • Ten events per covariate is a reasonable floor for model stability, though a 2007 simulation study in the American Journal of Epidemiology found the true minimum depends on total sample size and how cleanly the predictors separate the outcome.

What the Cox Proportional Hazards Model Actually Estimates

Every survival model needs a way to describe risk that changes at each instant rather than a single overall probability. The hazard function, written h(t), does exactly that, giving the instantaneous rate at which the event occurs at time t among people who have remained event-free up to that point. A hazard of 0.02 per month means that, among patients still at risk at that moment, close to 2% experience the event over the next month if that rate held steady across the interval.

David Cox built a regression structure around that hazard in his 1972 paper “Regression Models and Life-Tables,” published in the Journal of the Royal Statistical Society and cited more than 36,000 times since, without forcing any assumption about the hazard’s baseline shape. For a person with covariate values x₁ through xₖ, the model writes the hazard as h(t) = h₀(t) × exp(b₁x₁ + b₂x₂ + … + bₖxₖ), where h₀(t) is the baseline hazard, the risk trajectory for someone with every covariate equal to zero, left entirely unspecified. Every covariate effect enters through the exponential term, and because h₀(t) cancels out of the ratio between any two people’s hazards, the model estimates hazard ratios without ever having to estimate the baseline hazard itself. Statisticians call that property semi-parametric, and it explains why the Cox model dominates clinical survival analysis over fully parametric alternatives such as Weibull regression, which require an analyst to commit to a shape for h₀(t) that real biological risk rarely follows exactly.

Exponentiating a single coefficient, exp(b₁), produces the hazard ratio clinical papers actually report. A coefficient of 0.405 for a binary treatment variable converts to a hazard ratio of 1.50, meaning the treated group faces 50% higher instantaneous risk than the reference group at every point during follow-up where proportionality holds.

Time-to-Event Data, Censoring, and Why Ordinary Regression Falls Short

A time-to-event outcome carries two pieces of information tied together, whether the event happened and how long it took to happen. Linear regression cannot use that pair correctly, and logistic regression discards the timing altogether, collapsing a patient who died on day 12 and a patient who died on day 1,200 into the same “event occurred” category. Neither approach handles a complication built into almost every survival dataset, some subjects leave the study, reach its scheduled end, or get lost to follow-up before the event happens at all.

Statisticians call that situation right censoring, and it does not mean the data point is missing or wrong. A patient followed for eight years without a recurrence contributes eight full years of event-free time to the analysis, information that a method built only around “yes, it happened” or “no, it did not” would waste. Survival analysis fundamentals covered elsewhere on this site rest on an assumption that censoring is independent of the underlying risk, meaning a patient censored at month 20 carries, on average, the same future risk as someone still being actively followed at month 20. Sicker patients dropping out more often than healthier ones would violate that assumption, and every downstream Cox model result would inherit the resulting bias.

Left censoring and interval censoring appear less often in clinical Cox regression, mattering most in specific designs, such as when a biomarker crossed some threshold at an unknown point before the first measurement rather than at a documented moment. Getting the event indicator and the time variable defined consistently before modeling starts prevents a category of error that no amount of downstream statistical sophistication can repair afterward.

Interpreting Hazard Ratios from a Cox Model

Reading a hazard ratio correctly means resisting two common misreadings. A hazard ratio does not describe how much sooner an event happens, and it is not the same as a risk ratio measured across an entire study period. It describes relative risk at each instant, and under the proportional hazards assumption that ratio applies uniformly across the whole follow-up window rather than shifting from month to month.

For a binary covariate such as treatment assignment, a hazard ratio of 0.70 means the treated group faces 30% lower instantaneous risk than the control group at any given moment. For a continuous covariate such as age in years, that same 0.70 applies to a one-year increase and compounds multiplicatively across larger differences, so a ten-year age gap carries a hazard ratio of 0.70 raised to the tenth power, nowhere close to 0.70 multiplied by ten. Forest plots sometimes get read as though the hazard ratio were a speed multiplier on disease progression itself, but the model never estimates how quickly any individual patient’s disease advances. It estimates a ratio of event rates between groups, nothing more and nothing less.

Hazard RatioMeaning
1.0No difference in instantaneous risk between the groups compared, or per unit of the covariate
0.57543% lower instantaneous risk than the reference group
1.5959% higher instantaneous risk than the reference group
2.0Twice the instantaneous risk of the reference group at every point during follow-up

A Worked Example: Fitting a Cox Model on Real Lung Cancer Trial Data

Rather than reproduce a textbook’s hypothetical numbers, the model below runs on a genuine, publicly documented dataset, the NCCTG lung cancer cohort that ships inside R’s survival package. Loprinzi and colleagues published the source study in the Journal of Clinical Oncology in 1994, testing whether a patient-completed questionnaire added prognostic information beyond a physician’s own assessment in a cohort of 1,115 patients with advanced lung or colorectal cancer at the North Central Cancer Treatment Group. The subset built into R covers 228 of those lung cancer patients, recording survival time in days alongside age, sex, and ECOG performance status, a physician-rated scale running from 0 (fully active) to 4 (bedridden).

Fitting coxph(Surv(time, status) ~ age + sex + ph.ecog, data = lung) on those patients, 227 once one incomplete performance-status record drops out, returns the hazard ratios below exactly as computed for this guide.

CovariateHazard Ratio95% CIp-value
Age (per additional year)1.0110.993 to 1.0300.232
Sex (female vs. male)0.5750.414 to 0.7990.001
ECOG performance status (per 1-point rise)1.5901.273 to 1.986<0.001

Two patterns stand out. Age alone, fitted with nothing else in the model, carries a hazard ratio of 1.019 (95% CI 1.001 to 1.037, p=0.042), reaching statistical significance on its own. Once sex and performance status enter the same model, age’s hazard ratio shrinks to 1.011 and its p-value rises to 0.232, no longer distinguishable from no effect at all. Age was never a strong independent predictor in this cohort; it only looked like one in isolation because it shared variance with performance status, the kind of pattern multivariable adjustment exists to untangle. Performance status dominates the fitted model instead, each one-step decline in functional ability raising the hazard by 59%, and sex shows a substantial, statistically significant gap on its own, women in this cohort facing 43% lower hazard than men across the full follow-up period. The model’s concordance statistic, a measure of how often it correctly ranks which of two randomly chosen patients died first, came out to 0.637, meaning the three covariates together separate higher-risk from lower-risk patients noticeably better than a coin flip but well short of a perfect ranking.

Testing the Proportional Hazards Assumption with Schoenfeld Residuals

Every hazard ratio reported from a Cox model rests on one working assumption, that the ratio of hazards between any two covariate values stays constant across the entire follow-up period. A treatment that lowers risk sharply in month one but converges with the control group by year two does not have a single, honest hazard ratio; averaging over that change produces a number that misrepresents both the early and late periods.

David Schoenfeld’s 1982 Biometrika paper introduced the residuals now named after him, one per covariate per event time, which should show no trend over time if the proportional hazards assumption holds for that covariate. Patricia Grambsch and Terry Therneau formalized the test statistic in a 1994 Biometrika paper now cited more than 4,700 times, correlating scaled Schoenfeld residuals against time or a transformation of time to produce a chi-square test per covariate plus a global test for the model overall. R implements the Grambsch-Therneau test as cox.zph(), and running it against the three-covariate lung cancer model above returns the results below.

CovariateChi-Squaredfp-value
Age0.18810.66
Sex2.30510.13
ECOG performance status2.05410.15
Global test4.46430.22

None of the four p-values in that table drop below the conventional 0.05 threshold, so this particular model gives no strong statistical reason to doubt proportionality for age, sex, or performance status individually or jointly. A log-log plot offers a graphical companion to the numeric test, plotting log(−log(S(t))) against log(t) separately for each level of a categorical covariate; parallel curves support proportional hazards, while curves that cross or visibly converge point toward a violation the Schoenfeld test may also flag. When a covariate does fail this check, two practical fixes cover most situations, splitting follow-up time so the covariate’s coefficient can differ before and after some point, or moving the offending variable into a stratified model instead of estimating a single coefficient for it, an approach covered later in this guide.

Covariate Selection and Continuous vs. Categorical Predictors

A Cox model does not tolerate an unlimited predictor list no matter how many patients sit in the dataset. A 1996 simulation built on a real cardiac trial of 673 patients with 252 deaths and seven candidate predictors, an events-per-variable ratio of 36 for the full sample, found that resampling down toward 2 events per variable produced biased coefficients and confidence intervals that stopped covering the true value at their stated rate. Ten events per covariate became the resulting rule of thumb. Vittinghoff and McCulloch revisited the question in a 2007 American Journal of Epidemiology simulation study and found that circumstances exist where confidence interval coverage and bias stay within acceptable bounds well below 10 events per variable, concluding that total sample size and how cleanly predictors separate the outcome matter as much as the raw EPV ratio. Treat 10 EPV as a floor worth checking before finalizing a model, not a guarantee that a model above that line is automatically trustworthy.

Coding a continuous predictor as a yes/no split around some cutoff, converting age into “over 65” versus “under 65,” feels simpler to present but throws away information the Cox model was built to use. Royston, Altman, and Sauerbrei’s 2006 Statistics in Medicine paper, cited nearly 1,900 times, demonstrated that dichotomizing a continuous predictor costs statistical power and can leave residual confounding behind, particularly when the cutpoint gets chosen after looking at the data rather than fixed in advance on clinical grounds. Keeping a predictor continuous, optionally allowing a curved rather than strictly linear relationship with the log hazard through a spline or fractional polynomial term, generally preserves more of what the data can say than any two-group split.

Interaction terms deserve the same deliberate treatment. A hazard ratio for treatment that differs by baseline disease severity needs a treatment-by-severity product term in the model rather than two separate hazard ratios reported for two subgroup analyses run independently, since subgroup analyses inflate the chance of a spurious “significant in one group but not the other” finding that an interaction term, tested directly, would likely show is not statistically distinguishable at all.

Time-Varying Covariates in the Cox Model

Some covariates do not sit still during follow-up. A patient’s treatment status, disease stage, or laboratory value measured repeatedly over years all change while the clock keeps running, and coding a covariate like that at its baseline value only, then treating it as fixed for the rest of follow-up, can distort a hazard ratio dramatically. The standard fix organizes the dataset in counting-process style, one row per interval during which nothing about the covariates changed, using Surv(start, stop, event) in R rather than the simpler Surv(time, status) format used earlier in this guide.

The Stanford heart transplant data, collected by John Crowley and Marie Hu for a 1977 Journal of the American Statistical Association paper cited more than 370 times and now built into R as the heart dataset, demonstrates the distortion directly. Modeling 103 patients and 75 deaths with transplant status coded incorrectly as a fixed baseline covariate, comparing patients by whichever status they eventually reached, returns a hazard ratio of 0.180 (95% CI 0.104 to 0.310, p<0.001) for transplant, an apparently powerful, highly significant survival benefit. Recoding the identical data in counting-process format, so transplant only “switches on” in a patient’s covariate history at the actual date they received one, and refitting coxph(Surv(start, stop, event) ~ transplant + age + surgery, data = heart) returns a hazard ratio of 1.016 (95% CI 0.555 to 1.861, p=0.958) instead, statistically indistinguishable from no effect at all.

Model SpecificationTransplant Hazard Ratio95% CIp-value
Incorrect: transplant treated as fixed at baseline0.1800.104 to 0.310<0.001
Correct: transplant coded as time-varying1.0160.555 to 1.8610.958

The gap between those two rows has a name, immortal time bias, and it appears because a patient must survive long enough to receive a transplant before that covariate can flip to “yes.” Baseline-only coding silently credits the transplant group with the survival time patients needed just to become eligible, time no comparably “untransplanted” patient could ever accumulate under the same rule. Jones and Fowler demonstrated the same distortion in a 2017 Journal of Critical Care study using real data on oseltamivir treatment in critically ill influenza patients, where standard Cox and logistic regression models both suggested a protective effect against mortality that disappeared entirely once a time-dependent Cox model accounted for the fact that patients had to survive to actually receive the drug, the same pattern the heart transplant data show above.

Stratified Cox Models for Variables That Should Not Get a Coefficient

Sometimes a variable clearly matters for survival but is not the variable a study wants a hazard ratio for, such as hospital site in a multicenter trial, or a covariate whose Schoenfeld residuals flag a clear proportional hazards violation that a transformation cannot fix. A stratified Cox model handles both situations by letting each stratum carry its own, entirely separate baseline hazard function while every covariate outside the stratifying variable keeps a single shared coefficient across all strata.

Refitting the lung cancer example with coxph(Surv(time, status) ~ age + ph.ecog + strata(sex), data = lung) stratifies by sex instead of estimating a coefficient for it. Age returns a hazard ratio of 1.011 (95% CI 0.993 to 1.029, p=0.253) and performance status returns 1.588 (95% CI 1.268 to 1.988, p<0.001), both close to the unstratified estimates, which makes sense given that the Schoenfeld test earlier showed no strong evidence that sex itself violates proportionality in this dataset. What changes is the question the model can answer. A stratified model can no longer report a hazard ratio for sex, since sex now defines separate baseline hazards rather than acting as a covariate, a trade-off worth making deliberately only when the stratifying variable’s own effect is not the one a study needs to report.

Common Mistakes That Undermine a Cox Regression Analysis

  • Reporting a hazard ratio without ever running a proportional hazards check. A single number averaged over a follow-up period where the true effect changes substantially can misrepresent risk at both the early and late ends of that period.
  • Fitting more covariates than the event count can support. A twelve-predictor Cox model against forty events produces several coefficients no more reliable than noise, regardless of how large the total sample looks on the cover page.
  • Reading the hazard ratio as a statement about timing. A hazard ratio of 2.0 means twice the instantaneous risk, not that the event happens twice as fast, and the two ideas get confused constantly in clinical discussion.
  • Coding a time-varying exposure as though it were fixed at baseline. The heart transplant comparison earlier in this guide shows how badly that single choice can distort a hazard ratio, sometimes reversing the clinical conclusion entirely.
  • Dichotomizing a continuous predictor around a convenient or data-derived cutpoint. Power drops and residual confounding creeps back in, exactly the outcome Royston, Altman, and Sauerbrei quantified in their 2006 paper cited earlier.
  • Treating a competing event as ordinary censoring. A patient who dies of an unrelated cause before the outcome of interest occurs is not the same as a patient lost to follow-up, and a standard Kaplan-Meier or Cox approach that ignores the difference overstates the cumulative incidence of the event actually being studied.
Confounder adjustment in a Cox proportional hazards model

Extensions Beyond the Basic Cox Model

Chronic disease research routinely runs into situations the basic Cox model was not built to handle alone. Competing risks show up whenever a patient can experience more than one type of terminal or absorbing event, cardiovascular death competing with cancer death in an oncology cohort, and treating one as ordinary censoring for the other inflates the estimated cumulative incidence. The competing risks framework covered in more depth elsewhere on this site replaces the plain Kaplan-Meier estimate with a cumulative incidence function built to handle exactly that situation.

Patients moving through multiple distinct clinical states, diagnosis to remission to relapse to death, rather than a single terminal event, call for the multistate and illness-death modeling approach, which extends the same hazard-based logic across several transitions instead of one. Studies collecting a repeated biomarker alongside survival time, rather than a handful of fixed baseline covariates, often fit better with a joint model linking the longitudinal trajectory directly to the hazard of the event, an approach that handles measurement error and irregular visit timing more carefully than simply feeding the last observed biomarker value into a standard Cox model. Recurrent-event data, repeated hospitalizations rather than a single terminal outcome, and frailty terms for unobserved, shared risk within families or clinics extend the model further still, each addressing a specific way that real clinical data depart from a single, independent time-to-event outcome per patient.

Getting Statistical Support for Cox Regression Analysis

Some Cox models are routine, three well-chosen covariates and an adequate event count relative to the predictor list. Others involve time-varying exposures, competing risks, clustered data from multiple sites, or a proportional hazards violation that needs a stratified or extended model rather than a simple refit. Editverse’s statisticians handle the full range, from checking whether a planned analysis has enough events per covariate to writing the methods and results narrative a dissertation committee or journal reviewer will actually read.

Dissertation & Manuscript Statistical Analysis

$600

PhD statisticians handle Cox model specification, proportional hazards checks, and full analysis writeups in SPSS, R, or STATA.

View Details →

Manuscript Writing Services

Custom Quote

Turn a completed Cox regression analysis into a submission-ready methods and results section written to journal standards.

View Details →

Applications of Cox proportional hazards modeling in chronic disease research

Conclusion

Every number a Cox model produces traces back to one hazard ratio at a time, computed without requiring an analyst to guess the baseline shape of risk, and checked, not assumed, against the proportional hazards condition that makes a single ratio meaningful across an entire follow-up period. Fitted here on a real, publicly available lung cancer trial dataset rather than a hypothetical table, the model returned exactly the kind of pattern that makes multivariable adjustment worth the trouble, a predictor significant on its own that stopped mattering once better predictors joined the model, alongside a performance-status effect that held up strongly throughout.

Coding choices carry consequences that are just as real as the model’s math. The Stanford heart transplant comparison earlier in this guide turned a null effect into an apparently powerful, statistically significant benefit purely by mishandling when a covariate was allowed to change, a distortion with a name, immortal time bias, and a documented history of misleading real clinical conclusions until a time-dependent model corrected it. Building a Cox model that survives scrutiny means treating covariate selection, the proportional hazards check, and the coding of anything that changes during follow-up as equally important design decisions, not afterthoughts to run once the headline hazard ratio already looks publishable.

Need Help Building or Checking a Cox Regression Model?

Editverse’s PhD statisticians handle model specification, proportional hazards testing, and results reporting for dissertations, manuscripts, and grant applications across every clinical discipline.

Get Statistical Support
Free Consultation

Frequently Asked Questions About the Cox Proportional Hazards Model

What does the Cox proportional hazards model actually estimate?

It estimates a hazard ratio for each covariate in the model, describing how much higher or lower the instantaneous risk of the event is for one group or value compared with a reference, at any point during follow-up, without requiring any assumption about the underlying shape of the baseline hazard over time.

How is a hazard ratio different from a risk ratio or an odds ratio?

A hazard ratio compares instantaneous risk at each moment during follow-up, while a risk ratio compares cumulative risk over a fixed period and an odds ratio compares odds rather than probabilities. All three converge only when the event is rare and the follow-up period is short, so a hazard ratio should not be read as if it were an odds ratio from a logistic regression.

What is the proportional hazards assumption, and how do I test it?

The assumption states that the hazard ratio for a covariate stays constant across the entire follow-up period rather than changing over time. Schoenfeld residuals, tested with the cox.zph function in R’s survival package, provide the standard numeric check, complemented by a log-log survival plot that should show roughly parallel curves across levels of a categorical covariate when the assumption holds.

What happens if the proportional hazards assumption is violated?

A single hazard ratio no longer represents the covariate’s effect accurately across the whole follow-up period. Common fixes include splitting follow-up time and allowing a time-varying coefficient for that covariate, stratifying the model by the offending variable so it gets its own baseline hazard instead of a single coefficient, or reporting the effect separately for distinct follow-up windows.

How many covariates can a Cox model support for a given number of events?

Ten events per covariate is a traditional starting benchmark, based on a 1996 simulation showing biased coefficients and poor confidence interval coverage below that ratio. Later simulation work found the true minimum depends on total sample size and how cleanly the predictors separate the outcome, so treat 10 events per variable as a floor worth checking rather than an exact target.

What is a time-varying covariate, and why does it matter for a Cox model?

A time-varying covariate is one whose value can change during a patient’s follow-up, such as treatment status or a repeated lab result. Coding it as fixed at baseline instead of allowing it to change at the correct time point can create immortal time bias, sometimes turning a null effect into an apparently strong, statistically significant one, as shown by the heart transplant comparison in this guide.

When should a Cox model be stratified instead of adjusted for a covariate directly?

Stratification suits a variable that clearly affects survival but is not the variable a study needs a hazard ratio for, such as study site, or a covariate whose Schoenfeld residuals show a proportional hazards violation that a transformation cannot resolve. A stratified model gives that variable its own baseline hazard while keeping shared coefficients for every other covariate, at the cost of no longer reporting a hazard ratio for the stratifying variable itself.

References

  1. Cox DR. Regression models and life-tables. J R Stat Soc Series B. 1972;34(2):187-202. https://doi.org/10.1111/j.2517-6161.1972.tb00899.x
  2. Loprinzi CL, Laurie JA, Wieand HS, et al. Prospective evaluation of prognostic variables from patient-completed questionnaires. North Central Cancer Treatment Group. J Clin Oncol. 1994;12(3):601-607. https://doi.org/10.1200/JCO.1994.12.3.601
  3. Schoenfeld D. Partial residuals for the proportional hazards regression model. Biometrika. 1982;69(1):239-241. https://doi.org/10.1093/biomet/69.1.239
  4. Grambsch PM, Therneau TM. Proportional hazards tests and diagnostics based on weighted residuals. Biometrika. 1994;81(3):515-526. https://doi.org/10.1093/biomet/81.3.515
  5. Vittinghoff E, McCulloch CE. Relaxing the rule of ten events per variable in logistic and Cox regression. Am J Epidemiol. 2007;165(6):710-718. https://pubmed.ncbi.nlm.nih.gov/17182981/
  6. Royston P, Altman DG, Sauerbrei W. Dichotomizing continuous predictors in multiple regression: a bad idea. Stat Med. 2006;25(1):127-141. https://doi.org/10.1002/sim.2331
  7. Crowley J, Hu M. Covariance analysis of heart transplant survival data. J Am Stat Assoc. 1977;72(357):27-36. https://doi.org/10.1080/01621459.1977.10479903
  8. Jones M, Fowler R. Immortal time bias in observational studies of time-to-event outcomes. J Crit Care. 2017;36:195-199. https://pubmed.ncbi.nlm.nih.gov/27546771/