Algorithm Search⌘K

Modelcore

Cox proportional hazards model

Also called Cox regression, proportional hazards regression.

Models the hazard as an unspecified baseline hazard times exp(x^T beta), so covariates scale the hazard by a constant factor over time.

The Cox proportional hazards model relates the hazard function of an event time TT to a covariate vector xx by

h(t∣x)=h0(t) exp⁡(βTx).h(t \mid x) = h_0(t)\,\exp(\beta^{\mathsf T}x).

The baseline hazard h0h_0 is any nonnegative function and is not modeled. The coefficient vector β\beta is the only finite-dimensional parameter. A change of xx by one unit in coordinate kk multiplies the hazard by eβke^{\beta_k} at every time, so the model makes a strong assumption about the shape over time and no assumption about the level. Cox (1972) proposed the model together with a likelihood for β\beta in which h0h_0 does not appear, the partial likelihood. This made the model the standard regression model for censored survival data.

The machine

The data. For subjects i=1,…,ni = 1, \ldots, n we observe yi=min⁡(Ti,Ci)y_i = \min(T_i, C_i), the flag δi=1{Ti≤Ci}\delta_i = 1\{T_i \le C_i\} and a covariate vector xi∈Rpx_i \in \mathbb{R}^p. Here TiT_i is the event time and CiC_i the censoring time, as on the censoring page.

The conditions.

  1. Proportional hazards. Given xix_i, TiT_i has the hazard h0(t)exp⁡(βTxi)h_0(t)\exp(\beta^{\mathsf T}x_i), with the same h0h_0 for all subjects.
  2. Independent censoring. Given xix_i and that subject ii is still at risk at tt, the censoring does not change the hazard of the event at tt. Censoring can depend on xix_i.
  3. Independent subjects. The triples (Ti,Ci,xi)(T_i, C_i, x_i) are independent.
  4. No intercept. The covariates have no constant column, because a constant cc in βTx\beta^{\mathsf T}x can move into h0h_0 as the factor ece^c.

Identifiability. If Var⁡(x)\operatorname{Var}(x) is nonsingular, then β\beta and h0h_0 are identified from the law of (T,x)(T, x): the log ratio log⁡h(t∣x)−log⁡h(t∣x′)=βT(x−x′)\log h(t \mid x) - \log h(t \mid x') = \beta^{\mathsf T}(x - x') fixes β\beta on the span of the differences x−x′x - x', and then h0(t)=h(t∣x)e−βTxh_0(t) = h(t \mid x)e^{-\beta^{\mathsf T}x}. With censoring, the law is identified only up to the largest time at which subjects are still at risk.

Equivalent forms. With H0(t)=∫0th0(u) duH_0(t) = \int_0^t h_0(u)\,du and a continuous TT:

H(t∣x)=H0(t) eβTx,S(t∣x)=S0(t)exp⁡(βTx),log⁡(−log⁡S(t∣x))=log⁡H0(t)+βTx.H(t \mid x) = H_0(t)\,e^{\beta^{\mathsf T}x}, \qquad S(t \mid x) = S_0(t)^{\exp(\beta^{\mathsf T}x)}, \qquad \log(-\log S(t \mid x)) = \log H_0(t) + \beta^{\mathsf T}x.

Proof. Integrate the hazard from 00 to tt to get the first form. Then S(t∣x)=exp⁡(−H(t∣x))=(exp⁡(−H0(t)))exp⁡(βTx)S(t \mid x) = \exp(-H(t \mid x)) = (\exp(-H_0(t)))^{\exp(\beta^{\mathsf T}x)} with S0=exp⁡(−H0)S_0 = \exp(-H_0). Take log⁡(−log⁡)\log(-\log) of the second form to get the third. □\square

The third form gives the usual graphical check: the curves of log⁡(−log⁡S^)\log(-\log \hat S) against tt (or log⁡t\log t) for groups of subjects are parallel under the model.

The counting process form. Let Ni(t)=1{yi≤t,δi=1}N_i(t) = 1\{y_i \le t, \delta_i = 1\} and Yi(t)=1{yi≥t}Y_i(t) = 1\{y_i \ge t\}. Under the conditions, NiN_i has the intensity Yi(t) h0(t)exp⁡(βTxi)Y_i(t)\,h_0(t)\exp(\beta^{\mathsf T}x_i), so Ni(t)−∫0tYi(u)h0(u)eβTxi duN_i(t) - \int_0^t Y_i(u) h_0(u) e^{\beta^{\mathsf T}x_i}\,du is a martingale. Andersen and Gill (1982) used this form. It also allows covariates xi(t)x_i(t) that change in time, recurrent events and delayed entry: only YiY_i and xi(t)x_i(t) change. With time-dependent covariates the hazard ratio of two subjects is no longer constant, so the name "proportional hazards" then refers to the form of the model, not to the data.

