Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Checking Proportional Hazards With Schoenfeld Residuals

Survival Models Review · Tutorial 108 of 697

Checking Proportional Hazards With Schoenfeld Residuals

Learn to examine scaled Schoenfeld residual trends and formal tests to assess whether individual Cox model effects appear proportional over time.

Intermediate 13 min read

What You'll Learn

  • Define raw Schoenfeld residuals at observed event times and explain their connection to risk-set averages.
  • Distinguish exact centering under the true coefficient from the approximate diagnostic behavior of fitted residuals.
  • Use scaled residual plots and time transformations to assess covariate-specific proportionality.
  • Interpret a formal residual-trend test, its null hypothesis, and its p-value in context.
  • Recognize how ties, sparse risk sets, influential observations, and transformation choices can affect conclusions.
  • Compare residual diagnostics with alternative checks and distinguish evidence against proportional hazards from proof of the assumption.

Why Examine Schoenfeld Residuals?

A Cox proportional hazards model represents a covariate’s effect as constant over time: for a one-unit increase in a covariate, the hazard ratio is the same at each event time, conditional on the other modeled covariates. That constancy is an assumption, not something guaranteed by fitting the model. A coefficient that changes with time can be obscured by a single estimated coefficient, so a useful diagnostic asks whether the event-time residuals show a systematic time pattern.

Schoenfeld residuals are calculated at event times from the difference between the covariate value for the subject who experienced the event and its risk-set expected value. Scaled versions put the residual trend on a coefficient-like scale, which helps make changes over time interpretable. A visible trend or a small formal-test p-value is evidence that the proportional-hazards assumption may be inadequate for that covariate; neither is definitive proof.

Raw and Scaled Schoenfeld Residuals

For clarity, first consider distinct event times and a Cox model with covariate vector \(\mathbf{x}_i\) and coefficient vector \(\boldsymbol{\beta}\). At event time \(t_j\), let \(R(t_j)\) be the risk set: subjects still under observation and event-free immediately before that time. With no tied events, the raw Schoenfeld residual is the event subject’s covariate vector minus the weighted mean of covariates in that risk set.

$$ \mathbf{r}_j = \mathbf{x}_{(j)} - \frac{\sum_{i\in R(t_j)} \mathbf{x}_i \exp(\hat{\boldsymbol{\beta}}^{\mathsf T}\mathbf{x}_i)} {\sum_{i\in R(t_j)} \exp(\hat{\boldsymbol{\beta}}^{\mathsf T}\mathbf{x}_i)} $$

Here \(\mathbf{x}_{(j)}\) is the covariate vector for the subject who has the event, and \(\hat{\boldsymbol{\beta}}\) is the fitted Cox coefficient vector. Thus, a residual’s components are covariate differences, not event-time differences. The residual is defined only at an event, so censored subjects contribute to risk-set averages while they remain at risk, but do not have their own event-time Schoenfeld residual.

Definition: A scaled Schoenfeld residual is a transformed Schoenfeld residual calibrated for assessing a coefficient’s change over event time. Its scaling uses estimated model information, and software conventions can differ. In a scaled-residual plot, the estimated coefficient trend should be approximately flat under proportional hazards; the scaling does not make each residual an independent observation or eliminate sampling variability.

For tied event times, software computes residuals using its specified tie method, such as the method used to fit the Cox model. The diagnostic should be based on residuals consistent with that fitting method. Do not apply the distinct-event formula as though one tied event had a uniquely identified event subject.

Worked Example: Calculating a Raw Residual

Suppose a hypothetical binary covariate \(x\) indicates treatment, with \(x=1\) for treated and \(x=0\) for untreated. At one distinct event time, the risk set contains one untreated subject and two treated subjects. The event subject is treated. Let the fitted coefficient be \(\hat{\beta}=\log(2)=0.6931\).

The event subject’s covariate value is \(x_{(j)}=1\). The fitted risk weights are \(1\) for the untreated subject and \(\exp(0.6931)=2\) for each treated subject. Therefore the weighted risk-set mean is

$$ \bar{x}_{R,j} = \frac{0(1)+1(2)+1(2)}{1+2+2} = \frac{4}{5} = 0.8000. $$

The raw Schoenfeld residual is \(r_j=1-0.8000=0.2000\). It is positive because the event subject’s treatment value is higher than the weighted risk-set mean. This one residual alone does not establish a time trend; the diagnostic concerns the pattern across event times.

Why a Trend Is Relevant

