Course contentsShow
← Data Science
Lesson 834 of 2,14521. Survival AnalysisFree lesson

Model Diagnostics and Residuals

Use Cox-Snell, martingale, and deviance residuals to check model fit and identify influential observations.

Model Diagnostics and Residuals

What You'll Learn

You'll learn how to use specialized residuals—Cox-Snell, martingale, and deviance—to check whether your Cox proportional hazards model fits well and to spot observations that overly influence your results.

Why Residuals Matter in Survival Analysis

Just like checking residuals in linear regression, survival models need quality checks too. But since we're dealing with censored data and hazard functions (not simple Y vs Ŷ), we need specialized residuals designed for this context.

Three Key Residual Types

Cox-Snell Residuals

Think of these as overall fit diagnostics. If your Cox model fits well, Cox-Snell residuals should follow an exponential distribution with rate 1. You can plot them as a survival curve—if it follows a 45-degree line from (0,0), your model fits the data properly.

Martingale Residuals

These measure prediction error for each observation. Values range roughly from -∞ to 1. A residual near zero means good prediction; large negative values suggest the model overpredicts that individual's risk. Plot them against covariates to detect non-linear relationships you might have missed.

Deviance Residuals

These are normalized versions of martingale residuals, making them easier to interpret (more symmetric around zero). Use them to identify influential observations—extreme deviance residuals point to subjects who don't fit the model pattern and may be pulling your coefficients in unexpected directions.

The Workflow

After fitting your Cox model, examine all three residual types: Cox-Snell for overall fit, martingale for functional form issues, and deviance for outliers. This trinity helps you decide whether to refine covariates, transform variables, or investigate unusual cases.

Key Takeaway: Cox-Snell residuals assess overall model fit, martingale residuals reveal functional form problems, and deviance residuals identify influential observations—together they form a complete diagnostic toolkit for Cox models.