Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Cox–Snell Residuals for Survival Model Fit

Survival Models Review · Tutorial 119 of 697

Cox–Snell Residuals for Survival Model Fit

Calculate model-based Cox–Snell residuals and interpret their censored cumulative-hazard plot as a diagnostic of overall survival-model fit.

Intermediate 10 min read

What You'll Learn

  • Define Cox–Snell residuals using a fitted conditional cumulative hazard.
  • Calculate residuals from parametric survival models and Cox models.
  • Preserve event indicators and right censoring when forming residual data.
  • Construct a Nelson–Aalen cumulative-hazard diagnostic for the residuals.
  • Interpret departures from the unit-exponential reference cautiously.
  • Recognize assumptions and limitations of this overall-fit diagnostic.

Why Transform Survival Times Into Residuals?

A fitted survival model assigns each subject a conditional survival distribution, given their covariates. A useful overall diagnostic asks whether observed event and censoring times behave as that model predicts, without requiring the model to have a single simple time scale. Cox–Snell residuals provide such a scale: if the model is correct, the residual event times follow a unit-exponential distribution. The key is to compare their estimated cumulative hazard with the reference cumulative hazard \(r\), while retaining right-censored observations as censored.

This is a diagnostic of overall fit, not a replacement for examining individual model assumptions. In particular, it does not by itself identify whether a departure comes from the baseline hazard, covariate effects, functional form, or another source of misspecification.

Definition and Reference Distribution

Definition: For subject \(i\), let \(\widehat H(t\mid x_i)\) be the fitted conditional cumulative hazard at time \(t\), given covariates \(x_i\). The Cox–Snell residual at the observed time \(Y_i=\min(T_i,C_i)\) is \(r_i=\widehat H(Y_i\mid x_i)\). Its event indicator remains \(\delta_i=I(T_i\le C_i)\). Thus, if the observation is right-censored, \(r_i\) is a censored residual, not an observed event residual.

Here \(T_i\) is the event time and \(C_i\) is the censoring time. The cumulative hazard and survival function satisfy \(H(t\mid x)=-\log S(t\mid x)\). For a parametric model, calculate this quantity from its fitted conditional distribution. For a proportional-hazards Cox model, the fitted cumulative hazard is commonly obtained as the fitted baseline cumulative hazard multiplied by the subject's relative hazard.

$$ \widehat H(t\mid x_i)=-\log \widehat S(t\mid x_i), \qquad \widehat H(t\mid x_i)=\widehat H_0(t)\exp(x_i^\mathsf{T}\widehat\beta) \quad\text{for a Cox model.} $$

The reference distribution follows from a probability transformation. Suppose the true conditional survival model is continuous and correctly specified. For an uncensored event time \(T_i\), set \(R_i=H(T_i\mid x_i)\). For any \(r\ge0\), monotonicity of \(H\) gives

$$ P(R_i>r\mid x_i) =P\{T_i>H^{-1}(r\mid x_i)\mid x_i\} =S\{H^{-1}(r\mid x_i)\mid x_i\} =\exp(-r). $$

Therefore \(R_i\mid x_i\sim\operatorname{Exp}(1)\), with density \(\exp(-r)\) for \(r\ge0\), and the same reference distribution applies across covariate values. In practice, the fitted residuals use estimated parameters, so their distribution is only approximately unit exponential in a finite sample.

Conditions for Interpreting the Diagnostic

The transformation is most directly justified when the conditional event-time distribution is correctly specified, the cumulative hazard is evaluated for the subject's covariates and at the observed time, and the event-time distribution is continuous. Right censoring must be noninformative conditional on the covariates used in the model: after conditioning on those covariates, censoring should not convey additional information about the event time. Subjects should also be analyzed with their appropriate observed follow-up and event indicators.

The fitted survival function or cumulative hazard must be valid and nondecreasing in time. In the Cox model, use the fitted baseline cumulative hazard from the model and the same coefficient and tie-handling conventions used in fitting. With time-varying covariates, the relevant cumulative hazard is accumulated along the subject's covariate history; simply multiplying a baseline value by one fixed risk score is not generally adequate.