The centering idea follows from the conditional event probability in a Cox model. At an event time, conditional on one event occurring in the risk set, the probability that subject \(i\) experiences it is proportional to \(\exp(\boldsymbol{\beta}^{\mathsf T}\mathbf{x}_i)\), using the true coefficient \(\boldsymbol{\beta}\). Define the corresponding true-coefficient risk-set mean as \(\boldsymbol{\mu}_j(\boldsymbol{\beta})\).

$$ \boldsymbol{\mu}_j(\boldsymbol{\beta}) = \frac{\sum_{i\in R(t_j)}\mathbf{x}_i \exp(\boldsymbol{\beta}^{\mathsf T}\mathbf{x}_i)} {\sum_{i\in R(t_j)} \exp(\boldsymbol{\beta}^{\mathsf T}\mathbf{x}_i)} \qquad E\!\left[ \mathbf{x}_{(j)}-\boldsymbol{\mu}_j(\boldsymbol{\beta}) \mid R(t_j),\text{ one event at }t_j \right] = \mathbf{0}. $$

The equality follows by summing each possible event subject’s covariate vector times its conditional event probability; that sum is exactly \(\boldsymbol{\mu}_j(\boldsymbol{\beta})\). This is an exact centering statement when the weights use the true coefficient. A fitted raw residual instead uses \(\hat{\boldsymbol{\beta}}\). Its conditional expectation is generally \(\boldsymbol{\mu}_j(\boldsymbol{\beta})-\boldsymbol{\mu}_j(\hat{\boldsymbol{\beta}})\), not exactly zero. Under a correctly specified proportional-hazards model and with adequate information, fitted residuals are used as an approximate diagnostic for systematic departures over time, not as proof of an exact zero expectation at every event time.

If a coefficient varies over time, one way to describe the departure is \(\beta(t)=\beta+\theta g(t)\), where \(g(t)\) is a chosen function of time. Proportional hazards for that covariate corresponds to no time variation, or \(\theta=0\) for this specified trend. Scaled Schoenfeld residuals plotted against \(g(t)\) should then show no systematic slope under the null. The choice of \(g(t)\) matters: a test for a linear trend in log time may miss a different, nonmonotone pattern.

1
Fit the Cox model.
Specify the covariates and tie handling, and check that the fitted model is suitable for the diagnostic question.
2
Inspect scaled residuals over time.
Plot the covariate-specific scaled residuals at event times against a stated time scale or transformation, often with a smooth trend and uncertainty bands.
3
Read the trend and formal test together.
Assess direction, shape, uncertainty, and the test for a time trend; examine individual covariates and any reported global test.

Formal Tests and Their Interpretation

A formal proportional-hazards diagnostic tests whether the residual trend is consistent with a constant coefficient. A common approach relates scaled Schoenfeld residuals to a prespecified or software-specified transformation \(g(t)\). For one covariate, a test may be expressed as a test of zero slope in that residual trend. In a score-test formulation, the time-varying alternative adds a term \(\theta g(t)\) to the coefficient; the test evaluates evidence for \(\theta\ne 0\), accounting for estimation of the constant Cox coefficient. With multiple covariates, a global test assesses the joint absence of the tested trends, while a covariate-specific test addresses one coefficient’s trend.

Under the null and regular large-sample conditions, these tests use an approximate chi-square reference distribution. A small p-value indicates that the observed residual trend is unusual under the specified proportional-hazards null and test procedure. It is not the probability that proportional hazards is true, and a large p-value does not prove the assumption. In addition, the p-value does not describe the size or practical importance of any departure; use the plotted trend and its uncertainty for that.

Worked Example: Interpreting a Matching Trend Estimate and Standard Error

In a hypothetical analysis of 30 events, the fitted model’s scaled Schoenfeld residuals for a treatment indicator are tested against \(g(t)=\log(t/1\text{ month})\). A formal regression using all 30 event residuals reports a slope estimate of \(0.180\) and standard error \(0.075\), both for this same slope estimator.

The Wald statistic is \(z=0.180/0.075=2.40\). The corresponding two-sided p-value is approximately \(0.0164\); equivalently, \(z^2=5.76\) is compared with a chi-square distribution with one degree of freedom. A 95% Wald interval for the slope is

$$ 0.180 \pm 1.96(0.075) = [0.0330,\ 0.327]. $$

This is evidence of an increasing treatment coefficient over the chosen log-time scale. A one-unit increase in \(g(t)\) corresponds to multiplying time by \(e\); the estimated change in the log hazard ratio over that increase is \(0.180\), or an estimated multiplicative change of \(\exp(0.180)=1.197\) in the hazard ratio. The interval describes uncertainty in the slope under the stated model and approximation. It does not establish that the true coefficient follows this exact linear trend. The estimate and standard error here are a matched pair from the same formal trend regression; a slope estimated by eye from a smoothed plot cannot be divided by a standard error from a different test.

