Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Cox-Snell Residuals For Joint Survival Components

Model Diagnostics · Tutorial 604 of 697

Cox-Snell Residuals For Joint Survival Components

Learn to calculate Cox–Snell residuals from a joint survival model and interpret their censored residual-time plot without confusing conditional, marginal, and fitted-model behavior.

Advanced 12 min read

What You'll Learn

  • Define conditional and marginal Cox–Snell residuals for a joint survival component.
  • Transform observed event and censoring times using fitted cumulative hazards.
  • Derive why correctly specified residuals follow a unit-exponential distribution.
  • Compare conditional plug-in and marginal residual constructions.
  • Assess overall hazard fit with censored residuals and identify key limitations.
  • Recognize why marginal cumulative hazards cannot generally be averaged across latent effects.

Why transform event times?

A joint model describes repeated marker measurements and an event process together. Its survival component specifies how the event hazard depends on covariates and, often, on a latent marker trajectory or shared random effects. A fitted model may capture the association between marker history and event risk yet still represent the event-time distribution poorly. Cox–Snell residuals provide an overall check of that survival fit by transforming follow-up times to a scale with a simple reference distribution.

The key is to use the cumulative hazard implied by the fitted survival component, not merely a linear predictor or a hazard value at the observed time. Under a correctly specified model, the transformed event time has a unit-exponential distribution. With right censoring, residuals remain censored; the reference comparison must account for that censoring rather than treating censored observations as events.

Definition and model basis

Definition: Let \(T_i\) be subject \(i\)'s event time and let \(C_i\) be the censoring time. The observed time is \(\tilde T_i=\min(T_i,C_i)\), and \(\delta_i=I(T_i\le C_i)\) indicates whether the event was observed. If \(\Lambda_i(t)\) is the cumulative hazard for subject \(i\) under the specified survival distribution, the Cox–Snell residual time is \(R_i=\Lambda_i(T_i)\). In observed data, calculate \(r_i=\widehat{\Lambda}_i(\tilde T_i)\); it is an event residual if \(\delta_i=1\), and a right-censored residual if \(\delta_i=0\).

For a joint model, the survival component may be written, for example, as

$$ h_i(t\mid b_i,\mathcal M_i(t)) = h_0(t)\exp\{\gamma^\mathsf{T}w_i+\alpha m_i(t;b_i)\}, \qquad \Lambda_i(t\mid b_i,\mathcal M_i) = \int_0^t h_i(u\mid b_i,\mathcal M_i(u))\,du . $$

Here \(h_0(t)\) is the baseline hazard, \(w_i\) denotes survival covariates, \(b_i\) denotes latent random effects, and \(m_i(t;b_i)\) is the marker trajectory implied by the longitudinal submodel. The association parameter \(\alpha\) links that trajectory to the hazard. Other joint-model association structures are possible; the residual calculation always uses the cumulative hazard corresponding to the fitted survival model and the chosen conditioning or marginalization target.

A conditional residual uses \(\widehat{\Lambda}_i(t\mid b_i)\), often with an estimated subject-specific random effect. A marginal residual instead uses the cumulative hazard derived from the appropriate marginal survival function. These are not interchangeable: integrating over latent effects changes the survival function nonlinearly. The analysis should say which residual is used and what distribution it is intended to assess.

Why the reference is unit exponential

The result follows from the cumulative-hazard transformation. Suppose first that the model is known, the conditional event-time distribution is continuous, and the cumulative hazard \(\Lambda_i(t)\) is increasing over the time range of interest. Conditional on the covariates and latent effects used in that model, survival is \(S_i(t)=\exp\{-\Lambda_i(t)\}\). For \(x\ge0\), let \(t_x\) satisfy \(\Lambda_i(t_x)=x\). Then

$$ P\{\Lambda_i(T_i)>x\mid b_i,w_i\} = P(T_i>t_x\mid b_i,w_i) = S_i(t_x\mid b_i,w_i) = \exp(-x). $$

Thus the conditional transformed event time has the unit-exponential distribution, with survival function \(\exp(-x)\), mean 1, and cumulative hazard \(x\). The same argument works for a marginal construction if \(\Lambda_i(t)\) is formed from the correctly specified marginal survival distribution for the target covariate pattern. It does not justify substituting a conditional cumulative hazard while claiming a marginal reference, or vice versa.

In practice, parameters are estimated and latent effects are not observed. Plugging estimated parameters and empirical-Bayes random-effect estimates into the formula makes the reference approximate, not exact: estimation and shrinkage can alter the residual distribution. The unit-exponential result is the model-based benchmark, not a guarantee that finite-sample fitted residuals are independent exact exponential draws.

Worked Example: Conditional residual from a fitted hazard