If these conditions fail, the residual plot can reveal a mismatch, but it cannot establish which assumption failed. Conversely, a plot close to the reference does not prove the model is correct: limited sample size, heavy censoring, or compensating errors can conceal departures.

Calculating Residuals and Assessing Fit

Once each \(r_i\) and \(\delta_i\) has been calculated, regard them as a right-censored survival data set. Estimate its cumulative hazard, often with the Nelson–Aalen estimator, and plot that estimate against residual time \(r\). The unit-exponential reference has cumulative hazard \(H_{\mathrm{ref}}(r)=r\), so the benchmark is a 45-degree line. A close track is consistent with overall fit; systematic curvature or persistent separation from the line suggests a discrepancy.

$$ \widehat H_{\mathrm{NA}}(r) =\sum_{r_{(j)}\le r}\frac{d_j}{Y_j}, \qquad H_{\mathrm{ref}}(r)=r. $$

In this formula, \(r_{(j)}\) is a distinct residual event time, \(d_j\) is the number of residual events at that time, and \(Y_j\) is the number of residual observations still at risk immediately before it. Censored residuals reduce later risk sets but do not contribute an event increment. This is essential: treating every censored follow-up as an event makes the estimated cumulative hazard too large.

Worked Example: Residuals From a Weibull Model

Suppose a hypothetical fitted Weibull proportional-hazards model has conditional cumulative hazard \(\widehat H(t\mid x)=(t/10)^{1.5}\exp(\eta)\), where time is measured in months and \(\eta\) is the fitted linear predictor. For one subject, the observed time is 8 months, the event occurred, and \(\eta=\log(1.5)\). Calculate the Cox–Snell residual.

Substitute the observed time and predictor into the fitted cumulative hazard:

$$ r=(8/10)^{1.5}\exp\{\log(1.5)\} =0.8^{1.5}(1.5) \approx 0.7155(1.5) =1.073. $$

The subject contributes an event residual of approximately 1.073. The residual is on the cumulative-hazard scale, not in months.

For comparison, suppose another subject is censored at 6 months with \(\eta=\log(0.8)\). Their residual is

$$ r=(6/10)^{1.5}(0.8) =0.6^{1.5}(0.8) \approx 0.4648(0.8) =0.3718. $$

This is recorded as a censored residual at 0.3718. The calculation does not turn the subject's censoring into an event.

Worked Example: Residual From a Cox Model

Suppose a hypothetical Cox model has fitted baseline cumulative hazard increments of 0.10, 0.15, and 0.20 at event times up to 4 years. Thus, the fitted baseline cumulative hazard at 4 years is \(0.10+0.15+0.20=0.45\). A subject has linear predictor \(x_i^\mathsf{T}\widehat\beta=0.40\), and an event is observed at 4 years. Calculate the residual.

The fitted relative hazard is \(\exp(0.40)\approx1.4918\). Applying the Cox-model formula,

$$ r_i=\widehat H_0(4)\exp(0.40) =(0.45)(1.4918) =0.6713. $$

The event contributes a residual of approximately 0.6713. The subject's relative hazard is greater than 1, so the fitted cumulative hazard accumulated by 4 years is greater than the baseline cumulative hazard. If the same subject instead had been censored at 4 years, the calculated value would be recorded as censored at 0.6713.

Worked Example: Estimating the Residual Cumulative Hazard

Consider five hypothetical residual records, already calculated from a fitted model: event at 0.20, censoring at 0.35, event at 0.50, event at 0.80, and censoring at 1.10. Calculate the Nelson–Aalen cumulative hazard at the three event times.

At residual time 0.20, all five observations are at risk and one event occurs, so the increment is \(1/5=0.2000\). At 0.50, the observation censored at 0.35 has left the risk set, leaving three at risk; the increment is \(1/3=0.3333\). At 0.80, two remain at risk and one event occurs, giving an increment of \(1/2=0.5000\). The cumulative estimates are therefore

$$ \widehat H_{\mathrm{NA}}(0.20)=0.2000,\qquad \widehat H_{\mathrm{NA}}(0.50)=0.2000+0.3333=0.5333,\qquad \widehat H_{\mathrm{NA}}(0.80)=0.2000+0.3333+0.5000=1.033. $$

