1 Model definition and notation

The Cox proportional hazards model is a semiparametric regression framework for time-to-event data. It links a subject’s covariates to the event process through the hazard rate, while leaving the baseline hazard function unspecified.

1.1 Survival, hazard, and cumulative hazard concepts

Let \(T\) denote the event time and \( \mathbf{X} \) a vector of covariates. The survival function is \(S(t)=\Pr(T>t)\), representing the probability an event has not occurred by time \(t\). The hazard function is defined as \[ h(t)=\lim_{\Delta t\to 0}\frac{\Pr(t\le T<t+\Delta t\mid T\ge t)}{\Delta t}, \] which describes the instantaneous risk of experiencing the event at time \(t\), given survival up to \(t\). The cumulative hazard is \[ H(t)=\int_0^t h(u)\,du, \] and it connects to survival via \(S(t)=\exp(-H(t))\). In practice, these quantities are central for interpreting estimated hazards and for constructing residuals and goodness-of-fit diagnostics.

1.2 Proportional hazards assumption

The central modeling claim is that covariates act multiplicatively on the hazard and do not alter its time shape beyond a constant factor. In the Cox form, \[ h(t\mid \mathbf{X}) = h_0(t)\exp(\boldsymbol{\beta}^\top \mathbf{X}), \] where \(h_0(t)\) is the baseline hazard and \(\boldsymbol{\beta}\) are regression coefficients. The proportional hazards assumption means the hazard ratio between two individuals is constant over time.

1.3 Hazard ratio interpretation

For two covariate vectors \(\mathbf{X}_1\) and \(\mathbf{X}_2\), the model implies \[ \frac{h(t\mid \mathbf{X}_1)}{h(t\mid \mathbf{X}_2)} = \exp\big(\boldsymbol{\beta}^\top(\mathbf{X}_1-\mathbf{X}_2)\big), \] which does not depend on \(t\). For a single binary covariate, \(\exp(\beta)\) is the hazard ratio comparing the “1” group to the “0” group. For continuous covariates scaled appropriately, \(\exp(\beta)\) represents the multiplicative change in hazard associated with a one-unit increase.

1.4 Relation to partial likelihood

Although the full likelihood involves the unknown baseline hazard \(h_0(t)\), the Cox model can be estimated without specifying \(h_0(t)\). This is achieved using partial likelihood, which focuses on the ordering of event times and the relative risk contributed by covariates at each event time. The resulting estimator \(\hat{\boldsymbol{\beta}}\) is consistent under the proportional hazards assumption, even with an unspecified baseline.

2 Data structure and variables

A Cox analysis requires careful representation of event times, censoring, and covariates. The model works with right-censored follow-up by default, but extensions exist for other censoring structures.

2.1 Time-to-event and censoring basics

Time-to-event data consist of an observed time \(Y\) and an event indicator \(\delta\). Typically,

  • if the event occurs at \(Y\), then \(\delta=1\);
  • if the subject is censored at \(Y\), then \(\delta=0\).

2.1.1 Right-censoring and other censoring types

Right-censoring occurs when follow-up ends before the event happens. Under non-informative censoring, the event process and the censoring mechanism are conditionally independent given covariates. Other common forms include left-censoring (event occurred before observation begins) and interval-censoring (event time is known only to lie in an interval). Standard Cox implementations primarily address right-censoring; specialized approaches handle more complex censoring patterns.

2.1.2 Event indicators and observation windows

Observation windows determine the at-risk set used in likelihood contributions. In simple settings, each subject enters at time 0 and remains at risk until \(Y\). In practical studies, subjects may enter later (delayed entry), requiring counting-process notation so that risk sets are defined for each event time.

2.2 Covariates and coding strategies

Covariates enter the model through \(\boldsymbol{\beta}^\top \mathbf{X}\). Their meaning depends on scaling, coding choices, and potential transformations.

2.2.1 Categorical variables and dummy coding

