## Residuals

The cumulative baseline hazard function
is estimated by

Although this formula is for the BRESLOW=TIES option,
the same formula is used for other TIES= options.
The discrepancies between results obtained by using an appropriate formula
for a nondefault TIES= option and those obtained by the given
formula are minimal.

The martingale residual at *t* is defined as

Here estimates the difference over **(0,***t*]
between the observed
number of events for the *i*th subject and a conditional
expected number of events. The quantity is referred to as the martingale residual for the *i*th subject.
When the counting process MODEL specification is
used, the RESMART= variable contains the component
() instead of the
martingale residual at *t*_{2}. The martingale residual
for a subject can be obtained by summing up these component
residuals within the subject.
For the Cox model with no time-dependent explanatory variables,
the martingale residual for the *i*th subject
with observation time *t*_{i} and event status , where

is

The deviance residuals *d*_{i}
are a transform of the martingale residuals:

The square root shrinks large negative martingale residuals,
while the logarithmic transformation expands martingale
residuals that
are close to unity. As such, the
deviance residuals are more symmetrically distributed about zero than
the martingale residuals.
For the Cox model, the deviance residual reduces to the form

When the counting process MODEL specification is used,
values of the RESDEV= variable are set to missing because the
deviance residuals can be calculated on a per subject
basis only.
The Schoenfeld residual vector
is calculated on a per event time
basis as

where *t* is an event time, and is a weighted average of the covariates
over the risk set at time *t* and is given by

Under the proportional hazards
assumption, the Schoenfeld residuals have the sample path of
a random walk; therefore, they are useful in
assessing time trend or lack of proportionality.
Harrell (1986) proposed a z-transform of the Pearson correlation
between these residuals and the rank order of the failure time as
a test statistic for nonproportional hazards.
Therneau, Grambsch, and Fleming (1990) considered a Kolmogorov-type test using
the cumulative sum of the residuals.
The score process
for the *i*th subject at time *t* is

The vector is the score residual for the
*i*th subject.
When the counting process MODEL specification is
used, the RESSCO= variables contain the components of
**(****L**_{i}(*t*2) - **L**_{i}(*t*1)) instead of the
score process at *t*2. The score residual for a subject
can be obtained by summing up these component
residuals within the subject.
The score residuals are a decomposition of the first partial
derivative of the log likelihood. They are useful in assessing
the influence of each subject on individual parameter estimates.
They also play an important role in the computation of the
robust sandwich variance estimators of Lin and Wei (1989) and
Wei, Lin, and Weissfeld (1989).

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.