The corresponding reference values are 0.20, 0.50, and 0.80. The final estimate is above its reference value, but this tiny data set is far too small to support a strong conclusion. In a larger data set, assess the overall shape and uncertainty rather than treating one point as decisive.

Reading the Plot and Comparing Approaches

The diagnostic asks whether the residual event process is compatible with a unit-exponential distribution. If the estimated cumulative hazard lies broadly near the identity line, the model's overall survival distribution is reasonably consistent with the data. If it is systematically above the line over a range, events have accumulated faster on the residual scale than the reference predicts; if it is below, they have accumulated more slowly. Curvature can indicate that the discrepancy changes across residual time. These patterns are clues, not unique diagnoses.

Cox–Snell residuals offer a common scale for parametric and Cox models. For a parametric model, the fitted conditional cumulative hazard comes from the chosen distribution and estimated parameters. For a Cox model, it comes from the estimated baseline cumulative hazard and fitted relative hazards. The same residual plot can then be used for either. By contrast, inspecting a parametric survival curve against a nonparametric curve retains the original time scale and can be easier to explain, but does not provide this common exponential reference. Other residual types answer more targeted questions; they should not be mistaken for this overall cumulative-hazard check.

Because residuals depend on estimated model parameters, ordinary reference lines do not account for all sampling uncertainty. A visual assessment is usually more informative when accompanied by uncertainty bands or a simulation-based check that repeats the full fitting and diagnostic procedure. A bootstrap or parametric simulation should refit the model in each replicate; otherwise, it omits parameter-estimation variability. Heavy censoring makes the tail of the residual cumulative-hazard curve especially uncertain, since few observations remain at risk there.

Common Mistakes and Failure Modes

  • Counting censored residuals as events. A censoring time gives a lower bound on the unobserved event residual. Keep its event indicator as zero; it leaves later risk sets but adds no event increment.
  • Comparing residual times directly with exponential event times without accounting for censoring. The appropriate comparison uses a survival-data cumulative-hazard estimate, not a histogram that treats censored values as fully observed events.
  • Using the baseline cumulative hazard alone for every Cox-model subject. For a fixed-covariate proportional-hazards model, multiply the baseline cumulative hazard by \(\exp(x_i^\mathsf{T}\widehat\beta)\) before evaluating the residual.
  • Calling a near-diagonal plot proof of correctness. The diagnostic has limited power, particularly with few events or extensive censoring. It is evidence about fit, not a guarantee.
  • Assigning a single cause to a departure. A discrepancy may reflect the baseline distribution, covariate specification, omitted predictors, or violated censoring assumptions. Further checks are needed to distinguish them.
Key takeaway: Calculate \(r_i=\widehat H(Y_i\mid x_i)\), preserve \(\delta_i\), and estimate the cumulative hazard of the resulting censored residual data. Compare that estimate with \(H_{\mathrm{ref}}(r)=r\); interpret departures as warnings about overall fit, not as definitive diagnoses.

Check Your Understanding

Answer each question, then check the brief solutions below.

  1. A subject is censored at time \(t\). What two pieces of information are recorded for the Cox–Snell residual?
  2. A fitted model gives \(\widehat H(t\mid x)=0.60\) at an observed event time. What residual is recorded, and what is its event status?
  3. At a residual event time, 8 observations are at risk and 2 events occur. What is the Nelson–Aalen increment?
  4. What does the unit-exponential reference cumulative hazard equal at residual time \(r=1.4\)?
  5. Why does a plot near the reference line not prove that every component of the survival model is correct?

Solutions. (1) Record \(r=\widehat H(t\mid x)\) and retain the censoring indicator \(\delta=0\); the residual is censored. (2) The residual is 0.60 and is an event residual because an event was observed. (3) The increment is \(d/Y=2/8=0.25\). (4) It is \(H_{\mathrm{ref}}(1.4)=1.4\). (5) The diagnostic may have limited power, especially with few events or heavy censoring, and different model errors can be difficult to distinguish from this plot alone.

Clinical Biostats