Tutorials › Nonlinear Mixed-Effects Models (NLME) › Diagnostics for Mixed-Effects Survival Models

Categorical, Count and Time-to-Event Responses · Tutorial 449 of 797

Diagnostics for Mixed-Effects Survival Models

Learn to compare observed survival with appropriately averaged model predictions and to interpret residual and event-time diagnostics when censoring and random effects are present.

Advanced 12 min read

What You'll Learn

  • Distinguish conditional survival predictions from predictions averaged over random effects.
  • Compare observed and predicted survival while respecting censoring and the target population.
  • Construct cumulative-hazard residuals and assess them against the unit-exponential reference.
  • Use event-time summaries such as the Kaplan–Meier median and restricted mean survival time.
  • Recognize how informative censoring, estimated random effects, and small samples can mislead diagnostics.

Why Survival-Model Diagnostics Need Special Care

A mixed-effects survival model can describe event times that vary both with measured covariates and with unobserved subject-level heterogeneity. A diagnostic must therefore make clear which survival distribution it is checking: survival conditional on a subject’s random effect, or survival averaged over the random-effect distribution. Censoring adds another complication. A curve calculated only from observed event times generally does not estimate survival correctly unless censoring is handled under appropriate assumptions.

The checks here focus on calibration: whether the fitted model’s survival probabilities and event-time summaries agree with what is observed. They can reveal systematic overprediction or underprediction, but a close match does not prove that the model is correct. In particular, diagnostics can be weak when samples are small or censoring is extensive.

Definition: Let \(T_i\) be a subject’s event time, \(C_i\) their censoring time, and \(Y_i=\min(T_i,C_i)\) the observed time. Let \(\delta_i=1\) if the event is observed and \(0\) if the subject is censored. Write \(x_i\) for covariates and \(b_i\) for the subject’s random effect. The conditional survival function is \(S(t\mid x_i,b_i)=P(T_i>t\mid x_i,b_i)\). The population-averaged survival function at \(x_i\) is \(S_{\mathrm{pop}}(t\mid x_i)=\int S(t\mid x_i,b)g(b)\,db\), where \(g\) is the modelled random-effect distribution.

Observed Versus Predicted Survival

A calibration plot compares estimated observed survival with model-predicted survival over time. For a group of subjects, the observed curve is often estimated by the Kaplan–Meier estimator. Its usual interpretation as the group’s survival curve requires censoring to be independent of event time marginally within that group. If censoring is independent only after conditioning on covariates or random effects, an unadjusted pooled Kaplan–Meier curve need not estimate the group’s marginal survival: mixing over those variables can induce dependence between censoring and event time.

The predicted curve must target the same population as the observed curve. A conditional prediction \(S(t\mid x_i,b_i)\) describes a subject at specified covariates and random effect. A population-averaged prediction integrates over random effects. For a cohort with covariates \(x_1,\ldots,x_n\), one simple standardized model curve is the average of \(S_{\mathrm{pop}}(t\mid x_i)\) over that cohort. This is not necessarily the same as a prediction at the average covariate value.

When censoring depends on measured covariates, possible remedies include comparisons within covariate strata or censoring-adjusted methods such as inverse-probability-of-censoring weighting. Such methods require an appropriate model for censoring and adequate data to estimate it. Random-effect heterogeneity must also be represented in the prediction or adjustment. A conditional independence assumption alone does not justify an ordinary pooled Kaplan–Meier comparison.

Worked Example: Comparing Cohort Survival at a Fixed Time

Consider a hypothetical cohort of eight subjects. Assume, for this illustration, that censoring is independent of event time marginally in this cohort. The observed event and censoring pattern is: one event at time 2, one censoring at time 4, two events at time 5, one censoring at time 7, and one event at time 8. The remaining subjects are censored after time 8.

At time 2, eight are at risk and one event occurs, giving a Kaplan–Meier factor of \(7/8\). At time 4, censoring reduces the risk set to six. At time 5, two of those six experience the event, giving a factor of \(4/6\). Censoring at time 7 leaves three at risk, and the event at time 8 gives a factor of \(2/3\). Thus:

$$ \widehat S_{\mathrm{KM}}(8) =\frac{7}{8}\times\frac{4}{6}\times\frac{2}{3} =\frac{7}{18} \approx 0.3889. $$

Suppose the fitted mixed-effects model’s population-averaged prediction, standardized to these eight subjects’ covariates, is \(0.55\) at time 8. The estimated observed survival is about 0.161 lower than the prediction. This is a calibration discrepancy worth investigating, not by itself proof of model failure: the cohort is small, and the Kaplan–Meier estimate has sampling uncertainty. The comparison is meaningful only because the observed and predicted quantities target the same cohort and the stated censoring assumption is appropriate.

