Author-reviewedEvidence: highv1.0.1

Schoenfeld Residual

A Schoenfeld residual is the observed minus expected covariate value at each event in a Cox model, used to test the proportional hazards assumption.

Last reviewed byDr Darrin Baines

Concept Architecture

Schoenfeld Residual in Cox Models and Survival Evidence for HTA

Schoenfeld residuals are the usual diagnostic for asking whether a covariate in a Cox proportional hazards model, most often the treatment arm of a trial, has the same effect early and late in follow-up. At every death or other event, the residual compares the covariate value of the patient who had the event with the value the fitted model expected among everyone still at risk, so a drift in the residuals over time points to a hazard ratio that changes. Health economists need this check because many cost-effectiveness models apply one hazard ratio to a baseline survival curve, which is valid only under the proportional hazards assumption, and the NICE manual (PMG36, section 4.6.22) states that this assumption should always be assessed. Schoenfeld introduced the residuals in 1982, and the scaled form from Grambsch and Therneau underlies the proportional hazards tests in R and Stata.

How each residual is built from a risk set

The Cox model estimates its coefficients from risk sets, the patients still under observation and event-free just before each event time. At an event, the fitted model implies an expected covariate value for the patient who fails, a weighted average over the risk set in which each patient counts in proportion to their risk score. The residual is the gap between the observed value and that expectation.

rik=xik−xˉk(ti),xˉk(ti)=∑j∈R(ti)xjkexp⁡(xjTβ^)∑j∈R(ti)exp⁡(xjTβ^)r_{ik} = x_{ik} - \bar{x}_{k}(t_i), \qquad \bar{x}_{k}(t_i) = \frac{\sum_{j \in R(t_i)} x_{jk} \exp(x_j^{\mathsf T}\hat{\beta})}{\sum_{j \in R(t_i)} \exp(x_j^{\mathsf T}\hat{\beta})}

where rikr_{ik} is the residual for covariate kk at the event of patient ii, tit_i is that event time, xikx_{ik} is the patient's value of covariate kk, xˉk(ti)\bar{x}_{k}(t_i) is the risk-score weighted mean of covariate kk at tit_i, R(ti)R(t_i) is the risk set, xjx_j is the covariate vector of patient jj in it, β^\hat{\beta} is the vector of estimated coefficients and exp⁡(xjTβ^)\exp(x_j^{\mathsf T}\hat{\beta}) is patient jj's risk score.

Only patients who fail contribute a residual, the Stata manual notes, though censored patients still sit in the risk sets behind each expectation. The residuals are each event's contribution to the first derivative of the log partial likelihood, which is zero at the fitted coefficients, so for each covariate they sum to zero. With tied event times the expectation depends on the tie method, and the manual gives Peto-Breslow and Efron versions.

Schoenfeld's 1982 paper proposed plotting the residuals against time to test the proportional hazards assumption, and using histograms of them to examine fit and detect outlying covariate values.

Scaled residuals and a changing log hazard ratio

An unscaled residual for a binary treatment lies between minus 1 and 1 and cannot be read as a hazard ratio. Grambsch and Therneau framed non-proportional hazards as a Cox model with a time-varying coefficient, so that for one covariate the hazard is multiplied by exp⁡{β(t)x}\exp\{\beta(t) x\}, and gave a treatment effect that decreases with time as a common example. They showed that β(t)\beta(t) can be seen directly by smoothing a suitable residual plot.

si∗=d V^ ri,E(si∗)+β^≈β(ti)s^{*}_{i} = d\, \widehat{V}\, r_{i}, \qquad \mathrm{E}\left(s^{*}_{i}\right) + \hat{\beta} \approx \beta(t_i)

where rir_i is the vector of Schoenfeld residuals at the ii-th event, si∗s^{*}_{i} is the vector of scaled Schoenfeld residuals, dd is the total number of events, V^\widehat{V} is the estimated variance matrix of β^\hat{\beta}, and β(ti)\beta(t_i) is the coefficient that would apply at time tit_i if the effect were free to vary.

