VerifiedEvidence: highv1.0.0

Martingale Residual

A residual used to diagnose the fit of a Cox model, checking the functional form of continuous covariates and identifying influential observations.

Last reviewedDarrin Baines IP Ltd

Concept Architecture

Concept

Theoretically, the Martingale Residual is a residual measure used to assess the goodness of fit of Cox proportional hazards models. It is founded on counting process theory and martingale theory, where the observed counting process is decomposed into a predictable component and a martingale component. Martingale residuals exist to quantify the discrepancy between the observed number of events and the number expected under the fitted survival model.

Mathematically, the martingale residual is defined as the difference between the observed event indicator and the estimated cumulative hazard for each individual. Under a correctly specified Cox model, the residuals have an expected value of zero but are highly skewed, ranging from negative infinity to one. They are primarily used to assess the functional form of continuous covariates rather than to identify outlying observations.

In practice, martingale residuals are calculated after fitting a Cox proportional hazards model using the estimated cumulative baseline hazard and regression coefficients. Plots of residuals against covariates are examined to detect non-linearity, omitted variables or model misspecification. In health economics, they are used during survival model validation before fitted survival models are extrapolated for economic evaluation.


Purpose

Used to assess the adequacy of Cox proportional hazards models, evaluate covariate functional form, identify model misspecification and support validation of survival models used in health economic analyses.


Mathematical Formulae

Primary Formula

M? = �? ? H??(t?) ? exp(x????)

where:

M? = martingale residual for individual i

�? = event indicator (1 = event, 0 = censored)

H??(t?) = estimated cumulative baseline hazard

x? = covariate vector

?? = estimated regression coefficients

Supporting Formulae

???(t) = H??(t) ? exp(x????)

M? = �? ? ???(t)

E(M?) � 0

Related Mathematical Methods

  • Cox Proportional Hazards Model
  • Counting Process Theory
  • Martingale Theory
  • Nelson-Aalen Estimator
  • Schoenfeld Residual
  • Cox-Snell Residual
  • Deviance Residual

Example

A Cox proportional hazards model is fitted to evaluate survival following two cancer treatments. For one patient, an event occurs (� = 1) and the fitted cumulative hazard at the observed event time is 0.72.

M = 1 ? 0.72 = 0.28

For another patient who is censored (� = 0) with an estimated cumulative hazard of 1.15:

M = 0 ? 1.15 = ?1.15

Residual plots against age reveal systematic curvature, suggesting that age should be modelled using a non-linear functional form.


Excel Implementation

FunctionExample FormulaHealth Economics Application
EXP=EXP(SUMPRODUCT(B2:F2,$B$1:$F$1))Calculate the individual hazard multiplier exp(x?).
SUMPRODUCT=SUMPRODUCT(B2:F2,$B$1:$F$1)Compute the linear predictor x?.
IF=IF(A2=1,1-G2,-G2)Calculate martingale residuals from event status and estimated cumulative hazard.
SCATTER CHARTResidual plotAssess covariate functional form and model fit visually.

VBA (Optional)

Automate calculation of martingale residuals and generate diagnostic plots for Cox proportional hazards model validation.


Sources

  • Cox DR. Regression Models and Life-Tables. Journal of the Royal Statistical Society: Series B. 1972.
  • Andersen PK, Borgan ?, Gill RD, Keiding N. Statistical Models Based on Counting Processes.
  • Therneau TM, Grambsch PM. Modeling Survival Data: Extending the Cox Model.
  • Collett D. Modelling Survival Data in Medical Research.
  • Klein JP, Moeschberger ML. Survival Analysis: Techniques for Censored and Truncated Data.
  • Briggs A, Claxton K, Sculpher M. Decision Modelling for Health Economic Evaluation.

Library

Publications

1
  • Guidance

    NICE DSU Technical Support Document 21: Flexible methods for survival analysis — Rutherford, Lambert, Sweeting, Pennington, Crowther, Abrams & Latimer, TSD 21 ed., 2020 (NICE Decision Support Unit (University of Sheffield))

    Guidance extending standard survival analysis to flexible parametric methods — spline-based models, fractional polynomials, mixture and cure models, and relative-survival approaches — for capturing complex hazard functions in economic evaluation.

Frequently Asked Questions (6)

  • What is a martingale residual?

    A residual used to diagnose the fit of a Cox model, checking the functional form of continuous covariates and identifying influential observations.

    Source: Therneau, Grambsch & Fleming 1990

  • Why are martingale residuals skewed?

    A martingale residual is the difference between whether a patient actually had the event and the number of events the Cox model expected for them, so it ranges from a maximum of one down to large negative values. This makes the residuals markedly skewed rather than symmetric, since a patient can have at most one event but an expected count that grows large over long follow-up. The skew limits their use for some checks, which is why the more symmetric deviance residual is often derived from them. Their sum over all patients is zero. Collett (2015) describes them.

    Source: Collett 2015

  • How are martingale residuals used?

    Martingale residuals are used to check whether continuous covariates enter the Cox model in the correct functional form, by plotting the residuals from a model omitting a covariate against that covariate: the shape of the smoothed plot suggests the appropriate functional form, such as linear or non-linear. They are also used to identify individuals with unusually large residuals, indicating poor fit or influence. These diagnostics help ensure the model represents covariate effects appropriately.

    Source: Therneau, Grambsch & Fleming 1990

  • What do martingale residuals reveal about functional form?

    Martingale residuals reveal how a continuous covariate should enter the model, since a smoothed plot of the residuals against the covariate approximates the functional form of its effect on the log hazard. A roughly straight line supports a linear term, while curvature indicates a non-linear relationship needing transformation or a flexible term. This makes martingale residuals valuable for detecting when a covariate's effect is not linear, guiding the correct specification of the covariate in the Cox model.

    Source: Therneau, Grambsch & Fleming 1990

  • What are the properties of martingale residuals?

    Martingale residuals have a mean of zero and sum to zero over the sample, but they are asymmetric, ranging from minus infinity to one, since an individual can have at most one event but the expected number can be large. This skewness makes them less suited to identifying outliers directly, for which the more symmetric deviance residuals, a transformation of them, are preferred. Martingale residuals are particularly useful for assessing functional form, while deviance residuals are used for spotting poorly fitted observations.

    Source: Collett 2015

  • How do martingale residuals relate to deviance residuals?

    Martingale residuals relate to deviance residuals in that deviance residuals are a transformation of martingale residuals designed to be more symmetric and easier to interpret. Martingale residuals are skewed, useful for assessing the functional form of covariates, while deviance residuals, being roughly symmetric, are better for identifying individual observations that are outliers or poorly fitted. So the two are linked diagnostics from the same framework, each suited to a different aspect of checking a survival model's fit.

    Source: Cox & Snell 1968

Trust Record

Verified by Dr Darrin Baines

British health economist

Professional identity: darrinbaines.org

Verification date: 22 Oct 2025

Content version: 1.0.0

Canonical Identity

Term code
HE-EM-SM-050

Stable URI · Machine-readable · Resolvable · CC BY 4.0