Cox proportional hazards model
Intermediate
What you need first. Nothing else on this path comes first. This page is part of Statistical inference.
In survival analysis, the Cox proportional hazards model is a semi-parametric regression model for event times whose coefficients are estimated by partial likelihood, leaving the baseline hazard unspecified. The Cox proportional hazards model is a regression model for a time to an event — death, relapse, failure of a machine, publication of a study — in which covariates multiply an unspecified baseline hazard. Its central device is not the model itself but the way it is fitted: the partial likelihood. That device estimates the covariate coefficients without ever specifying, or estimating, the baseline hazard function. The model is semiparametric because it combines a finite-dimensional coefficient vector with an unrestricted baseline hazard function.
Estimation proceeds through event-time risk sets. Partial likelihood estimates , tie methods specify how simultaneous failures contribute, and a separate step estimates the baseline cumulative hazard. Proportionality must then be assessed because a constant coefficient does not ensure that the observed association is constant over time.
Cox proportional hazards model
| Fact | Value |
|---|---|
| Topic | Statistical inference |
| Listed on | Statistical inference |
A coefficient that survives without a baseline
The BrainCancer data analysed by James, Witten, Hastie and Tibshirani contain patients: women and men, with observed deaths and censored observations. The sex-only Cox fit has a coefficient of for men relative to women, a hazard ratio of , and a Wald -value of ; it provides no clear evidence of a difference after making no adjustment for other covariates .[1] This is distinct from the multivariable analysis in §11.5.3. For one binary group covariate with no additional adjustment, the Cox score test at the null agrees with the ordinary log-rank statistic when there are no tied events. With ties, the exact conditional partial likelihood retains this agreement for the same risk sets and event/censoring conventions; Breslow’s and Efron’s approximations need not do so .[2]
The estimated coefficient compares the sexes without specifying how the reference hazard changes over months since diagnosis. Cox’s conditional-likelihood construction removes the common baseline hazard from each event-time comparison .[2]
The model this article fits
Let be the event time, let be a vector of covariates measured for a subject, let be a vector of unknown coefficients, and let be an unspecified non-negative function of time , the baseline hazard. The Cox model states that the hazard for a subject with covariates is
The hazard is the instantaneous event rate at time among subjects who have survived event-free up to with covariates . The ratio of hazards for two subjects with covariates and is , which does not depend on : that time-independence is the proportional-hazards assumption. There is no intercept in , because any constant factor in would be absorbed into the unspecified . For the definition, the hazard-ratio interpretation and the implied survival function, see proportional-hazards-model.
Checking the proportional-hazards assumption
The proportional-hazards assumption — that every hazard ratio is constant over time — is an assumption about the model, not a consequence of the data, and a fitted Cox model does not check it by itself. Two diagnostics are standard, and they check the assumption in complementary ways.
Schoenfeld residuals
At an untied event time , for the subject who had the event, the Schoenfeld residual is the difference between that subject’s covariate and the risk-set average of the covariate at , where the average is the same weighted average that appears in the score equation:
In this untied construction there is one such residual per observed event and per covariate; censored subjects have no Schoenfeld residual, because no event was observed for them. The residuals are the individual contributions to the score, so at the estimate they sum to zero over all event times. They were introduced by Schoenfeld as partial residuals for the proportional hazards model .[3]
At the true coefficient under proportional hazards, these score contributions have conditional mean zero given the risk set. Fitted residuals approximate this behaviour, so a plot of the residuals against event time — or against a function of time, such as its rank — should show a random scatter centred on zero with no trend. A systematic trend means the covariate’s effect is changing over time. Concretely: residuals that drift upward over time mean that, late in follow-up, the subjects who have events have larger values of the covariate than the risk-set average predicts — the coefficient is effectively larger late than early, so the hazard ratio is increasing with time. Residuals that drift downward mean the opposite: the effect is weakening, or reversing, over time. A trend in either direction is evidence against proportional hazards for that covariate.
Scaled Schoenfeld residuals use an estimated covariance of the covariates within risk sets to express departures on the coefficient scale. Adding produces a diagnostic estimate of the time-varying coefficient , whose population target is horizontal under proportional hazards. In modern versions of R’s survival package, cox.zph tests the addition of a time-dependent term to the linear predictor, where is a covariate and is a chosen transformation of time. The null is . The test uses the score and information for this augmented model, accounting for estimation of the original coefficients; per-term tests and an optional global test are provided .[4]
The implementation computes the test statistics from the score vector and information matrix, and separately scales the Schoenfeld residuals for the diagnostic plot. The score test is therefore not obtained by correlating the plotted scaled residuals with time .[4] Since survival version , the function computes the actual score test; earlier versions used an approximation. A significant result provides evidence against constancy in the direction specified by . A non-significant result does not establish proportional hazards, particularly with few events, so the residual plot should also be examined.
Log-log survival plots
A second, cruder check uses the survival functions themselves. Under the Cox model, , so taking logarithms twice gives
For two groups differing in a single binary covariate, the curves of against (or against ) should therefore be parallel, separated by the constant . In practice the survival curves are estimated separately in each group, usually by Kaplan–Meier, and the transformed curves are plotted. Lines that diverge, converge or cross suggest a time-varying effect and hence a violation of proportional hazards. The plot is easy to produce and easy to over-read: with heavy censoring or small risk sets late in follow-up, the tails of the transformed curves are noisy, and apparent non-parallelism there is weak evidence. It is a screening plot, not a test.
What to do when the assumption fails
A failed check is not a reason to discard the analysis, but it is a reason not to report a single hazard ratio as if it described the whole follow-up. The standard remedies are: stratify on the offending covariate, so that each stratum has its own baseline hazard and no hazard ratio is estimated for that covariate; allow the coefficient to vary with time, for example by adding an interaction between the covariate and a function of time; or split follow-up into periods and estimate a separate hazard ratio in each. Which remedy is appropriate depends on the scientific question, and the choice, like the tie-handling choice, should be reported. A fitted constant coefficient does not establish a constant hazard ratio when the underlying proportional-hazards assumption fails.
Estimation by partial likelihood
The data and the risk set
Suppose subjects are observed. For subject , let be the observed time — the event time if the event was observed, the censoring time otherwise — let if the event was observed for subject and if subject was censored, and let be the covariate vector. Assume independent subjects and censoring independent of the event process conditional on the modelled covariates. This makes the observed risk sets suitable for estimating the event-hazard ratios; censoring associated with unmodelled prognosis can invalidate those comparisons.
For any time , the risk set is the set of subjects still under observation and event-free just before :
A subject censored at time belongs to for every and to none afterwards. It contributes no factor of its own to the partial likelihood below, but it appears in the denominators of the factors at event times before its censoring, where it constrains the comparison.
Why the baseline cancels
Fix an event time , and suppose exactly one event occurs at , for subject . Given that one event occurred at among the subjects in , the probability under the model that it was subject rather than any other subject in the risk set is the ratio of subject ’s hazard to the sum of the hazards in the risk set:
The baseline hazard is a common factor of numerator and denominator, so it cancels exactly. By conditioning on the occurrence of an event and comparing which subject experienced it, the nuisance function disappears from the estimating problem .[2]
The partial likelihood, the score, and the estimate
Multiplying the conditional probabilities above over all observed event times gives the partial likelihood
Its logarithm, the partial log-likelihood, is
Three consequences follow immediately, and each is worth stating exactly.
First, under censoring, the order of failures alone does not determine : the risk sets also depend on when censoring occurs relative to each failure .[2] A common strictly increasing transformation of all observed event and censoring times preserves every order comparison and tie, so it leaves every risk set, and hence for the fixed covariates considered here, unchanged. Rounding can introduce ties and change risk sets; moving a censoring time across a failure can likewise change .
Second, is called a partial likelihood because it is not the probability of the observed data: the factors condition on overlapping events, and the information about the spacing of event times — the information that would identify — has been deliberately discarded. It is nevertheless used as if it were a likelihood: the maximum partial likelihood estimator maximises , and its standard errors and tests are obtained from the curvature of , as for an ordinary likelihood. That use was contested when Cox’s paper was read, and its justification was worked out in later theory; in practice the analogy is treated as sound under the usual regularity conditions, including enough events and no separation.
Third, differentiating gives the score equation that solves. For the th component of ,
where is the risk-set average of the covariates, weighted by :
In words, at each event time the score compares the covariate of the subject who actually had the event with the average covariate among those who could have had it, where the average is weighted by relative risk. The estimator is the value that makes these comparisons balance out — sum to zero — over all event times. The negative second derivative of , the observed information, is the sum over event times of the risk-set variance of under the same weights, and its inverse gives the approximate variance of . There is, in general, no closed form for ; it is found numerically, usually by Newton–Raphson iteration.
For one binary group covariate with no additional adjustment, the score at is the observed-minus-expected event count used by the ordinary log-rank test. With no ties, its information is the log-rank variance. With ties, this equality still holds for the exact conditional tied partial likelihood: at the null, every subset of the observed number of failures from the risk set is equally likely, so the group event count is hypergeometric .[2] Its mean and variance supply the score and information. The equality requires the same risk sets, tied event counts, and event/censoring conventions in both analyses; it does not extend in general to adjusted Cox tests or to approximate tie handling.
For example, suppose subjects are at risk in each group and events occur together, both in group . Of the six possible failing pairs, one contains no group- subject, four contain one, and one contains two. Thus the null expected group- count is and its variance is . Both the exact conditional Cox test and the ordinary log-rank test have score and information . Breslow’s approximation instead gives information . The resulting score statistics are and , respectively. Here “exact” describes the conditional likelihood and its derivatives; the usual chi-squared reference distribution for the accumulated score statistic remains asymptotic.
Baseline hazard — Breslow’s estimator
The partial likelihood estimates but says nothing about . If absolute survival probabilities are needed — a predicted survival curve for a patient with given covariates — the baseline hazard must be estimated afterwards, with treated as known. The standard estimator is Breslow’s estimator of the cumulative baseline hazard .
At each distinct event time , let be the number of events at and let be the risk set just before . Breslow’s estimator is the step function
Each increment is the number of events at that time divided by the total relative risk of the subjects at risk — as if each subject at risk counted not once but times. With no covariates, , every weight is , and the estimator reduces to the Nelson–Aalen estimator, , where is the number at risk .[5]
That reduction is to Nelson–Aalen, not to Kaplan–Meier, and a one-event contrast shows why the distinction matters. With one event and two subjects at risk, the Nelson–Aalen increment is , so the estimated baseline survival obtained by exponentiating it is , whereas the Kaplan–Meier factor for the same event is . Exponentiating the Nelson–Aalen estimator is not the product-limit estimator.
The estimated survival function for a subject with covariates is then
Two cautions belong here. First, is a step function that jumps only at observed event times; it is not a smooth estimate of itself, and differentiating it to obtain a baseline hazard is not meaningful without further smoothing. Second, the uncertainty in has two sources — the uncertainty in and the uncertainty in — and a confidence interval that ignores either is too narrow.
Five subjects, one binary covariate, by hand
Five patients are followed after surgery. The covariate is for a new maintenance therapy and for standard care. Times are in months; denotes recurrence, denotes censoring.
| Subject | Time | ||
|---|---|---|---|
| 1 | 2 | 1 | 1 |
| 2 | 4 | 1 | 0 |
| 3 | 5 | 0 | 1 |
| 4 | 7 | 1 | 1 |
| 5 | 9 | 0 | 0 |
There are three event times, . The risk sets are , (subject 1 has had the event) and (subject 3 was censored at and subject 2 has had the event). Writing for , the partial likelihood is
because at three subjects in the risk set have and two have ; at two have and two have , and the subject with the event has ; and at one has and one has , and the subject with the event has . The partial log-likelihood is
and the score is
At , each contribution is the share of treated subjects in the risk set, and , which is positive, so the estimate lies above . At , . Evaluating on a grid confirms a maximum near there:
Solving gives , with hazard ratio . At that value the three partial-likelihood contributions are , and , whose product is , against . The observed information at is the sum of the risk-set variances of , , so the approximate standard error of is — very large, as it should be with only three events. No conclusion about the therapy could be drawn from five patients; the example is an arithmetic exercise, not evidence.
The Schoenfeld residuals at are the observed minus the risk-set mean at each event time: at , ; at , ; at , . They sum to zero, as they must at the estimate, since their sum is the score. With three residuals no trend can be assessed; the calculation shows the definition, not a diagnostic conclusion.
Finally, Breslow’s estimator at has increments at , at and at , giving . The estimated baseline survival at months is , and for a treated subject .
Your turn — Four patients
Four patients are followed after the same surgery, with the same binary therapy covariate ( for the new therapy, for standard care):
| Subject | Time | ||
|---|---|---|---|
| A | 1 | 1 | 1 |
| B | 2 | 1 | 0 |
| C | 3 | 0 | 1 |
| D | 4 | 0 | 0 |
Write down the partial likelihood and the score . Find and the hazard ratio , evaluate , compute the Schoenfeld residual at at , and compute Breslow’s at .
The risk sets are and . Hence
Setting gives exactly, so and the hazard ratio is . Both partial-likelihood contributions at are , so . The Schoenfeld residual at is . Breslow’s increments are at and at , so .
Common misconceptions
“A hazard ratio of means twice the risk.” It does not. A hazard ratio is a ratio of instantaneous event rates, not a ratio of probabilities of ever having the event. The risk ratio — the ratio of cumulative incidences by a given time — depends on the follow-up time and on the baseline hazard, and it moves towards as follow-up lengthens and most subjects in both groups have had the event.
A concrete, exact illustration makes the point. Suppose hazards are constant, per year in the control group and per year in the treated group, so the hazard ratio is at every time. The cumulative risk by time is and respectively. After year the risks are and , a risk ratio of ; after years they are and , a risk ratio of ; after years they are and , a risk ratio of . The hazard ratio never changed; the risk ratio did, because it is a different quantity. The same example shows the median-survival point: median survival is years in the control group and years in the treated group, a ratio of , which equals only because the hazards are constant in this special case. In general a hazard ratio is not a median-survival ratio, and it is not a ratio of mean survival times either.
“A hazard ratio is a probability, so it cannot exceed in the wrong direction.” A hazard is a rate, not a probability: it can exceed per unit time, and its size depends on the time unit. A hazard ratio of and a hazard ratio of are equally strong effects in opposite directions, on the log scale, which is why confidence intervals for a hazard ratio are computed on the log scale and are not symmetric around the estimate.
“The Cox model makes no assumptions because the baseline is unspecified.” The baseline is unspecified, but the model still assumes proportional hazards, log-linearity in the covariates and non-informative censoring. Semi-parametric means one component is left free; it does not mean assumption-free.
“A non-significant Schoenfeld test means the assumption holds.” It means the data did not reject constancy of the coefficient. With few events the test has little power, and a non-significant result is weak evidence. The plot matters as much as the -value.
“The partial likelihood is a likelihood, so is a maximum likelihood estimator.” It is a maximum partial likelihood estimator. It behaves like a maximum likelihood estimator in large samples under the model, but it is not the maximiser of the probability of the observed data, because the spacing of the event times was conditioned away.
Assumptions and limits
The Cox model rests on the following assumptions, and its limits follow from them.
Proportional hazards. The hazard ratio for any two covariate patterns is constant over time. This is the model’s defining assumption, and it is testable only in the sense described above: a diagnostic can reject it, but no diagnostic can prove it. When it fails, a fitted constant hazard ratio need not describe the association at any particular time.
Non-informative censoring. Censoring must be independent of the event time given the covariates. If subjects are censored because they are about to have the event — for example, if sicker patients drop out — the risk sets are no longer representative, and both and the Breslow baseline are biased. See censoring-statistics.
Log-linear effect on the hazard. The model assumes the log hazard is linear in the covariates, . A covariate whose effect on the log hazard is curved, or has a threshold, is misspecified; martingale residuals, which compare observed events with the fitted cumulative hazard, are the usual check for functional form, and a misspecified form can also masquerade as non-proportional hazards.
No unmeasured confounding, for a causal reading. The model estimates an association conditional on the covariates in the model. A hazard ratio is not a causal effect unless the covariates suffice to control confounding, the model is correctly specified, and the other assumptions hold. The partial likelihood machinery says nothing about causation.
Enough events, and no separation. The estimator needs enough observed events relative to the number of coefficients. With very few events, is unstable and its normal approximation is poor, as the worked example’s standard error of shows. If a covariate perfectly separates early events from late ones, can diverge.
Time-dependent covariates
A covariate may change during follow-up: treatment started, a biomarker measured repeatedly, a transplant received. The model extends directly to , where is the covariate value in force just before , and the partial likelihood uses each subject’s current value in each risk set. The risk-set covariates are evaluated at the current event time .[1]
Two warnings matter. First, a covariate must not be defined using the future: classifying a patient as “treated” from the start because they eventually received treatment counts pre-treatment time, during which they could not have had the event as a treated patient, as treated time. That is immortal-time bias, and the time-dependent formulation is the remedy, not the cause. Second, covariates are of two kinds. An external covariate is defined outside the subject — a planned dose schedule, calendar time, air pollution — and its future path is known whether or not the subject survives. An internal covariate is measured on the subject — a biomarker, blood pressure, transplant status — and is observed only while the subject survives and is uncensored, so its value carries information about the survival time itself. With internal time-dependent covariates, the hazard ratio can still be estimated, but the survival function can no longer be recovered from the fitted model in the usual way: the cumulative hazard integral involves the whole future path of , which is unknown for a subject who has not yet been observed to follow it, and the risk-set interpretation that underlies prediction breaks down .[6] In particular, do not report a predicted survival curve from a Cox model containing an internal time-dependent covariate as if it were the survival curve of a patient following a specified covariate path.
Connections
- proportional-hazards-model — the definition of the model, the hazard ratio and the survival function; this article takes that definition as given and covers estimation and diagnostics.
- hazard-rate — the hazard function itself, the instantaneous event rate that the model multiplies by .
- survival-function — the survival function and its relation to the cumulative hazard, which the Breslow estimator is used to recover.
- kaplan-meier-estimator — the non-parametric product-limit estimator of the survival function, used for the separate-group curves in a log-log plot. With no covariates, Breslow’s estimator reduces to the Nelson–Aalen estimator of the cumulative baseline hazard, not to the Kaplan–Meier estimator.
- log-rank-test — the non-parametric test comparing survival curves, which agrees with the score test at for one binary group covariate with no additional adjustment, including ties when the exact conditional partial likelihood and the same risk sets and tie conventions are used.
- censoring-statistics — right censoring and the non-informative-censoring assumption on which the risk sets, and therefore the partial likelihood, depend.
Check yourself
- At an event time , the partial-likelihood contribution is , and the baseline hazard does not appear. Explain in words why cancels, and state one piece of information about the data that the partial likelihood discards as a result.
The contribution is a conditional probability: given that exactly one event occurred at among the subjects in the risk set, the probability that it was subject is the ratio of subject ’s hazard to the sum of the hazards in the risk set. Every hazard in that ratio contains the same factor , so it cancels from numerator and denominator. The price is the spacing of the event times: the partial likelihood uses only the order of the events, through the risk sets, and discards how far apart in time the events were, which is the information that would identify .
- At one event time, events are tied. The sum of the relative-risk weights over the risk set is , and the sum over the two subjects with events is . The numerator of the partial-likelihood contribution is the same under Breslow’s and Efron’s methods. Compute the denominator under each method, and say which method gives the larger contribution and why.
Breslow’s denominator is . Efron’s denominator is . Efron’s method gives the larger contribution, because its denominator is smaller: it removes a fraction of the tied subjects’ weight from the risk set for the second tied event, instead of reusing the full risk set for both events as Breslow’s method does.
- A plot of scaled Schoenfeld residuals for a treatment covariate trends steadily upward over follow-up, and the score test for an added treatment-by-time interaction is significant. What does this mean for the hazard ratio, and what is one appropriate response?
It means the treatment’s coefficient, and therefore its hazard ratio, is not constant over time: the effect is larger later in follow-up than earlier, so a single hazard ratio does not describe the whole follow-up period. An appropriate response is to allow the coefficient to vary with time, for example by adding an interaction between treatment and a function of time, or to estimate separate hazard ratios in different follow-up periods, or to stratify if the covariate is a nuisance variable rather than the effect of interest. Reporting the single fitted hazard ratio as if it applied at all times would be misleading.
History
Cox introduced the model and the conditional likelihood underlying its estimation in his 1972 paper: D. R. Cox, “Regression models and life-tables”, read to the Royal Statistical Society in March 1972 and published in the Journal of the Royal Statistical Society, Series B, volume 34, pages 187–202. Cox’s Summary describes a hazard built from two multiplicative components: a factor depending on covariates and regression coefficients, and a baseline hazard with no prescribed shape over time; inference for the regression coefficients then proceeds through a conditional likelihood without requiring the baseline hazard to be specified .[2] The paper’s other contribution was to extend Kaplan and Meier’s product-limit idea to the comparison of life tables and to regression-like arguments for censored failure times.
Schoenfeld introduced partial residuals in 1982 for examining the proportional-hazards model .[3] Current implementations distinguish the graphical diagnostic based on scaled residuals from a formal score test for time-varying coefficients. The documentation of survival::cox.zph records the change from an approximate test to the actual score test in version .[4]
See also
Line chart · Apriori algorithm · Asymptotic analysis · Average treatment effect · Base rate · Bayesian inference · Bayesian model · Bayesian probability
References
- ^ a b a. (§11.8.1, pp. 483–484) b. (§11.7.3, pp. 481–482) James, G., Witten, D., Hastie, T. & Tibshirani, R. (2021). An Introduction to Statistical Learning: with Applications in R (2nd ed.). Springer, New York. https://doi.org/10.1007/978-1-0716-1418-1
- ^ a b c d e f g a. (§§6–7, pp. 192–193) b. (§5, pp. 190–191) c. (§5, pp. 190–191) d. (p. 188; p. 191, eq. (12)) e. (§§6–7, pp. 192–193) f. (§6, p. 192) g. (p. 187) Cox, D. R. (1972). Regression Models and Life-Tables. Journal of the Royal Statistical Society Series B: Statistical Methodology, 34(2), 187–202. https://doi.org/10.1111/j.2517-6161.1972.tb00899.x
- ^ a b a. (Abstract) b. (Abstract) Schoenfeld, D. (1982). Partial residuals for the proportional hazards regression model. Biometrika, 69(1), 239–241. https://doi.org/10.1093/biomet/69.1.239
- ^ a b c a. (§§Details, Value and Note) b. (§§Details and Value) c. (§Note) Therneau, T. M. (2026). survival: cox.zph — Test the Proportional Hazards Assumption of a Cox Regression (version 3.8-6). R package documentation. https://stat.ethz.ch/R-manual/R-devel/library/survival/html/cox.zph.html
- ^ a b c a. (slides 11–12) b. (slides 11–12) c. (slide 8) Rocke, D. M. (2021). Survival Regression Models. University of California, Davis, EPI 204. https://dmrocke.ucdavis.edu/Class/EPI204-Spring-2021/Lecture11SurvivalRegression.pdf
- ^ (§§2.1 and 2.3) Austin, P. C., Latouche, A. & Fine, J. P. (2020). A review of the use of time-varying covariates in the Fine–Gray subdistribution hazard competing risk regression model. Statistics in Medicine, 39(2), 103–113. https://doi.org/10.1002/sim.8399
Cite this page
StatWiki (2026). "Cox proportional hazards model." StatWiki. Last updated 2 December 2026. https://www.statwiki.io/articles/cox-proportional-hazards-model.html
@misc{statwiki_cox_proportional_hazards_model,
author = {{StatWiki}},
title = {{Cox proportional hazards model}},
year = {2026},
url = {https://www.statwiki.io/articles/cox-proportional-hazards-model.html},
urldate = {2026-12-02},
note = {StatWiki, last updated 2 December 2026}
}