A martingale residual is defined as the difference between the observed number of events for a subject and the expected number of events predicted by the fitted Cox model over their follow-up period. Ranging from negative infinity to one, these residuals represent the discrepancy between the observed event indicator and the model's estimated cumulative hazard, providing a direct measure of how well the model captures an individual's survival experience.
Glossary
Martingale Residuals

What is Martingale Residuals?
Martingale residuals are diagnostic statistics used to assess the functional form of continuous covariates in a Cox proportional hazards model by identifying non-linearity and detecting outliers in survival data.
Plotting martingale residuals against a continuous covariate or against the linear predictor reveals whether the assumed functional form is correct. A systematic, non-random pattern—such as a curve—indicates a non-linear relationship requiring transformation, while residuals far below zero may flag potential outliers or subjects with unexpectedly short survival times relative to their covariate profile.
Frequently Asked Questions
Explore the diagnostic mechanics of martingale residuals, the essential tool for assessing the functional form of continuous covariates in Cox proportional hazards models and detecting non-linearity in survival data.
A martingale residual is a diagnostic metric derived from the Cox proportional hazards model that quantifies the discrepancy between the observed number of events and the model-predicted cumulative hazard for each subject over their follow-up period. Formally, it is calculated as the difference between the observed event indicator (δᵢ) and the estimated cumulative hazard (Ĥᵢ(tᵢ)): r̂ₘᵢ = δᵢ - Ĥᵢ(tᵢ). These residuals range from negative infinity to +1, where a value near +1 indicates a subject who experienced an event much earlier than predicted, and a large negative value suggests a subject who survived longer than expected or was censored. Unlike standard linear regression residuals, martingale residuals are inherently asymmetric due to the censoring mechanism, making them uniquely suited for detecting non-linearity in covariate effects and identifying outliers in time-to-event data.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Key concepts for interpreting and validating Martingale residuals in survival analysis.
Functional Form Misspecification
The primary problem Martingale residuals detect. When a continuous covariate has a non-linear relationship with the log-hazard, the Cox model's linearity assumption is violated. Plotting Martingale residuals against the covariate reveals the true functional form, guiding transformations like log or polynomial terms.
Smoothing Splines
A non-parametric technique applied to Martingale residual plots to visualize the underlying functional form of a covariate. A loess smoother or penalized spline overlaid on the residual scatterplot reveals the shape of the relationship, indicating whether a transformation is needed.
Censoring Mechanisms
The statistical processes governing incomplete event times. Martingale residuals are defined as the difference between the observed event indicator and the model's predicted cumulative hazard. Their interpretation depends on the assumption of non-informative censoring, where censoring is independent of the event process.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us