Cox–Snell residual 2026-10-06
A Cox–Snell residual is the fitted cumulative hazard function evaluated at an observed event or censoring time. Under a correct model, complete transformed event times are unit exponential; censored transformed times retain their event indicators. A logarithmic Kaplan–Meier estimator survivor plot should be close to a line of slope minus one.
For a correct fitted survival law, complete Cox–Snell residuals are approximately unit exponential. Residuals computed at observed censored times retain their censoring indicators. Fit a Kaplan–Meier estimator to the transformed times and indicators and compare it with , or compare their Nelson–Aalen estimator cumulative hazard with . Treating censored transformed times as complete exponential observations gives a distorted Q–Q check.
For a proper continuous event time, the survival function is . The assumed invertibility of the cumulative hazard function gives, for ,
Therefore
This is the cumulative hazard probability transformation; it applies also conditionally on a subject's covariates, using that subject's correctly specified cumulative hazard function.
The fitted transformed times are Cox–Snell residuals. They retain their event/right censoring indicators, so a right-censored residual represents an exponential observation known only to exceed its displayed value. Under the fitted model and independent right censoring, calculate the Kaplan–Meier estimator of residual survival and compare it with , or calculate the residual Nelson–Aalen estimator and compare its cumulative hazard with the diagonal . Systematic departures reveal model inadequacy; sparse extreme residual risk sets and parameter estimation require caution. Treating all censored residuals as observed event times would invalidate this diagnostic.
Without right censoring, the residual mean should be approximately one. With right censoring, use the modified Cox–Snell residual
For a true unit-rate exponential distribution, the memoryless property gives . Thus an event keeps its known transformed time, while a censored observation is replaced by the conditional expected event time. Under independent right censoring, iterated expectation makes the mean of these adjusted values one when the true hazards are used, and approximately one when fitted hazards are used. These mean-imputed values do not themselves have an exponential distribution, so the survival-curve diagnostic should still use the original censored residual dataset. Moreover fitting equations can force the adjusted sample mean to one, making its mean alone a weak diagnostic.
For the proposed mixture of a finite right censoring time and no right censoring, and
Consequently
When right censoring has positive probability this choice is unique; if , no correction is needed and any has the same effect. Its independence from is the content of exponential memorylessness: the expected extra lifetime after any right censoring time is one. Conditioning on an arbitrary independent right censoring time proves the same correction beyond this special two-point mixture.
The command cox.zph checks the proportional hazards assumption test through time dependence of scaled Schoenfeld residuals. Under constant coefficients, their expected trend against transformed event time should be flat. A significant covariate-specific test would suggest that its coefficient varies with time; the global test checks the coefficients jointly.
The p-values are for age, for gender and for group, with global . Thus these tests find no evidence against proportional hazards. They do not prove the assumption, establish the correct age functional form, or test the censoring mechanism.
The separate diagnostic plot targets the broader fitted survival distribution. The code evaluates a fitted cumulative hazard function at each observed time and multiplies by the subject's fitted hazard multiplier, forming Cox–Snell residuals:
The curve returned without newdata by survfit is a reference-profile curve, not necessarily the all-zero-covariate baseline. The multiplier must use the same centering as that reference curve; the fitted linear predictors use the model's reference convention. With this consistency, times the multiplier is the fitted subject-specific cumulative hazard.
Part (a) shows why complete transformed event times should be approximately unit exponential if the Cox proportional-hazards model is correct. The Q–Q plot compares ordered fitted residuals with an independent random exponential sample. Most points are near the diagonal, with some upper-tail departures, so it gives no obvious indication of a gross distributional failure. A random reference sample adds simulation noise, and estimated parameters and tied recorded times prevent this from being an exact distribution-free test.
Importantly, four observed times are censored. Their transformed times retain the censoring indicators and are not complete exponential observations. Simply plotting all residuals as uncensored therefore gives only a rough visual check. A more appropriate Cox–Snell residual survival diagnostic fits a Kaplan–Meier estimator or Nelson–Aalen estimator to , retains the censoring flags, and checks whether the estimated cumulative hazard is close to , equivalently whether estimated survival is close to . Taken together, the supplied checks are broadly compatible with the fitted model, while none resolves potentially informative censoring from giving up.
The transformed event time is unit exponential, and the transformed censoring time remains a censoring time because is increasing. Under independent censoring and a correctly fitted model, the Kaplan–Meier estimator of the survivor function for the Cox–Snell residuals should approximate .
Thus a logarithmic survivor plot should follow a straight line through the origin with slope minus one:
The empirical plot is a step function around that line. Systematic curvature suggests model misspecification; the late part is less stable when the risk set is small. The retained event indicators must be used rather than treating censored residuals as complete event times.
Schoenfeld residual 2026-10-06
At an untied event time, a Schoenfeld residual is the event subject's covariate vector minus its fitted risk-weighted average over the risk set. Under a correctly specified Cox proportional-hazards model, these residuals have no systematic mean trend with event time. They are defined at event times, unlike Cox–Snell residuals which can be evaluated at both events and censoring times.