Categorical predictors are commonly encoded using indicator (dummy) variables relative to a reference category. For a \(K\)-level factor, \(K-1\) dummies are used to avoid redundancy. The coefficients are interpreted as log hazard ratios compared with the reference level.

2.2.2 Continuous predictors and scaling

Continuous variables can be used directly or transformed (e.g., log-transform) depending on linearity in the log-hazard scale and practical interpretability. Scaling a covariate changes the unit of increase and therefore the numerical value of the hazard ratio associated with a one-unit change.

2.3 Handling stratification and groups

Stratification allows the baseline hazard to vary across groups while keeping covariate effects common (in the basic stratified approach).

2.3.1 Stratified baseline hazards

In a stratified Cox model, \(h_0(t)\) is replaced by \(h_{0s}(t)\) for each stratum \(s\) (e.g., study site). Risk sets are formed within strata, which permits different baseline hazards and reduces confounding from unmodeled heterogeneity tied to strata.

3 Estimation via partial likelihood

Partial likelihood provides a way to estimate \(\boldsymbol{\beta}\) without specifying \(h_0(t)\). The method uses the idea that, at each event time, the covariate pattern of the individual who fails is compared to those still at risk.

3.1 Derivation intuition for partial likelihood

At a given event time \(t_i\), suppose subject \(i\) experiences the event. Under the Cox form, the hazard for subject \(i\) is proportional to \(\exp(\boldsymbol{\beta}^\top \mathbf{X}_i)\), scaled by \(h_0(t_i)\). Since \(h_0(t_i)\) is common to all subjects at time \(t_i\), it cancels when forming conditional probabilities of who fails next among the risk set. This cancellation is what makes the likelihood “partial,” focusing on relative risks rather than absolute hazard levels.

3.2 Computation of the score and information

The score function is the gradient of the log partial likelihood with respect to \(\boldsymbol{\beta}\). It summarizes how the observed event pattern differs from what the model predicts using current parameter values. The information matrix (or its sandwich variants) is used to estimate the variability of \(\hat{\boldsymbol{\beta}}\), enabling standard errors and confidence intervals.

3.3 Maximum partial likelihood estimation

The Cox estimator is obtained by maximizing the partial likelihood (or equivalently minimizing the negative log partial likelihood). Numerical optimization methods are used because closed-form solutions typically do not exist. The resulting \(\hat{\boldsymbol{\beta}}\) is often computed with iterative procedures (e.g., Newton–Raphson or related algorithms).

3.4 Tie handling methods

Ties occur when multiple events share the same observed time. Because partial likelihood depends on how the “next failure” probabilities are computed, ties require special handling.

3.4.1 Efron and Breslow approaches

Two widely used tie approximations are:

  • Breslow’s method, which treats tied events as if they occurred sequentially without adjusting the risk set appropriately for each tied failure.
  • Efron’s method, which provides a refined approximation by averaging over possible orderings within the tied set.

Different software packages choose defaults, and analysts should be aware of how tie handling can affect estimates when event times cluster.

4 Inference and performance metrics

Inference in the Cox model typically relies on asymptotic approximations. Performance evaluation focuses on discrimination and, when desired, calibration.

4.1 Standard errors and confidence intervals

Standard errors are derived from the estimated information matrix associated with the partial likelihood. Confidence intervals for coefficients are commonly constructed on the log-hazard scale and then exponentiated to obtain intervals for hazard ratios. In clustered or repeated-measures settings, robust (sandwich) variance estimators may be used to account for within-cluster correlation.

4.2 Hypothesis testing for covariate effects

Hypothesis tests assess whether specific covariate effects are statistically distinguishable from zero (equivalently, whether hazard ratios differ from 1).

4.2.1 Wald tests and likelihood ratio tests

  • Wald tests use the estimated coefficient and its standard error, comparing \(\beta\) to a hypothesized value (often 0).
  • Likelihood ratio tests compare the partial likelihood values between a full model and a reduced model, using an asymptotic chi-square distribution for the test statistic.

Both approaches are common; choice can depend on implementation details and sample size.

