Schoenfeld residuals are defined as the difference between the observed covariate value for a subject experiencing an event and a weighted average of covariate values across the risk set at that event time. Formally, for each event time (t_i), the residual for covariate (k) is (r_{ik} = x_{ik} - \sum_{j \in R(t_i)} x_{jk} \hat{p}_j), where (R(t_i)) is the risk set and (\hat{p}_j) is the estimated probability of subject (j) failing. These residuals are defined only at failure times, not for censored observations.
Glossary
Schoenfeld Residuals

What are Schoenfeld Residuals?
Schoenfeld residuals are diagnostic tools used to test the proportional hazards assumption in the Cox model by measuring the difference between an observed covariate value and its expected value at each event time.
The primary application is the Grambsch-Therneau test, which scales Schoenfeld residuals by an estimate of the covariance matrix and regresses them against time. A non-zero slope indicates violation of the proportional hazards assumption—that the hazard ratio between groups remains constant over time. A significant p-value or a systematic pattern in a smoothed residual plot suggests the covariate's effect changes with time, requiring remedies like time-varying coefficients or stratification.
Key Statistical Properties
Schoenfeld residuals are the cornerstone diagnostic for validating the proportional hazards assumption in survival analysis. Each card below unpacks a distinct statistical property essential for rigorous model checking.
Definition and Mathematical Form
A Schoenfeld residual is defined for each covariate at each observed event time. It is the difference between the observed covariate value for the individual who experienced the event and the expected value of that covariate, given the risk set at that time. Formally, for subject i with covariate vector X_i who fails at time t_i, the residual is r_i = X_i - E[X | R(t_i)], where the expectation is a weighted average over all individuals still at risk. These residuals are not defined for censored observations, only for actual event times.
Testing the Proportional Hazards Assumption
The core purpose of Schoenfeld residuals is to test whether a covariate's effect is constant over time. If the proportional hazards assumption holds, the residuals should exhibit no systematic trend when plotted against time. A non-zero slope indicates a time-varying coefficient, violating the assumption. The formal Grambsch-Therneau test computes a correlation coefficient between the scaled residuals and a function of time (typically the Kaplan-Meier survival estimate). A significant p-value (< 0.05) provides strong evidence against the null hypothesis of proportional hazards.
Scaled Schoenfeld Residuals
Raw Schoenfeld residuals are difficult to interpret directly because their variance depends on the covariate distribution. Scaled Schoenfeld residuals multiply the raw residual vector by an estimate of the inverse of the Cox model's information matrix. This scaling produces residuals that are:
- Standardized: Easier to visualize and compare across covariates.
- Additive: The scaled residual for a subject approximates the change in the estimated coefficient if that subject were removed.
- Directly Interpretable: A smoothed plot of scaled residuals plus the original coefficient estimate reveals the functional form of the time-varying effect.
Visual Diagnostics and Smoothing
Visual inspection of Schoenfeld residuals is standard practice. A plot of scaled residuals vs. time with a loess smoother overlaid reveals the nature of any violation:
- Horizontal line: Supports proportional hazards.
- Upward/downward trend: Indicates a covariate effect that increases or decreases over time.
- Non-linear pattern: Suggests a complex time interaction. The cox.zph() function in R's survival package generates these plots automatically, displaying the smoother and a confidence band. Outliers in the plot may also identify influential observations that disproportionately affect the model fit.
Remedies for Violations
When Schoenfeld residuals reveal a violation, several modeling strategies can address the non-proportionality:
- Stratification: Fit separate baseline hazards for levels of the offending categorical covariate, allowing the baseline hazard to differ while assuming proportional hazards for other covariates.
- Time-by-Covariate Interaction: Include an explicit interaction term between the covariate and a function of time, such as log(t) or a step function, in the Cox model.
- Accelerated Failure Time (AFT) Model: Switch to a parametric model that does not assume proportional hazards, such as Weibull or log-normal regression.
- Landmark Analysis: Analyze survival conditional on surviving to a specific time point, effectively allowing effects to vary across time windows.
Relationship to Martingale Residuals
Schoenfeld residuals are mathematically connected to martingale residuals, another key diagnostic in survival analysis. While martingale residuals assess the overall adequacy of the model's functional form for continuous covariates, Schoenfeld residuals specifically target the time-constancy of effects. A key distinction:
- Martingale residuals: Defined for every subject (censored and uncensored), range from -∞ to 1, and detect non-linearity in covariate effects.
- Schoenfeld residuals: Defined only at event times, sum to zero asymptotically, and detect time-varying coefficients. Together, they form a complementary diagnostic suite for Cox model validation.
Frequently Asked Questions
Clarifying the role of Schoenfeld Residuals in validating the proportional hazards assumption for reliable survival analysis.
Schoenfeld Residuals are diagnostic residuals used specifically to test the proportional hazards assumption in a Cox regression model. They work by measuring the difference between the observed covariate value for a subject that experiences an event at a specific time and the expected value of that covariate, given the risk set still at risk just before that event time. Unlike standard regression residuals, they are defined only at event times, not for censored observations. If the proportional hazards assumption holds, these residuals should be independent of time, appearing as a random scatter around zero when plotted against the time axis. A systematic trend, such as a positive slope, indicates that the effect of the covariate—the hazard ratio—is changing over the observation period, violating the model's core premise.
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
Master the full toolkit for validating and interpreting survival models. These concepts directly interact with Schoenfeld residuals to ensure robust proportional hazards analysis.
Grambsch-Therneau Test
The formal statistical hypothesis test that quantifies the visual patterns seen in Schoenfeld residual plots. It computes a correlation coefficient between scaled residuals and a function of time (often the Kaplan-Meier transform or log-time). A significant p-value (< 0.05) provides strong evidence that the proportional hazards assumption has been violated for that specific covariate. The test can be applied globally to the entire model or individually to each predictor, making it the definitive diagnostic companion to Schoenfeld residual visualization.
Martingale Residuals
While Schoenfeld residuals test proportionality, Martingale residuals diagnose the correct functional form of continuous covariates. They are calculated as the difference between the observed event indicator and the model's predicted cumulative hazard. Plotting Martingale residuals against a continuous predictor reveals non-linearity:
- A random scatter around zero suggests a correct linear fit
- A curved pattern indicates the need for a transformation (e.g., log, quadratic) or spline
- Extreme negative values identify potential outliers with unexpectedly long survival times
Deviance Residuals
Symmetrically transformed Martingale residuals designed to identify outliers and influential observations more effectively. Deviance residuals are centered around zero and approximately normally distributed when the model fits well. Observations with absolute deviance residuals exceeding 2 or 3 warrant investigation—they may represent patients whose survival experience is poorly predicted by the model. Unlike Schoenfeld residuals which focus on covariate effects over time, deviance residuals highlight individual subjects that the model systematically fails to characterize.
Cox-Snell Residuals
The foundation for assessing overall model goodness-of-fit. Cox-Snell residuals are defined as the estimated cumulative hazard for each subject at their event or censoring time. If the model is correctly specified, these residuals should follow a unit exponential distribution with a constant hazard of 1. A plot of the Nelson-Aalen estimator of the residuals against the residuals themselves should approximate a 45-degree line through the origin. Systematic departures indicate global model misspecification that Schoenfeld residual analysis alone may miss.

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