Strata. A stratified model allows a separate baseline hazard h0sh_{0s} in each stratum ss with a common β\beta. Use it for a factor that does not satisfy proportional hazards and whose effect is not of interest.

What it counts

  • Parameters. β∈Rp\beta \in \mathbb{R}^p, the log hazard ratios, and the baseline hazard h0h_0, an infinite-dimensional nuisance parameter.
  • The hazard ratio. eβke^{\beta_k} is the ratio of the hazards of two subjects that differ by one unit in xkx_k and agree in the other covariates. It is the same at every time. It is not a ratio of survival probabilities, of medians or of mean times.
  • Survival curves. S(t∣x)=exp⁡(−H0(t)eβTx)S(t \mid x) = \exp(-H_0(t)e^{\beta^{\mathsf T}x}). The Breslow estimator gives H^0\hat H_0, and so a curve for every covariate value.
  • The risk score. βTx\beta^{\mathsf T}x orders the subjects by risk at every time. The Harrell C-index measures how well this order agrees with the observed times.
  • Effective sample size. The information about β\beta comes from the events, not from the subjects. A common rule asks for 10 to 20 events per coefficient. This is a rule of thumb, not a theorem.

Relation to other models

  • Parametric proportional hazards models. A constant h0h_0 gives exponential regression and h0(t)=λρtρ−1h_0(t) = \lambda\rho t^{\rho - 1} gives Weibull regression. The Cox model keeps the hazard ratio and drops the assumption on h0h_0.
  • Accelerated failure time models. The AFT model makes covariates stretch the time scale. The Weibull model is both a Cox model and an AFT model, and the AFT page proves that no other family is both when the identity between the two holds for every time ratio c>0c > 0, or for two time ratios whose logarithms have an irrational ratio; it also gives a counterexample with one binary covariate.
  • Frailty models. A frailty model multiplies the Cox hazard by an unobserved random factor. If the frailty is left out, the marginal hazards are not proportional, and the fitted hazard ratio moves toward 11 over time.
  • Competing risks. The Cox model can be fitted to each cause-specific hazard, with the other causes treated as censoring. The Fine-Gray model puts the same form on the subdistribution hazard of one cause instead (see competing risks).
  • Discrete time. If the time axis is cut into intervals and the continuous model holds, then the conditional probability hj(x)h_j(x) of an event in interval jj, given survival to its start, satisfies log⁡(−log⁡(1−hj(x)))=αj+βTx\log(-\log(1 - h_j(x))) = \alpha_j + \beta^{\mathsf T}x. This is a binary generalized linear model with the complementary log-log link. Proof: 1−hj(x)=S(aj+1∣x)/S(aj∣x)=(S0(aj+1)/S0(aj))exp⁡(βTx)1 - h_j(x) = S(a_{j+1} \mid x)/S(a_j \mid x) = (S_0(a_{j+1})/S_0(a_j))^{\exp(\beta^{\mathsf T}x)} for the interval [aj,aj+1)[a_j, a_{j+1}); take log⁡(−log⁡)\log(-\log). The model with the logit link in place of the complementary log-log link is Cox's (1972) discrete model, a logistic regression on the risk sets.
  • Poisson regression. With a baseline hazard that is constant on intervals, the likelihood is that of a Poisson generalized linear model for the event counts with the log exposure time as an offset. When the baseline hazard may jump at each event time, the profile likelihood of β\beta is the partial likelihood with the Breslow rule for ties. The Breslow estimator page proves this.

Known results in the model

The partial likelihood. Cox (1972, 1975) estimated β\beta by maximizing

L(β)=∏jexp⁡(βTx(j))∑i∈R(tj)exp⁡(βTxi),L(\beta) = \prod_{j} \frac{\exp(\beta^{\mathsf T}x_{(j)})}{\sum_{i \in R(t_j)} \exp(\beta^{\mathsf T}x_i)},

where x(j)x_{(j)} is the covariate of the subject with the event at tjt_j and R(tj)={i:yi≥tj}R(t_j) = \{i : y_i \ge t_j\} is the risk set. Each factor is the conditional probability that the event at tjt_j happens to the subject that had it, given that one event happens at tjt_j among the subjects in R(tj)R(t_j). The factor does not contain h0h_0. The partial likelihood page proves that log⁡L\log L is concave, gives the Newton iteration in O(np2)O(np^2) per step after one sort, and gives the rules of Breslow, Efron and the exact rule for tied times.