4.2.2 Score (log-rank-type) tests

Score tests evaluate departures from the null model using information computed under the null. For special cases, these tests relate closely to log-rank-type comparisons, though the presence of covariates generalizes the idea.

4.3 Measures of predictive ability

Beyond hypothesis testing, practitioners often evaluate how well the fitted model discriminates between individuals who experience events earlier versus later.

4.3.1 Concordance index (C-index)

The C-index measures the probability that, among comparable pairs of subjects, the subject with higher predicted risk experiences the event sooner. Handling censoring requires careful definition of comparability pairs. Values near 0.5 indicate limited discrimination, while values approaching 1 indicate strong predictive ordering.

4.3.2 Time-dependent ROC (overview)

Time-dependent receiver operating characteristic curves extend ROC analysis to survival outcomes by defining “cases” as having experienced the event by a chosen time horizon. Because censoring complicates estimation, time-dependent ROC methods use weighting or model-based adjustments to produce estimates of sensitivity and specificity over time.

5 Checking model assumptions

Because the Cox model relies on proportional hazards and correct covariate specification, diagnostic work is essential. Diagnostics aim to identify violations rather than confirm correctness.

5.1 Assessing proportional hazards

The key assumption is that hazard ratios remain constant over time. Multiple techniques are used to evaluate this.

5.1.1 Graphical checks (log-minus-log, Schoenfeld residuals)

  • Log-minus-log plots compare transformed survival curves across covariate groups; approximate parallelism supports proportional hazards.
  • Schoenfeld residuals examine whether residuals systematically vary with time. If residual patterns suggest changes in effect magnitude, proportional hazards may be violated.

5.2 Residual diagnostics

Residuals provide a way to compare observed outcomes with those expected under the model.

5.2.1 Martingale and deviance residuals

  • Martingale residuals reflect differences between observed event indicators and modeled event probabilities, useful for detecting nonlinearities or omitted covariate effects.
  • Deviance residuals provide a scaled residual that can help visualize model fit patterns, particularly in the presence of multiple covariates.

5.3 Influential observations and leverage

Even a well-specified model can be distorted by a small number of influential points.

5.3.1 Outlier and impact diagnostics

Influence can be assessed using measures analogous to leverage and influence in generalized linear models, often based on how removal of an observation changes fitted coefficients or the partial likelihood. Analysts also examine whether extreme covariate values coincide with unusual event timings.

5.4 Model misspecification considerations

Common forms of misspecification include omitted relevant covariates, incorrect functional form for continuous predictors, and time-varying effects not captured by proportional hazards. When diagnostics suggest problems, strategies include transforming covariates, adding nonlinear terms, stratifying, or adopting time-varying coefficient extensions.

6 Extensions of the Cox model

Several extensions address limitations of the standard Cox framework, including non-proportionality, heterogeneity in baseline hazards, and competing event types.

6.1 Time-varying covariates

In some studies, covariates change over follow-up (e.g., treatment switches, biomarker updates). The model can be adapted by allowing \( \mathbf{X}(t) \) to vary with time, effectively updating risk contributions as covariate values evolve. This typically requires counting-process methods and careful definition of when covariate values are observed.

6.2 Stratified Cox models

Stratification, discussed earlier, provides a way to account for different baseline hazards across strata while keeping covariate effects shared. It is useful when proportional hazards is plausible within each stratum but baseline rates differ substantially.

6.3 Cox models with competing risks (overview)

When more than one type of event can occur, standard Cox modeling of “time to any event” may conflate distinct processes. Competing risks frameworks distinguish cause-specific hazards or model the subdistribution of the event probability. Cox-type models can be used for cause-specific analysis, while alternative estimands focus on cumulative incidence, depending on the research question.

6.4 Additive hazards alternatives (high-level comparison)

An additive hazards model expresses the hazard as \[ h(t\mid \mathbf{X}) = h_0(t) + \boldsymbol{\beta}^\top \mathbf{X}, \] contrasting with the multiplicative structure of Cox. Additive approaches can be advantageous when effects are better represented as absolute rather than relative hazard changes, though they impose different assumptions and interpretational conventions.