A plot of β^+si∗\hat{\beta} + s^{*}_{i} against time is therefore a rough picture of the log hazard ratio over follow-up. Stata stores the scaled residuals with β^\hat{\beta} already added and describes them as centred at β^\hat{\beta}, with zero slope against functions of time when proportional hazards holds. For a treatment with β^<0\hat{\beta} < 0, an upward trend means the log hazard ratio is moving towards zero, the pattern of a fading benefit.

Tests for a trend against time

A formal test asks whether the scaled residuals drift with time. The Stata manual notes that many popular tests for proportional hazards are in fact tests of non-zero slope in a regression of the scaled residuals on time, equivalent to testing that the log hazard ratio is constant. For one covariate the statistic is

χ2=[∑i=1d{g(ti)−gˉ} si∗]2d Var^(β^)∑i=1d{g(ti)−gˉ}2\chi^{2} = \frac{\left[\sum_{i=1}^{d} \{g(t_i) - \bar{g}\}\, s^{*}_{i}\right]^{2}}{d\, \widehat{\mathrm{Var}}(\hat{\beta}) \sum_{i=1}^{d} \{g(t_i) - \bar{g}\}^{2}}

where g(ti)g(t_i) is the chosen function of the ii-th event time, gˉ\bar{g} is its mean over the dd events, si∗s^{*}_{i} is the scaled residual for the covariate, and Var^(β^)\widehat{\mathrm{Var}}(\hat{\beta}) is the estimated variance of its coefficient. The statistic is compared with a chi-squared distribution on 1 degree of freedom, and a global test across mm covariates has mm degrees of freedom.

The choice of gg is part of the test. Stata's estat phtest uses analysis time by default, with log time, one minus the Kaplan-Meier estimate and ranks as options, while the R function cox.zph defaults to a Kaplan-Meier based transform and, from survival version 3.0, computes the actual score test rather than a fast approximation. The two can report different p-values on the same data, so the transform and software should be stated.

Bradburn and colleagues cite a simulation study in which the scaled Schoenfeld residuals test was among the most powerful checks of proportionality, and advise that a trend calls for a time-dependent Cox model or a model without proportional hazards.

Worked example with a fading treatment effect

All numbers in this example are illustrative. Ten trial patients are followed for overall survival, five on a new treatment (x=1x = 1) and five on the comparator (x=0x = 0). Comparator patients die at months 1, 2, 4 and 6 and one is censored at month 10, while treated patients die at months 3, 7, 8 and 9 and one is censored at month 12.

1. Fit the Cox model. Maximising the partial likelihood gives β^=−0.609\hat{\beta} = -0.609, a hazard ratio of exp⁡(−0.609)=0.544\exp(-0.609) = 0.544. The information, the sum over the eight risk sets of the weighted variance of xx, is 1.913, so Var^(β^)=1/1.913=0.523\widehat{\mathrm{Var}}(\hat{\beta}) = 1/1.913 = 0.523.

2. Expected value and residual at each event. With n0n_0 comparator and n1n_1 treated patients at risk, the expected value of xx is ψ^n1/(ψ^n1+n0)\hat{\psi} n_1 / (\hat{\psi} n_1 + n_0), where ψ^=0.544\hat{\psi} = 0.544 is the fitted hazard ratio. At month 1 the five treated patients contribute 0.544 × 5 = 2.720 and the five comparator patients 5, so the expected value is 2.720 / 7.720 = 0.352 and the residual for the comparator death is minus 0.352.

3. Scale. Since d Var^(β^)=8×0.52285=4.1828d\,\widehat{\mathrm{Var}}(\hat{\beta}) = 8 \times 0.52285 = 4.1828, the plotted value at month 1 is −0.6090+4.1828×(−0.35229)=−2.083-0.6090 + 4.1828 \times (-0.35229) = -2.083.

MonthPatient who diedAt risk (comparator, treated)Expected xxResidualβ^+s∗\hat{\beta} + s^{*}
1Comparator5, 50.352-0.352-2.083
2Comparator4, 50.405-0.405-2.302
3Treated3, 50.4750.5251.585
4Comparator3, 40.420-0.420-2.367
6Comparator2, 40.521-0.521-2.788
7Treated1, 40.6850.3150.708
8Treated1, 30.6200.3800.980
9Treated1, 20.5210.4791.394

