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.
Cox–Snell residual survival diagnostic 2026-10-06
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.
Past exam of the mathematics course of the University of Cambridge 2001 iii Paper 29 1 c i Solution Created 2026-10-03 Updated 2026-10-14
If both groups share the same survival function and the common fit is adequate, their complete Cox–Snell residuals have the same unit exponential distribution. Under independent censoring in each group, both groupwise Kaplan–Meier estimators should therefore be close to and to each other, subject to ordinary sampling variation and the number of subjects still at risk. Different censoring patterns can change precision without changing the residual survival target.
Past exam of the mathematics course of the University of Cambridge 2001 iii Paper 29 1 c Solution 2026-10-14
The transformed values are Cox–Snell residuals. Under a correct common survival function and a good fitted cumulative hazard function, the complete transformed failure times should have unit exponential distribution. Transform the observed times and retain their original censoring indicators, then estimate residual survival with a Kaplan–Meier estimator. Its target isso a plot of its logarithm against should lie approximately on a line of slope . Censored residuals must not be treated as fully observed failure times.
There is a useful caution for this particular common nonparametric fit. The shared-fit Cox–Snell residuals reproduce the fitted survival curve property means that the pooled residual plot is largely built into the transformation. With event ordering and compatible tie processing preserved, at a transformed failure time its residual Kaplan–Meier estimator equals . Finite steps, coalesced censoring times and estimation uncertainty still matter, and an infinite final residual arises if the fitted survivor becomes zero. Separate group plots are more informative about a common-distribution assumption than this pooled fit alone.
Past exam of the mathematics course of the University of Cambridge 2008 iii Paper 41 5 b ii Solution 2026-10-14
Converting size to a regression factor allows two unrestricted contrasts rather than imposing a linear trend on numerical size codes. The command relevel with a numeric second argument selects the second existing factor level as its reference level. For sorted codes this is medium, coded . However, the displayed coefficient labels size1 and size3 instead correspond to codes with code as reference. The printed coding and coefficient labels are inconsistent. The actual factor levels and labels must be checked. Under the intended medium-size reference, the two reported contrasts compare small and large businesses with medium ones; with literal coding their printed names would be size0 and size2.
Using B's delayed-entry survival object, the Cox proportional-hazards model isHere is the unspecified baseline hazard for a medium-size village business and is the Cambridge indicator. The fitted hazard ratios are conditional on the other covariates and constant over business age under the proportional hazards assumption. The function fits regression coefficients through partial likelihood; its survival object must actually be B's version, rather than A's earlier object with the same name.
The location coefficient , with standard error , gives and a two-sided Wald test p-value about . Its reported hazard ratio is , with 95% confidence interval . At the same age and size, a Cambridge business therefore has an estimated closure hazard about 55.2% lower than a village business. The reciprocal ratio is . A hazard ratio is not a survival-probability ratio or a proportional increase in lifetime.
The intended small-versus-medium contrast is , with standard error , and p-value . Its hazard ratio is , with 95% confidence interval . The intended large-versus-medium contrast is , with standard error , and p-value ; its hazard ratio is , with interval . Neither size contrast provides convincing evidence of an effect. The wide intervals also show why these results do not establish equality of size-specific hazards.
The sample has businesses. The likelihood-ratio test, Wald test and score test jointly test all three coefficients being zero; their statistics are , and on three degrees of freedom, with p-values , and . None rejects at 5%. This is compatible with the significant one-coefficient location test: testing a specified one-dimensional contrast and testing three coefficients together are different questions. The location result offers some adjusted evidence, but the joint output does not demonstrate a strong overall improvement, and interpretation should acknowledge the uncertainty and the number of comparisons.
The reported is a Cox–Snell likelihood pseudo-R-squared, here . It measures likelihood improvement rather than a literal fraction of variance in lifetimes explained. Its attainable maximum is reported as . It does not validate the proportional hazards assumption or establish useful predictive performance. Adjusted survival predictions would require estimating the baseline survival function as well: . The coefficient summary alone does not supply adjusted five- or ten-year survival probabilities.
Before reporting results, check the size coding discrepancy, the precise sampling dates and the survival records. The stated January 2000–December 2005 span is six calendar years, despite being called five years. Check nonnegative ages, entry no later than exit, correctly recorded closure indicators and the same opening-based clock throughout. Establish whether inclusion and censoring are plausibly independent of lifetime given the covariates, and whether different opening cohorts or calendar environments can reasonably share the fitted lifetime model. Simply including delayed entry does not cure informative selection, omitted confounders or dependence between businesses.
Assess proportional hazards using Schoenfeld residuals against time and a proportional hazards assumption test, supplemented by groupwise log-minus-log survival plots. Investigate influential observations with coefficient-deletion diagnostics and deviance residuals, and inspect overall fit using Cox–Snell residuals. Consider a city-by-size interaction or time-varying effects if supported by the available events, rather than relying on the displayed three main effects. Finally, report the uncertainty and declining late risk sets—only six remain at the final listed event—and distinguish a conditional association from a causal explanation or a prediction for all future businesses.
Past exam of the mathematics course of the University of Cambridge 2013 iii Paper 32 7 Solution 2026-10-07
Begin by defining the scientific target: prediction for a new patient, or estimation of adjusted covariate effects. Check event definitions, follow-up origins, right-censoring codes and any delayed entry. The analysis assumes independent patients and censoring that is noninformative conditional on modeled covariates. For fixed explanatory variables , the Cox proportional-hazards model iswith an unrestricted baseline hazard and coefficients constant over time. Report as the conditional hazard ratio for a one-unit change in the coded variable, not as a risk ratio or automatically a causal effect.
For untied event times, fit the coefficients by maximizing the Cox partial likelihoodThe baseline cancels within each event risk set. Use an appropriate tied-event method, such as an Efron approximation or an exact method for a genuinely discrete event scale; the Breslow approximation for tied event times is another explicit approximation. Numerical score/information methods fit the model, and inverse information gives conventional covariance estimates for independent subjects. Report coefficient estimates, hazard ratios, uncertainty and the coding that makes their interpretation meaningful. After fitting, the Breslow estimator gives , from which provides predicted survival.
Adequacy is broader than significance of coefficients. Inspect influential observations, deviance residuals and data errors. Cox–Snell residuals should have approximately unit-exponential survival under a well-fitting model, retaining the original censoring indicators; a cumulative-hazard plot of these residuals should be near the 45-degree line. This is an overall diagnostic, not a substitute for the functional-form and proportionality checks below. For prediction, assess held-out discrimination and survival prediction calibration at prespecified time horizons with methods accounting for censoring. A high concordance index alone does not establish good calibration or correct hazard structure.
Use bootstrap or held-out cross-validation that repeats the complete modeling procedure, including imputation, variable selection and tuning. Validation of only the final fitted coefficients understates overfitting from earlier decisions. Report any substantive lack of fit rather than presenting a single time-independent hazard ratio when the data do not support that representation.
Past exam of the mathematics course of the University of Cambridge 2014 iii Paper 32 5 Solution Created 2026-10-03 Updated 2026-10-06
For a proper continuous event time, the survival function is . The assumed invertibility of the cumulative hazard function gives, for ,ThereforeThis 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 residualFor 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, andConsequentlyWhen 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.
Past exam of the mathematics course of the University of Cambridge 2015 iii Paper 33 5 b iii Solution Created 2026-10-03 Updated 2026-10-06
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.
Past exam of the mathematics course of the University of Cambridge 2016 iii Paper 207 5 a Solution Created 2026-10-03 Updated 2026-10-06
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.