Suppose a hypothetical fitted model gives one subject a constant conditional hazard of \(0.12\) per year over the relevant interval. The subject has an observed event at 3 years. For this calculation assume the fitted hazard is constant and the subject-specific conditional quantities are treated as known.

The cumulative hazard at 3 years is \( \widehat{\Lambda}_i(3\mid b_i)=0.12\times3=0.36 \). The Cox–Snell residual is therefore \(r_i=0.36\), on the dimensionless cumulative-hazard scale.

Under the model, the reference probability that an event residual exceeds 0.36 is \(P(R_i>0.36)=\exp(-0.36)\approx0.6977\). This single value does not diagnose fit by itself; it contributes one event-time observation to a residual analysis across subjects. The calculation assumes that the constant hazard is an adequate representation over the three years and that the conditional model quantities used in it are the intended ones.

Marginalizing over latent effects

A marginal survival curve averages conditional survival probabilities over the population distribution of random effects (and any other latent quantities being integrated out). If \(b_i\) has density \(f(b)\), then, for fixed covariates,

$$ S_i^m(t)=\int S_i(t\mid b,w_i)f(b)\,db, \qquad \Lambda_i^m(t)=-\log S_i^m(t). $$

The marginal cumulative hazard is the negative logarithm of the averaged survival. It is generally not the average of conditional cumulative hazards. This distinction matters when random effects or shared marker processes make subjects heterogeneous in risk.

Worked Example: A marginal residual for a two-point mixture

Consider hypothetical subjects with no additional covariates and a latent effect taking two equally likely values. At time 2 years, suppose the two conditional cumulative hazards are 0.2 and 0.6. The model-implied marginal survival is the average of the two conditional survivals:

$$ S^m(2)=\frac{\exp(-0.2)+\exp(-0.6)}{2} =\frac{0.8187308+0.5488116}{2} =0.6837712. $$

The marginal cumulative hazard, and hence the marginal Cox–Snell residual for an event at 2 years, is \( \widehat{\Lambda}^m(2)=-\log(0.6837712)\approx0.3801 \). The units are cumulative-hazard units, not years.

The average conditional cumulative hazard is \((0.2+0.6)/2=0.4\), which is not the marginal cumulative hazard here. Averaging the cumulative hazards would give the wrong marginal residual. This calculation assumes the two latent-effect values and their equal population probabilities correctly describe the target marginal distribution.

When using observed longitudinal data to estimate latent effects, there is a further choice: a population-marginal survival curve integrates over the population distribution, whereas a conditional or prediction-oriented calculation may use information from the subject's marker history. The intended target and the way latent effects were estimated should be stated. A plug-in estimate of \(b_i\) is not equivalent to integrating over its uncertainty.

Accounting for right censoring and checking fit

Because \(\widehat{\Lambda}_i(t)\) is nondecreasing, the observed follow-up time transforms to \(r_i=\widehat{\Lambda}_i(\tilde T_i)\). If \(\delta_i=0\), the event is known only to occur after \(\tilde T_i\), so the corresponding event residual is known only to be at least \(r_i\); it is strictly greater if \(\widehat{\Lambda}_i\) is strictly increasing on \([\tilde T_i,T_i]\). Keep the original event indicator: censoring remains censoring on the transformed time scale. Treating censored residuals as observed events will generally distort the reference comparison.

A standard overall check compares the Nelson–Aalen cumulative-hazard estimate for the censored residual times with the unit-exponential cumulative hazard \(H_0(r)=r\). Under an adequate model, the estimated residual cumulative hazard should track the 45-degree line, subject to sampling variability. A residual survival curve can also be compared with \(\exp(-r)\). These are aggregate checks: systematic departures can indicate that the fitted event-time distribution is not capturing the observed hazard pattern, but they do not identify a unique cause.

The usual censoring interpretation requires a suitable independent-censoring assumption. In a conditional analysis, censoring should be independent of event time given the variables and latent effects on which the analysis conditions. In a marginal analysis, the relevant marginal censoring condition must also hold for the residual-time comparison being used. If censoring depends on unaccounted risk, a curve that departs from the reference may reflect censoring as well as event-model misspecification.

Worked Example: Transforming a censored follow-up time

In a hypothetical fitted model, suppose a subject is censored at 2 years, and the fitted conditional cumulative hazard at that time is 0.24. Assume for this illustration that the conditional model and censoring condition are appropriate.

The residual time is \(r_i=\widehat{\Lambda}_i(2)=0.24\), and its indicator remains \(\delta_i=0\). The data therefore contribute a right-censored residual at 0.24, not an event at 0.24. Under the unit-exponential reference, survival beyond 0.24 is \(\exp(-0.24)\approx0.7866\), but this is a model reference probability, not a statement that the subject's event did or did not occur after that point.