Large samples. Under the conditions above and regularity conditions on the covariates, the maximizer β^\hat\beta is consistent, and n(β^−β)\sqrt n(\hat\beta - \beta) converges to a normal law with covariance matrix the inverse of the limit of I(β)/n\mathcal I(\beta)/n, where I\mathcal I is the negative Hessian of log⁡L\log L (Andersen and Gill 1982, with the counting process form; Tsiatis 1981 earlier for time-fixed covariates). We cite these results and do not prove them. So the Wald test, the score test and the likelihood ratio test of β\beta all work as if LL were a likelihood.

Efficiency. The baseline hazard is unknown, so some information about β\beta is lost compared with a model with a known h0h_0. Efron (1977) showed that the partial likelihood estimate keeps all the information that is left: it is asymptotically efficient in the model with an arbitrary h0h_0.

The log-rank test is the score test. With one binary covariate, the score test of β=0\beta = 0 is the log-rank test. The partial likelihood page proves this exactly when there are no ties, and shows which variance appears with each rule for ties.

Checking the assumption. The Schoenfeld residuals of each covariate have mean near 00 at every time if the hazards are proportional. A trend in time is evidence that the coefficient changes in time. The Grambsch and Therneau test makes this a score test.

No finite estimate under separation. If at every event time the subject with the event has the largest value of βTx\beta^{\mathsf T}x in its risk set for some direction β\beta, then log⁡L\log L increases without bound along that direction and β^\hat\beta is infinite. This is the monotone likelihood of survival data. It happens with small samples and binary covariates. The Firth penalty gives a finite estimate (Heinze and Schemper 2001).

Worked example. The leukemia remission data of Freireich et al. (1963), listed by Gehan (1965), have 21 patients on 6-MP (12 censored) and 21 on placebo (none censored), with 30 events in all. They are the data of the Kaplan-Meier page. Let x=1x = 1 for placebo. The fits with the three rules for ties give:

ties β^\hat\beta standard error hazard ratio 95% interval likelihood ratio score test
Breslow 1.5092 0.4096 4.52 2.03 to 10.09 15.21 15.93
Efron 1.5721 0.4124 4.82 2.15 to 10.81 16.35 17.25
exact 1.6282 0.4331 5.09 2.18 to 11.91 16.25 16.79

The hazard of the end of remission on placebo is about 4.8 times that on 6-MP, at every time. The exact score statistic 16.79 is the log-rank statistic of the log-rank page. The Grambsch-Therneau test with g(t)=tg(t) = t gives 0.0190.019 (p=0.89p = 0.89), so these data show no evidence against proportional hazards. A Weibull AFT fit to the same data gives the hazard ratio 5.65 (see the AFT page).

Checks in code. The reference code is on the partial likelihood page. Its tests check the log partial likelihood against a direct sum over risk sets and subsets, the score and information against numerical derivatives, Newton's estimate against a fine grid, the score test against the log-rank test in exact fractions, and the values in the table above.

References

  1. D. R. Cox, Regression models and life-tables, Journal of the Royal Statistical Society, Series B 34(2), 1972, pp. 187 to 220 (the proportional hazards model, the conditional likelihood for the coefficients, ties and the discrete logistic model, with the discussion)
  2. Per Kragh Andersen and Richard D. Gill, Cox's regression model for counting processes, a large sample study, Annals of Statistics 10(4), 1982, pp. 1100 to 1120 (the counting process form of the model, consistency and asymptotic normality of the estimate, and the Breslow estimator)
  3. Anastasios A. Tsiatis, A large sample study of Cox's regression model, Annals of Statistics 9(1), 1981, pp. 93 to 108 (consistency and asymptotic normality of the estimate and of the estimated cumulative hazard, for time-fixed covariates)
  4. Bradley Efron, The efficiency of Cox's likelihood function for censored data, Journal of the American Statistical Association 72(359), 1977, pp. 557 to 565 (the efficiency of the partial likelihood estimate and the Efron approximation for ties)
  5. John D. Kalbfleisch and Ross L. Prentice, The Statistical Analysis of Failure Time Data, 2nd edition, Wiley, 2002, the chapter on relative risk (Cox) regression models (the model, the partial likelihood, ties, time-dependent covariates and stratification)
  6. Terry M. Therneau and Patricia M. Grambsch, Modeling Survival Data, Extending the Cox Model, Springer, 2000, the chapters on the Cox model, residuals and the test of proportional hazards

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/KRES0P/text.yaml