6.5 Accelerated failure time models vs Cox (contrast)

Accelerated failure time (AFT) models assume covariates accelerate or decelerate event times, often expressed through \[ \log T = \boldsymbol{\beta}^\top \mathbf{X} + \varepsilon \] under a specified error distribution. Compared with Cox, AFT models provide direct statements about time scaling (e.g., median time ratios), while Cox emphasizes hazard ratios and does not require an explicit baseline hazard parameterization.

7 Practical modeling workflow

A robust analysis typically follows a staged workflow: prepare data, specify variables, fit candidate models, assess assumptions, and validate predictions.

7.1 Variable selection and regularization

Covariate choice balances interpretability and predictive performance. Regularization can mitigate overfitting, especially with many predictors.

7.1.1 Stepwise selection (conceptual overview)

Stepwise methods add or remove variables based on criteria such as p-values or information measures. They are simple to implement but can be unstable in correlated covariate settings or small samples. As a result, many analysts supplement stepwise procedures with validation and domain knowledge.

7.1.2 Penalized Cox regression (ridge/lasso)

Penalized methods incorporate a penalty on coefficient magnitude during optimization:

  • Ridge (L2) penalty shrinks coefficients smoothly, often helping with multicollinearity.
  • Lasso (L1) penalty encourages sparsity and can perform variable selection by driving some coefficients to exactly zero.

Elastic net combines both penalties to balance stability and selection.

7.2 Model building and validation

After fitting, models should be checked for adequacy and evaluated on data not used for training.

7.2.1 Train/test splits and cross-validation

Validation can be implemented via hold-out test sets or cross-validation. In survival contexts, evaluation requires methods that account for censoring and respect time ordering, such as using concordance-based metrics or time-dependent ROC curves.

7.3 Calibration and interpretation in application

Predictive usefulness involves more than discrimination; calibration examines whether predicted risks correspond to observed event frequencies.

7.3.1 Translating hazard ratios to risk statements

Hazard ratios describe relative change in instantaneous risk, not direct absolute event probabilities. To produce risk statements (e.g., predicted survival at a horizon), analysts use estimated baseline information, which in Cox can be obtained through nonparametric estimators of the baseline cumulative hazard. Interpreting these outputs typically requires stating assumptions about the covariate pattern and follow-up window.

8 Implementation in statistical software

Cox modeling is widely available in statistical packages. Implementation details—especially around coding, ties, and variance estimation—affect results.

8.1 Common function interfaces (conceptual)

Most interfaces accept:

  • a survival object containing time and event indicator,
  • covariates in a design matrix or formula syntax,
  • options for ties, stratification, and robust variance.

Some packages support counting-process style input for delayed entry and time-dependent covariates.

8.2 Preprocessing and data formatting

Before fitting, analysts typically:

  • verify that event times and censoring indicators align correctly,
  • handle missing values through appropriate imputation or exclusion strategies,
  • ensure consistent factor levels and reference categories,
  • check whether units of measurement and scaling are appropriate for interpretability.

For delayed entry, risk intervals must be constructed so that each subject contributes to the correct at-risk periods.

8.3 Output interpretation (coefficients, hazard ratios)

Software typically reports coefficients \(\hat{\beta}\), standard errors, and statistics for testing. Hazard ratios are obtained as \(\exp(\hat{\beta})\). Analysts interpret these values in context, considering whether effects are plausible given diagnostics and whether proportional hazards appears to hold.

8.4 Reproducibility and reporting standards

Clear reporting supports reproducibility. Typical elements include:

  • description of censoring and follow-up,
  • covariate definitions and coding,
  • tie handling method,
  • methods for variance estimation (standard vs robust),
  • diagnostics performed for proportional hazards,
  • validation approach and performance metrics.

Providing model formulas and key tuning decisions improves transparency for readers who wish to replicate results.