For an observed transformed time and event indicator , the correction has mean one under independent censoring. Its complement is the corresponding martingale residual.
For the population identity, write , , and . Assume independent censoring, with . Then
while the Tonelli theorem and the cumulative hazard function give
This is mean accumulated hazard under independent censoring, proving . For the fitted martingale residual ,
Hence its expectation is approximately zero when the fitted hazard error at the observed time is small in mean. This spells out the required sense of a good estimate; pointwise consistency alone does not control a divergent tail. In particular, a Kaplan–Meier estimator with zero final survival gives infinite transformed times there and cannot supply finite residuals without a tail restriction. Neither exact finite-sample zero mean nor validity under informative censoring is being assumed.
To check an omitted explanatory variable , plot the martingale residuals against or compare groupwise mean residuals, using a smooth trend or appropriate uncertainty intervals. Under a correct conditional survival model and conditionally independent censoring, should be approximately zero. A systematic positive trend indicates more observed failures than the fitted accumulated hazard predicts; a negative trend indicates fewer. Such patterns suggest adding , a nonlinear term or an interaction and reassessing the fit. The bounded-above, often long negative tail of martingale residuals means that the diagnostic is a mean-pattern check, not a requirement for symmetric Gaussian residuals.
Use the right-continuous Breslow estimator, so the increase from the value at to the value at means the interval . There is no event between these consecutive exit times, and at the risk set contains only subject . Hence
and the fitted individual cumulative hazard increases by
It is the subject's integrated hazard, rather than the reference baseline increment, that equals the event indicator.
For the final unheaded request, a fitted martingale residual at a subject's exit is
The revised observation leaves the last subject at risk until a later event time, still after every other subject has exited. Every earlier risk set is exactly the same as before, and the new final event again contributes the constant factor one. Thus part a gives unchanged coefficients, and every earlier Breslow estimator increment is unchanged. No additional events occur during the extended interval because all other subjects have already left observation.
For , the event indicator and fitted cumulative hazard at remain unchanged, hence so does . For the terminal subject, let denote its old fitted integrated hazard at its censored exit. That old residual is . Part b shows that the new final event adds one to its fitted integrated hazard, giving new residual
Therefore all fitted martingale residuals remain unchanged. Their invariance does not assert that the fitted survivor function at later times or the terminal event record is unchanged: the new late baseline hazard jump is real. This is the terminal-observation invariance of Cox martingale residuals, which relies on a unique final subject and unchanged covariate history.
The model is linear in each coded covariate on the log-hazard scale, not necessarily in the raw scientific variable. For a continuous variable , begin with plots and a scientifically plausible range of forms. Compare with a prespecified transformation such as when , or use a restricted cubic spline or fractional polynomial to represent a flexible smooth effect. Do not treat arbitrary integer category codes as a linear quantitative measurement without justification.
Plot martingale residuals from a suitable model against with a smooth trend. A residual pattern can suggest a missing or misspecified effect; these residuals are asymmetric, so the smooth relationship is more informative than judging normality. A model omitting helps reveal its overall shape; plots after including it help assess remaining misspecification. Partial-residual displays or fitted effect curves with uncertainty give complementary information.
Assess nonlinearity with a joint likelihood-ratio or score test for the nonlinear terms in a spline extension. The models containing only and only are generally nonnested, so a difference in their log-likelihoods is not automatically chi-squared. They can be compared by a justified nonnested criterion or validation, or embedded in a model containing both and and tested by dropping one term. Such an encompassing model may be highly collinear, and its coefficients should not be interpreted in isolation. If can be zero or negative, is undefined; choose an appropriate form rather than silently adding an arbitrary offset. Transformation choice is a question about the entire effect curve and its supported range, not only one coefficient's significance. Recheck time constancy after revising the functional form, since misspecification can mimic nonproportionality.
Put and , so and . Its expectation is not generally one and depends on censoring. Under independent censoring, condition on : the exponential distribution gives
Writing for the observed event indicator, it follows that . The exponential mean imputation under independent censoring therefore gives a modified Cox–Snell residual with known mean:
On censoring, the added one is the expected remaining transformed lifetime, by memorylessness of the exponential distribution. This gives a mean-one variable, not necessarily another exponential variable. Equivalently, is a martingale residual with mean zero. Independent censoring, or its appropriate conditional version, is essential for these identities; arbitrary informative censoring does not justify the correction.
Fit a model using the relevant covariates, calculate , and plot these martingale residuals against a candidate explanatory variable or against an included variable's value. A smooth systematic trend away from zero can indicate an omitted effect or an unsuitable functional form, such as a nonlinear age effect. After fitting an appropriate effect, the residual trend should diminish. The equivalent plot of has mean-one reference rather than zero.
Fit the Cox proportional-hazards model with the other explanatory variables, initially omitting the variable whose form is being assessed, and plot the resulting martingale residuals against . Add a smooth trend, for example using a cubic spline or a local smoother. A systematic pattern indicates that affects the hazard function; the shape helps suggest a linear term, a transformation, or a nonlinear spline term in the log hazard.
Refit with the proposed form and inspect martingale residuals against again. Under an adequate functional form, their conditional mean should have no systematic trend, allowing for model fitting and the other covariates. Compare plausible alternative forms using the partial likelihood and suitable model checks.
Use the smoothed pattern to assess the covariate's functional form, rather than treating these residuals as normal regression errors. Martingale residuals are asymmetric, bounded above by 1, and can be arbitrarily negative; the raw residual plot can therefore be misleading without smoothing. This diagnostic concerns the covariate form, and does not by itself test the proportional hazards assumption.
In the martingale residual
is the observed event count up to the end of the individual's follow-up: 1 for a recorded event and 0 for right censoring. The second term is the fitted counting-process compensator, obtained by integrating that individual's fitted hazard function while they remain at risk:
Thus the residual is observed events minus the fitted cumulative event intensity over follow-up. The fitted intensity is not an event probability and can exceed 1. Positive values indicate more events than predicted over that observed exposure; negative values indicate fewer. A right-censored individual has a nonpositive residual. With true model parameters and independent censoring, the underlying observed-minus-compensator process is a martingale; fitted terminal residuals are not independent identically distributed errors.
The quantities act as event-count residuals. Requiring their sum to vanish calibrates the fitted total number of events to the observed total, just as an intercept score equation calibrates fitted means. This is the aggregate zero-residual property of a martingale residual.
A martingale residual is observed minus model-expected event count:
where is the fitted individual cumulative hazard. Under an adequate model it estimates the terminal value of a counting-process martingale.
Fit a model omitting the continuous explanatory variable , plot against , and add a flexible smooth curve. A curve fluctuating around zero without structure supports omission. A monotone or curved trend indicates that event incidence still depends on , suggesting inclusion of or a nonlinear transformation of it. The residuals are highly skewed, so the smoothed trend is more informative than an assumption of Gaussian scatter.
In an untied Cox proportional-hazards model with a single subject remaining after all other observed exit times, that subject's event contributes the constant factor one to Cox partial likelihood. Replacing its terminal censoring time by a later event therefore preserves the fitted coefficients and every earlier Breslow estimator increment. At its new event, the subject's fitted cumulative hazard increases by one, cancelling the increase of one in its event indicator. Every martingale residual is unchanged. This property relies on the subject being alone in the terminal risk set and the same covariate history being retained.
Zero sum of Cox martingale residuals Created 2026-10-05 Updated 2026-10-14
When a Cox proportional-hazards model uses the Breslow estimator, the sum of fitted martingale residuals is zero. Each estimated baseline hazard jump redistributes one observed event across its risk set, so summing cumulative fitted intensities equals summing observed event counts. The identity holds for any finite regression coefficient used consistently in both calculations.