Fit the Cox proportional-hazards model with the other explanatory variables, initially omitting the variable whose form is being assessed, and plot the resulting martingale residuals against . Add a smooth trend, for example using a cubic spline or a local smoother. A systematic pattern indicates that affects the hazard function; the shape helps suggest a linear term, a transformation, or a nonlinear spline term in the log hazard.
Refit with the proposed form and inspect martingale residuals against again. Under an adequate functional form, their conditional mean should have no systematic trend, allowing for model fitting and the other covariates. Compare plausible alternative forms using the partial likelihood and suitable model checks.
Use the smoothed pattern to assess the covariate's functional form, rather than treating these residuals as normal regression errors. Martingale residuals are asymmetric, bounded above by 1, and can be arbitrarily negative; the raw residual plot can therefore be misleading without smoothing. This diagnostic concerns the covariate form, and does not by itself test the proportional hazards assumption.
A proportional hazards model has , with a time-independent hazard ratio. In the Cox proportional-hazards model, and the baseline hazard is unspecified. At each untied event time, conditioning on the identity of the person who fails given the current risk set produces the factor
Multiplying these factors gives the Cox partial likelihood. It is called partial because it uses the conditional event ordering information that identifies while discarding the part of the full likelihood involving the unspecified baseline hazard.
For the fitted Cox proportional-hazards model,
where is the fitted baseline cumulative hazard, usually obtained with the Breslow estimator.
A semiparametric proportional hazards model specifies
with finite-dimensional parameter but an unspecified baseline hazard . A partial likelihood uses a component of the data likelihood that depends on while eliminating the nuisance function. In the Cox proportional-hazards model, conditioning on which member of each risk set experiences the event produces the Cox partial likelihood.
The Cox proportional-hazards model is
where is an unspecified baseline hazard and indicates treatment. With no tied events, the Cox partial likelihood is
Equality of the two hazard functions is , testable with a likelihood-ratio, score, or Wald test from this likelihood.
A time interaction extends a constant-coefficient Cox proportional-hazards model by a covariate term and tests whether its coefficient is zero. The time function is evaluated at the current event/risk-set time, not each person's eventual outcome time. Scaled Schoenfeld residuals provide related graphical and score-test diagnostics for coefficient trends.
Restricted cubic spline 2026-10-07
A restricted cubic spline represents a smooth covariate effect by joined cubic pieces, with linear tails beyond the boundary knots. It allows nonlinear regression effects while controlling extrapolation. In a Cox proportional-hazards model, test the nonlinear basis coefficients jointly and report the fitted log-hazard or hazard-ratio curve with uncertainty.
A scaled Schoenfeld residual rescales a Schoenfeld residual using fitted information so that its trend can diagnose departures from a constant coefficient in a Cox proportional-hazards model. A smooth trend against transformed event time estimates a time-dependent coefficient pattern; a flat trend supports the working proportional hazards assumption test.
Schoenfeld residual 2026-10-06
At an untied event time, a Schoenfeld residual is the event subject's covariate vector minus its fitted risk-weighted average over the risk set. Under a correctly specified Cox proportional-hazards model, these residuals have no systematic mean trend with event time. They are defined at event times, unlike Cox–Snell residuals which can be evaluated at both events and censoring times.
In an untied Cox proportional-hazards model with a single subject remaining after all other observed exit times, that subject's event contributes the constant factor one to Cox partial likelihood. Replacing its terminal censoring time by a later event therefore preserves the fitted coefficients and every earlier Breslow estimator increment. At its new event, the subject's fitted cumulative hazard increases by one, cancelling the increase of one in its event indicator. Every martingale residual is unchanged. This property relies on the subject being alone in the terminal risk set and the same covariate history being retained.
Zero sum of Cox martingale residuals Created 2026-10-05 Updated 2026-10-14
When a Cox proportional-hazards model uses the Breslow estimator, the sum of fitted martingale residuals is zero. Each estimated baseline hazard jump redistributes one observed event across its risk set, so summing cumulative fitted intensities equals summing observed event counts. The identity holds for any finite regression coefficient used consistently in both calculations.