For a group of subjects, the censored residual times and indicators are used together to estimate the residual cumulative hazard. The resulting curve can be compared with \(H_0(r)=r\). This one censored observation cannot establish whether the model fits; the interpretation depends on the full sample and its censoring pattern.

1
Choose the target.
Decide whether the check concerns survival conditional on latent effects or a specified marginal survival distribution. State how longitudinal history enters the calculation.
2
Calculate fitted cumulative hazards.
For each subject, evaluate the appropriate fitted \(\widehat{\Lambda}_i(\tilde T_i)\), using the observed follow-up time.
3
Retain censoring indicators.
Use \(r_i\) as an event residual when \(\delta_i=1\), and as a right-censored residual when \(\delta_i=0\).
4
Compare with the reference.
Estimate the cumulative hazard from the censored residual data and compare it with the unit-exponential line \(H_0(r)=r\). Interpret departures with estimation uncertainty and censoring in mind.

Interpretation, alternatives, and limitations

The Cox–Snell residual is an overall distributional check for the survival component. It is useful because it places different fitted hazard shapes on a common cumulative-hazard scale. It does not isolate whether a departure arises from the baseline hazard, the longitudinal association structure, covariate effects, random-effects distribution, or another aspect of the joint model. Further diagnostics are needed to localize a problem.

Conditional plug-in residuals can reveal fit conditional on estimated subject-specific effects, but those effects are estimated from finite and often sparse marker histories. Shrinkage and estimation uncertainty can make the apparent reference behavior too optimistic or otherwise distort it. Marginal residuals avoid treating an estimated individual random effect as known, but require integrating over the correct latent-effect distribution and can conceal conditional patterns by averaging across subjects. Both are model-dependent and can be sensitive to misspecified event or longitudinal components.

The residual-time plot is also affected by sample size, censoring, ties, and the precision of estimated model parameters. A plot close to the diagonal does not prove the joint model is correct, especially when few events occur or follow-up covers only a narrow time range. Conversely, modest deviations may arise from random variation. If fitted parameters or latent effects are treated as fixed when computing the reference, the plot does not automatically include the uncertainty from fitting the model.

Cox–Snell residuals differ from martingale and deviance residuals, which are constructed from event-count discrepancies and have different shapes and interpretations. They also differ from a probability integral transform residual, which transforms the event-time distribution through its cumulative distribution function. Here the target is specifically the cumulative-hazard scale and the unit-exponential reference. The earlier material on martingale residuals and deviance residuals addresses complementary residual constructions; neither makes the conditional-versus-marginal choice unnecessary.

Common mistakes

  • Using the hazard instead of the cumulative hazard. A hazard is an instantaneous rate; the Cox–Snell residual requires integrating that rate to the observed time.
  • Averaging conditional cumulative hazards to get a marginal one. Average conditional survival probabilities first, then take the negative logarithm.
  • Turning censoring into an event. A censored residual is right-censored at its transformed follow-up time and must remain so in the reference comparison.
  • Claiming exact exponential residuals after fitting. The exact result assumes a known correct distribution; fitted parameters and estimated latent effects make the practical reference approximate.
  • Reading a departure as a unique diagnosis. The overall plot flags possible misfit but does not identify which joint-model component caused it.
Key takeaway: Compute the fitted cumulative hazard at each observed follow-up time, preserve each subject's event or censoring status, and compare the censored residual distribution with the unit-exponential reference. Be explicit about whether the construction is conditional or marginal.

Check Your Understanding

Answer each question, then compare with the brief solutions below.

  1. A subject has an event at 4 years and fitted cumulative hazard 0.72. What is the Cox–Snell residual, and what is its reference survival probability?
  2. A subject is censored at a time with fitted cumulative hazard 0.30. How is this observation represented in the residual analysis?
  3. Two equally likely latent groups have conditional cumulative hazards 0.1 and 0.5 at a fixed time. Is the marginal cumulative hazard generally their average? Give the correct construction.
  4. State the cumulative-hazard reference curve for unit-exponential residuals and one reason a fitted-model plot may depart from it even if the model family is suitable.

Solutions. (1) The residual is \(0.72\); the unit-exponential reference survival is \(\exp(-0.72)\approx0.4868\). (2) It is right-censored at residual time \(0.30\), with event indicator zero. (3) No. The marginal survival is \(\{\exp(-0.1)+\exp(-0.5)\}/2\), and the marginal cumulative hazard is the negative logarithm of that quantity. (4) The reference is \(H_0(r)=r\). Parameter estimation, estimated random effects, finite-sample variation, and censoring can all contribute to departures.

Clinical Biostats