Cumulative-Hazard Residuals

A cumulative-hazard residual transforms an event time onto a scale with a simple reference distribution. For a continuous event-time model, define the cumulative hazard \(H(t)=-\log S(t)\). If the correct survival function for a subject’s covariates is known, the transformed event time \(R=H(T)\) follows a unit exponential distribution. In a mixed-effects model, this transformation can use either the conditional survival function at the true random effect or the survival function marginalized over the random-effect distribution. In practice, the latter avoids treating an estimated individual random effect as known.

$$ R_i=-\log S_{\mathrm{pop}}(T_i\mid x_i),\qquad R_i^{\mathrm{cens}}=-\log S_{\mathrm{pop}}(C_i\mid x_i). $$

For a censored subject, the transformed censoring time is observed, but the transformed event time is only known to exceed it. Thus residuals are censored too; they must not be treated as observed events at the censoring values. Under the correctly specified continuous event model, \(P\{H(T)>r\}=e^{-r}\) for \(r\geq 0\), so \(R\sim\mathrm{Exp}(1)\), with survival \(e^{-r}\) and cumulative hazard \(r\).

Justification: For a continuous event-time distribution with survival \(S(t)\), \(P\{H(T)>r\}=P\{T>S^{-1}(e^{-r})\}=e^{-r}\), where \(H(t)=-\log S(t)\). Equivalently, \(S(T)\) is uniform on \((0,1)\), so \(-\log S(T)\) is unit exponential. The argument applies to a mixed-effects model when \(S\) is the correct conditional survival for a known random effect, or the correct marginal survival after integrating over random effects.

Plot a nonparametric cumulative-hazard estimate of the transformed residuals against \(r\), with the reference line \(r\). Systematic curvature or persistent departures can indicate a mismatch in the event-time distribution. For example, a curve consistently above the reference suggests more cumulative residual events than expected over that range. Sampling variation, especially in the tail where few subjects remain at risk, can create substantial apparent departures.

An ordinary pooled Kaplan–Meier or cumulative-hazard comparison of residuals still needs marginal independent censoring on the residual scale. Conditional independence given covariates or random effects does not guarantee this after mixing. If censoring independence holds only conditionally, use an appropriate conditional, stratified, or censoring-adjusted analysis and account for the random-effect distribution. Also, residuals formed using empirical Bayes estimates of \(b_i\) are not exactly unit exponential: those estimates are uncertain and often informed by the same event data being checked. Marginal transformations, or simulation-based checks that repeat the fitting and estimation process, help avoid overinterpreting such plug-in residuals.

Worked Example: Reading a Cumulative-Hazard Residual Plot

Suppose five hypothetical subjects have transformed residual records under a fitted model: events at \(r=0.2,\ 0.4,\ 0.8,\) and \(1.0\), and one subject censored at \(r=0.6\). Assume for this simple calculation that censoring is independent of event time marginally on this residual scale.

The Nelson–Aalen cumulative-hazard estimate adds \(1/n_j\) at each event, where \(n_j\) is the number at risk just before that event. At \(r=0.2\), five are at risk, so the increment is \(1/5=0.2\). At \(r=0.4\), four are at risk, giving \(1/4=0.25\). The censoring at \(0.6\) removes one subject without adding an increment. At \(r=0.8\), two are at risk, giving \(1/2=0.5\), and at \(r=1.0\), one is at risk, giving \(1\).

$$ \widehat H_{\mathrm{NA}}(0.2)=0.20,\quad \widehat H_{\mathrm{NA}}(0.4)=0.45,\quad \widehat H_{\mathrm{NA}}(0.8)=0.95,\quad \widehat H_{\mathrm{NA}}(1.0)=1.95. $$

The reference values on the diagonal at those points are \(0.2,\ 0.4,\ 0.8,\) and \(1.0\). The estimate rises well above the diagonal at the last two points, but those increments are based on risk sets of two and one. This tiny example cannot establish miscalibration; it illustrates both the calculation and why late-tail departures require caution.

Event-Time Summaries and Diagnostics

Event-time summaries provide a compact check on clinically interpretable features of the distribution. Common choices include the median survival time and the restricted mean survival time (RMST) up to a prespecified horizon \(\tau\). The RMST is the area under the survival curve from zero to \(\tau\), or equivalently the expected event-free time accumulated up to \(\tau\). Comparing such summaries can show whether a model places the central event time or average event-free time too early or too late.

