Why Transform Martingale Residuals?
A martingale residual for a subject’s event history is the observed event indicator minus the fitted cumulative hazard at that subject’s observed follow-up time. It is useful because its sign distinguishes observed event experience from fitted event experience. But the residual is bounded above by 1, while its negative values can extend far below zero. This asymmetry makes a large negative residual harder to compare directly with a positive one.
A deviance residual applies a signed square-root transformation to the martingale residual. The transformation is intended to make unusually poorly fitted event histories easier to see and compare on a common diagnostic scale. It does not turn the residual into a normal score, a hypothesis test, or a measure of causal effect.
Definition and Conditions
For subject \(i\), let \(T_i\) be the observed follow-up time and let \(\delta_i\) equal 1 if the event was observed by \(T_i\), and 0 if the subject was right-censored at \(T_i\). Let \(\hat h_i(t)\) be the fitted subject-level event hazard, and define the fitted cumulative hazard by integrating it through follow-up:
In a joint model, \(\hat h_i(t)\) may depend on baseline covariates and on the fitted longitudinal trajectory or subject-specific random effects. The calculation must use a clearly specified subject-level fit consistently across subjects—for example, a plug-in fit using the same rule for estimating the latent subject-specific quantities.
The formula requires \(\hat H_i(T_i)\geq 0\), as a cumulative hazard must be. For the usual single-event right-censored setting, \(\delta_i\) is either 0 or 1. The survival-model interpretation also relies on a suitable fitted hazard model and on censoring being non-informative conditional on the variables and latent quantities included in the model. If censoring depends on unaccounted-for event risk, residual patterns can reflect that problem rather than only hazard-model fit.
What the Transformation Does
Since \(M_i=\delta_i-\hat H_i(T_i)\), the quantity \(\delta_i-M_i\) in the logarithm is exactly \(\hat H_i(T_i)\). Substitution gives a form that is convenient for calculation:
When \(\delta_i=0\), the logarithmic term is taken as zero, so \(D_i=-\sqrt{2\hat H_i(T_i)}\). A censored subject’s residual is therefore negative under this definition. When \(\delta_i=1\), the result is \(D_i=\operatorname{sign}\{1-\hat H_i(T_i)\}\sqrt{2\{\hat H_i(T_i)-1-\log\hat H_i(T_i)\}}\). An observed event with fitted cumulative hazard below 1 has a positive residual; an event with fitted cumulative hazard above 1 has a negative residual.
Justification and Key Properties
The expression inside the square root is nonnegative. For an observed event, put \(x=\hat H_i(T_i)>0\). The unsigned quantity is \(2(x-1-\log x)\). The function \(g(x)=x-1-\log x\) has derivative \(g'(x)=1-1/x\), which is negative for \(0<x<1\), zero at \(x=1\), and positive for \(x>1\). Thus \(g\) has its minimum \(g(1)=0\), so \(g(x)\geq 0\). For a censored subject, the unsigned quantity is \(2\hat H_i(T_i)\geq 0\).
The same expression can be written in terms of \(M_i\). It has the form of a signed square root of a Poisson-style deviance, with the fitted cumulative hazard playing the role of an expected count and \(\delta_i\) the observed event indicator. This motivates the transformation; it does not mean that a censored survival record is literally an independent Poisson observation or that the resulting residuals have an exact standard normal distribution.
The sign preserves whether the observed event indicator is above or below the fitted cumulative hazard. The square root changes the scale nonlinearly, so residual magnitudes are often easier to compare than raw martingale residual magnitudes. The transformation does not remove dependence among residuals created by estimating shared model parameters or by shared latent structure.
Worked Example: An Event With a Low Fitted Cumulative Hazard
Suppose a hypothetical subject experiences the event, so \(\delta_i=1\), and has fitted cumulative hazard \(\hat H_i(T_i)=0.40\). The martingale residual is
Because \(M_i>0\), the deviance residual is positive. Substituting into the event formula gives
The positive sign indicates an observed event despite a fitted cumulative hazard below 1. The value 0.7953 is a diagnostic residual, not a probability or a standardized score.
Worked Example: An Event With a High Fitted Cumulative Hazard
For another hypothetical subject, suppose \(\delta_i=1\) and \(\hat H_i(T_i)=2.50\). Then
The negative martingale residual gives a negative sign. Its deviance magnitude is
Thus \(D_i\approx -1.080\). The observed event occurred even though the fitted cumulative hazard was relatively high. This residual can be compared descriptively with other subjects’ residuals, but it does not by itself establish that the model is misspecified.
Worked Example: A Censored Subject and a Small Data Set
Consider three hypothetical subjects with the following fitted cumulative hazards and observed outcomes.
| Subject | \(\delta_i\) | \(\hat H_i(T_i)\) | \(M_i\) | \(D_i\) |
|---|---|---|---|---|
| A | 0 | 0.70 | -0.70 | -1.183 |
| B | 1 | 0.40 | 0.60 | 0.7953 |
| C | 1 | 2.50 | -1.50 | -1.080 |
Subject A is censored. Its deviance residual is
Subjects B and C are events, and their calculations were shown above. The absolute deviance residual is largest for A, followed closely by C. This ranking flags A and C for review in this small example; it does not prove either subject was recorded incorrectly or that the fitted model fails overall. Follow-up time and censoring status matter when interpreting such comparisons.
Using Residuals as Diagnostics
A deviance residual is most useful as a subject-level screening display: examine its distribution and inspect subjects with relatively large absolute values against their event status, follow-up time, covariates, and fitted trajectory. A pattern across subjects can be more informative than a single extreme value. For example, residuals that vary systematically with a covariate or with follow-up may indicate a feature of the fitted event model that warrants further checking.
Record the event indicator and the subject-level fitted cumulative hazard at the observed time, using the same conditional or plug-in convention for every subject.
Compute \(M_i=\delta_i-\hat H_i(T_i)\), then apply the deviance formula. Check that \(\hat H_i(T_i)\) is nonnegative and that the value under the square root is nonnegative.
Compare unusually large absolute residuals with the subjects’ observed event histories and model inputs. Look for repeated structure rather than treating one residual as a formal test.
The earlier material on martingale residuals for the event component covers the raw residual’s observed-minus-fitted construction. The deviance residual is an alternative display of that information: it changes the scale but does not add new event-history data. A raw martingale residual is direct to interpret in its original units of event indicator minus cumulative hazard; the deviance residual is often more convenient for comparing unusual values. Neither should be treated as an independent standard normal sample.
Common Mistakes and Limitations
- Calling the residual a z-score. A deviance residual is not generally standard normal, so a rule such as “absolute value above 2 means a significant outlier” is not justified without a separately justified reference procedure.
- Dropping the sign. The square-root magnitude alone loses whether the observed event indicator was above or below the fitted cumulative hazard. Retain the sign in the definition.
- Using the wrong cumulative hazard. Substituting a baseline cumulative hazard, or a marginal quantity, when the intended fit is subject-specific changes the residual. State which fitted hazard is being evaluated.
- Ignoring censoring. A censored subject has \(\delta_i=0\), not an observed event. Its residual is \(-\sqrt{2\hat H_i(T_i)}\); it must not be calculated with the event formula.
- Over-interpreting an extreme value. A large residual can prompt data review and model checks, but it is not by itself evidence of a recording error, a particular cause, or a failed model.
The plug-in calculation also treats estimated latent quantities as fixed when forming the residual. In a joint model, uncertainty in the longitudinal trajectory, random effects, baseline hazard, and other estimated parameters can affect residual comparisons. Deviance residuals provide a compact diagnostic view, not a complete account of that uncertainty. Their interpretation can also be misleading if the event model is poorly specified or the censoring assumptions fail.
Check Your Understanding
Try each question before reading the solutions.
- A hypothetical subject has \(\delta_i=0\) and \(\hat H_i(T_i)=1.20\). What are \(M_i\) and \(D_i\)?
- For an observed event, why is the deviance residual zero when the fitted cumulative hazard is 1?
- A subject has an event and fitted cumulative hazard 0.25. Is its deviance residual positive or negative? Give the formula needed to calculate it.
- Why is it incorrect to interpret a deviance residual of 2 as a two-standard-deviation residual automatically?
- What must be kept consistent when calculating subject-level residuals from a joint model?
Solutions. (1) \(M_i=0-1.20=-1.20\), and \(D_i=-\sqrt{2(1.20)}=-\sqrt{2.40}\approx-1.549\). (2) For an event, \(D_i\) has magnitude \(\sqrt{2\{H-1-\log H\}}\); at \(H=1\), this is \(\sqrt{2(1-1-\log 1)}=0\). (3) It is positive because \(M_i=1-0.25=0.75>0\); calculate \(+\sqrt{2\{0.25-1-\log(0.25)\}}\). (4) Deviance residuals are not generally standard normal, so their values do not automatically have standard-deviation units or a normal tail interpretation. (5) Use the same subject-level hazard convention and rule for fitted latent quantities across subjects, and evaluate each cumulative hazard at that subject’s observed follow-up time.