4. Check the sum. The negative residuals add to minus 1.698 and the positive ones to 1.699, zero apart from rounding.

5. Look for a trend. The mean of β^+s∗\hat{\beta} + s^{*} over the events in months 1 to 4 is minus 1.292, a hazard ratio of about exp⁡(−1.292)=0.27\exp(-1.292) = 0.27, and over months 6 to 9 it is 0.074, about exp⁡(0.074)=1.08\exp(0.074) = 1.08.

6. Test. With g(t)=tg(t) = t the event months have mean 5, and the squared deviations sum to 60. The weighted sum of residuals is ∑(ti−5) ri=5.159\sum (t_i-5)\, r_i = 5.159, and since si∗=4.182 ris^{*}_i = 4.182\, r_i the statistic is 4.182 × 5.159 × 5.159 / 60 = 1.86, with p=0.17p = 0.17. On log time it is 1.56, with p=0.21p = 0.21.

7. Interpretation. The plot suggests an early benefit that fades over the later months, yet with eight events the test is far from significant. One hazard ratio of 0.54 applied throughout would understate the early benefit and overstate the later one, and with so few events the plot, read with clinical reasoning, says more than the p-value.

Schoenfeld residuals in NICE appraisals

PMG36 does not name Schoenfeld residuals. Section 4.6.22 prefers log-cumulative hazard plots as advised in NICE DSU Technical Support Document 14 (TSD14), inspection of hazard plots or hazard ratios over time, and interpretation of tests reported in the original trial publications, where a residual-based test would sit. TSD14 names tests of Cox-Snell, martingale or Schoenfeld residuals as possibly useful, and notes that with patient-level data the assumption need not be relied on.

In the NICE appraisal of abemaciclib with endocrine therapy for high-risk early breast cancer (TA810), the evidence review group reports that the company checked proportional hazards with a log-cumulative plot, the Grambsch-Therneau test and Schoenfeld residual plots, based on TSD14. Finding no violation for invasive disease-free survival, the company fitted one model with a hazard ratio adjustment, while time to treatment discontinuation was modelled separately for each arm. The base case still set a fixed treatment effect lasting 8 years, followed by waning, an assumption resting on other analyses and the literature rather than on the checks.

Latimer and colleagues re-examined the 12-month data cut of the CheckMate 649 trial of nivolumab plus chemotherapy, the main evidence in NICE TA857. The data cut's Schoenfeld residual and hazard plots and the Grambsch-Therneau test were not definitive, so the authors turned to external evidence that immunotherapies have delayed and durable effects and used independently fitted survival curves. PMG36 section 4.6.23 makes the same distinction, allowing hazard ratios to be pooled only if proportional hazards holds within the trial and is clinically plausible during extrapolation.

Assumptions and choices that change the result

The test uses one pooled variance matrix, which the Stata manual says assumes homogeneity of variance across risk sets, and it recommends checking each stratum separately in a stratified Cox analysis. The R documentation notes that random effects terms, such as a frailty model term, are not checked and are treated as a fixed offset. The residuals exist for any covariate, continuous ones included, whereas Stata's log-log plot needs a nominal or ordinal covariate.

How Schoenfeld residuals differ from other Cox model residuals

Each Cox model residual answers a different question about the fit. The Stata manual lists the traditional uses.

ResidualOne value for eachTraditional use
Cox-Snell residualPatientOverall model fit
Martingale residualPatientFunctional form of covariates
Deviance residualPatientModel accuracy and outlying patients
Schoenfeld residualEvent and covariateChecking and testing proportional hazards
Scaled Schoenfeld residualEvent and covariatePicturing β(t)\beta(t) and the trend tests

A time-varying covariate, whose value changes during follow-up, differs from the time-varying coefficient the test looks for.

Common misreadings