The Kaplan–Meier median is the earliest time at which the estimated survival is at most 0.5; it is not estimable from a curve that remains above 0.5 throughout observed follow-up. RMST estimated from Kaplan–Meier data relies on censoring assumptions over the interval through \(\tau\). Model-based summaries should be computed for the same target population and horizon as their observed counterparts, and uncertainty should be reported when drawing conclusions. Comparing only observed event times, while ignoring censored subjects, generally biases summaries toward shorter event times.

Worked Example: Median and Restricted Mean Survival Time

In a hypothetical group of six subjects, events occur at times 2, 3, and 4, and the other three subjects are censored after time 5. Assume marginal independent censoring and consider \(\tau=5\). The Kaplan–Meier estimates after the three events are \(5/6\), then \((5/6)(4/5)=2/3\), then \((2/3)(3/4)=1/2\). Therefore, the estimated median survival time is 4 time units.

The RMST through 5 is the area under this stepwise curve:

$$ \widehat{\mathrm{RMST}}(5) =2(1)+1\left(\frac{5}{6}\right) +1\left(\frac{2}{3}\right)+1\left(\frac{1}{2}\right) =4.000\ \text{time units}. $$

Suppose the fitted model predicts a population-averaged median of 5 time units and an RMST through 5 of 4.4 time units for this same group. The observed summaries are both lower: by 1 time unit for the median and 0.4 time units for the RMST. This points to possible overprediction of survival in this hypothetical group, but uncertainty and censoring must be considered before judging the model.

Practical Workflow, Failure Modes, and Alternatives

1
Define the target.
Specify the cohort, covariate distribution, time horizon, and whether the comparison is conditional on random effects or averaged over their distribution.
2
Check censoring assumptions.
For an unadjusted pooled Kaplan–Meier comparison, require marginal independent censoring in the group or on the residual scale. Otherwise, use a suitable conditional or censoring-adjusted method.
3
Compare complementary diagnostics.
Inspect observed-versus-predicted curves, transformed cumulative hazards, and event-time summaries; discrepancies in one view may be hidden in another.
4
Assess uncertainty and influential features.
Use uncertainty intervals or model-based resampling where appropriate, and examine whether departures concentrate in a covariate subgroup, follow-up period, or sparse tail.

A common mistake is to argue that censoring is independent after conditioning on covariates and random effects, then compare one pooled Kaplan–Meier curve with a population-averaged prediction. That conditional statement does not, in general, ensure marginal independence after mixing; the subjects still under observation can have a different covariate or random-effect composition. The correction is to establish marginal independent censoring for the pooled comparison, or to condition, stratify, or adjust for the censoring-related variables while representing heterogeneity appropriately.

Other warning signs include treating censored residuals as events, using conditional predictions as if they described the whole cohort, and interpreting a late-tail discrepancy where very few subjects remain at risk as strong evidence. Alternatives to a simple pooled curve include covariate-stratified comparisons, inverse-probability-of-censoring-weighted estimates, and simulation-based checks. These approaches have their own assumptions: weighting depends on a credible censoring model, and simulations can only reflect the model and estimation process specified. No single diagnostic detects every form of misspecification.

Key takeaway: A survival diagnostic is informative only when its observed and predicted quantities target the same population and its censoring assumptions match the method. Integrate over random effects when assessing population calibration, and interpret residual and tail behavior with their uncertainty in view.

Check Your Understanding

Try each question, then compare your reasoning with the concise solutions below.

  1. Why is conditional independent censoring given covariates and random effects not enough to justify an ordinary pooled Kaplan–Meier comparison?
  2. Under a correctly specified continuous survival model, what is the reference distribution for a cumulative-hazard residual?
  3. A subject is censored at transformed residual \(r=0.7\). Should this be counted as an event at \(0.7\)?
  4. A Kaplan–Meier curve stays above 0.5 through the end of follow-up. What can be reported about the median?
  5. What must match when comparing an observed survival curve with a model-predicted curve?

Solutions. (1) Mixing over covariates or random effects can induce marginal dependence between censoring and event time, so the pooled Kaplan–Meier estimator may not estimate the population survival curve. Use marginal independent censoring or an appropriate adjusted comparison. (2) The reference is unit exponential, with survival \(e^{-r}\) and cumulative hazard \(r\), when the correct survival transformation is used. (3) No. It is a censored residual: the event residual is only known to exceed 0.7. (4) The median is not estimable within the observed follow-up, because the estimated survival has not reached 0.5. (5) The target cohort or covariate distribution, time scale, and conditioning or averaging over random effects must align; censoring must also be handled under assumptions appropriate to the observed estimator.