Reading Plots and Results Carefully

A useful plot shows event times, the scaled residual trend, and uncertainty around that trend. A roughly horizontal smooth with wide uncertainty bands is compatible with proportional hazards, but is not proof. A persistent upward or downward pattern suggests time dependence on the plotted scale. A sudden excursion at one event time may instead reflect an influential observation or sparse risk set, so inspect whether the pattern is supported across events.

The following checks help avoid overinterpreting a diagnostic:

  • Check the time scale. A straight trend depends on the chosen transformation. Consider whether the scientific question makes that transformation sensible and whether another plausible scale reveals a different shape.
  • Check information over time. Few late events produce noisy tail behavior. A dramatic late fluctuation with wide uncertainty is weaker evidence of a stable trend than a pattern supported across many events.
  • Check the model context. A misspecified covariate form, omitted predictors, or influential observations can produce residual patterns that are not uniquely attributable to nonproportionality.
  • Separate individual and global tests. A global test can flag evidence of some departure without identifying which covariate drives it. Individual tests address specific trends and may require attention to multiple testing when many covariates are examined.
  • Check tie handling and censoring. Residual calculations should match the fitted model’s treatment of ties. As with Cox modeling generally, the analysis also relies on an appropriate risk set and censoring assumptions conditional on modeled information.

Worked Example: Reading Individual and Global Tests

A hypothetical three-covariate Cox model reports covariate-specific residual-trend p-values of \(0.018\), \(0.42\), and \(0.61\), and a global test statistic of \(8.70\) on three degrees of freedom, with p-value \(0.0335\).

At a prespecified significance level of \(\alpha=0.05\), the first covariate’s test provides evidence against a constant coefficient over the tested time scale; the other two tests do not provide evidence of a trend at that level. The global result also provides evidence against the joint null that all three tested trends are absent. The global finding is not a claim that all three covariates violate proportional hazards, nor does it identify a specific effect by itself.

The first covariate’s plot and uncertainty bands should be examined to understand the pattern and its size. Because three separate covariate tests were conducted, the analyst should also consider whether multiplicity adjustment is appropriate for the inferential goal. These results are evidence about the chosen model and diagnostic procedure, not definitive proof about the data-generating process.

Alternatives, Limitations, and a Common Pitfall

Scaled Schoenfeld residual plots provide a covariate-focused view of coefficient behavior at event times, and formal residual-trend tests quantify evidence for a specified pattern. They complement, rather than replace, checks based on comparing estimated effects across time intervals, examining fitted survival behavior, or using substantive knowledge to assess whether a constant hazard ratio is plausible. A test can have low power when few events are observed, while a large sample can make a small, practically unimportant departure statistically detectable.

A residual trend is diagnostic evidence, not a causal explanation. It does not by itself determine why an effect changes or which alternative model should be used. Nor should a failed test be interpreted as confirmation: it can reflect limited information, an unsuitable time transformation, or a departure the test is not designed to detect. The introductory material on the Cox proportional hazards model establishes the constant-effect interpretation; this diagnostic asks whether the fitted data show evidence against that condition.

Common mistake: “The p-value is above 0.05, so proportional hazards has been proved.” The correction is that the test failed to find sufficient evidence against its specified null; it cannot show that the null is true. Examine the trend, uncertainty, event support, and modeling context, and report the diagnostic as evidence with limitations.

Check Your Understanding

Answer each question, then compare your reasoning with the brief solutions.

  1. At an event time, the event subject has \(x=0\), and the fitted weighted risk-set mean is \(0.35\). What is the raw Schoenfeld residual?
  2. Why is zero conditional expectation exact for a residual centered using true-coefficient weights, but not generally exact for a fitted residual?
  3. A residual-trend test gives \(p=0.27\). What conclusion is justified at \(\alpha=0.05\), and what conclusion is not justified?
  4. A scaled-residual plot has a sharp late-time departure when only two events occur late in follow-up. Give one reason for caution.
  5. Why should a slope read from a smoothed plot not be divided by a standard error reported for a different formal trend estimator?

Solutions. 1. \(r_j=0-0.35=-0.35\). 2. With true weights, the weighted risk-set mean equals the conditional expected covariate of the event subject. Fitted weights generally differ from true weights, so that equality need not hold exactly. 3. At the stated level, the test does not provide sufficient evidence against the specified proportional-hazards null; it does not prove proportional hazards. 4. The apparent departure may be unstable because it is based on very few late events and the tail trend can be highly variable. 5. The estimate and standard error must refer to the same estimator and its uncertainty calculation for their ratio to define the stated test statistic.

Clinical Biostats