Most errors treat the test as a verdict on the economic model, when it describes only the trial data. Four recur.

  1. Reading a non-significant test as proof. With few events a clear trend can give a large p-value.
  2. Treating a significant test as the end of Cox modelling. Bradburn and colleagues kept a Cox model in their ovarian cancer example, adding interactions with log time for the covariates whose effects drifted.
  3. Carrying the within-trial result into the extrapolated period. PMG36 asks separately for clinical plausibility during extrapolation, and waning assumptions break proportionality by design.
  4. Reading the unscaled residual plot as a hazard ratio curve. Only the scaled residuals plus β^\hat{\beta} estimate the log hazard ratio over time.

Sources

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 (7)

  • What is a schoenfeld residual?

    A Schoenfeld residual is the observed minus expected covariate value at each event in a Cox model, used to test the proportional hazards assumption.

    Source: Schoenfeld 1982

  • What is distinctive about how a Schoenfeld residual is defined?

    Cox-Snell, martingale and deviance residuals each give one value per patient, whereas Schoenfeld residuals give one value for every event and covariate. Only patients who fail contribute a residual, although censored patients still belong to the risk sets used to form each expected value. Each residual is that event's contribution to the first derivative of the log partial likelihood, so for any covariate the residuals sum to zero at the fitted coefficients. With tied event times the expected value depends on the tie method, and the Stata manual gives Peto-Breslow and Efron versions.

    Source: StataCorp 2025

  • What is a Schoenfeld residual?

    Schoenfeld introduced these residuals in 1982 for the Cox proportional hazards model. Each one compares the covariate value of the patient who has an event with the value the fitted model expected among everyone still at risk at that moment, so a positive residual means the patient who failed had a higher value than the model predicted. Schoenfeld proposed plotting the residuals against time to test the proportional hazards assumption. He also suggested histograms of them for examining fit and for detecting outlying covariate values.

    Source: Schoenfeld 1982

  • How are Schoenfeld residuals calculated?

    The calculation starts from a fitted Cox model and its risk sets, the patients still under observation and event-free just before each event time. At each event, every patient at risk is weighted by their risk score, the exponential of their covariate values multiplied by the estimated coefficients. The expected covariate value is the weighted mean over the risk set, and the residual is the observed value for the patient who failed minus that mean. For a binary treatment the expected value equals the fitted hazard ratio times the number treated at risk, divided by that product plus the number of comparator patients at risk.

    Source: StataCorp 2025

  • How are Schoenfeld residuals used to test proportional hazards?

    Grambsch and Therneau scaled each residual by the number of events and the estimated variance of the coefficient, so that the scaled residual plus the fitted coefficient roughly follows the log hazard ratio at that event time. Smoothing a plot of these values against time then gives a picture of how the effect changes over follow-up. The formal test regresses the scaled residuals on a chosen function of time and asks whether the slope differs from zero. A zero slope corresponds to a constant log hazard ratio, which is the proportional hazards assumption.

    Source: Grambsch & Therneau 1994

  • What do Schoenfeld residuals reveal?

    A trend in the scaled residuals against time points to a covariate whose effect changes over follow-up, which one hazard ratio cannot describe. For a treatment with a negative coefficient, an upward drift means the log hazard ratio is moving towards zero, the pattern of a benefit that fades. Bradburn and colleagues cite a simulation in which the scaled residual test was among the most powerful checks of proportionality. When a trend appears they advise a time-dependent Cox model or a model without proportional hazards, while a flat plot in a small trial is weak evidence because few events limit the power of the test.

    Source: Bradburn et al. 2003

  • Why are Schoenfeld residuals important for the Cox model?

    Many cost-effectiveness models apply one hazard ratio from a Cox model to a baseline survival curve, which is valid only if the proportional hazards assumption holds. The NICE manual PMG36 states that this assumption should always be assessed, and among its preferred approaches is interpretation of tests reported in the original trial publications, where a residual-based test would sit. Section 4.6.23 allows hazard ratios to be pooled only if proportional hazards holds within the trial and is clinically plausible during extrapolation. A residual check informs only the within-trial part of that judgement, so plausibility beyond follow-up needs separate clinical reasoning.

    Source: NICE PMG36 (2022, updated 2026)

Trust Record

Verified by Dr Darrin Baines

British health economist

Professional identity: darrinbaines.org

Verification date: 29 Oct 2026

Content version: 1.0.1

Canonical Identity

Term code
HE-EM-SM-077

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