## Technote (troubleshooting)

## Problem(Abstract)

I'm running a Cox regression model and want to do some residual analyses. I need Cox-Snell, Schoenfeld, martingale and deviance residuals. Can I get these from SPSS?

## Resolving the problem

A Cox-Snell residual is the value of the cumulative hazard function evaluated at the current case. To save these in SPSS COXREG, check the box for the Hazard function in the Save dialog box, or in command syntax, specify the SAVE subcommand with the keyword HAZARD. Schoenfeld residuals are also known as partial residuals, and are saved by checking that box in the Save dialog box, or by specifying the PRESID keyword on the COXREG SAVE subcommand.

Assuming that the STATUS variable is named status, that a value of 1 indicates an observed event time and that the default name of the cumulative hazard function or Cox-Snell residuals (HAZ_1) is used, the following commands will compute the martingale and deviance residuals for the Cox regression model.

compute martingale=(status=1)-HAZ_1.

compute deviance=sqrt(-2*(martingale+(status=1)*ln((status=1)-martingale))).

if martingale<0 deviance=-deviance.

formats martingale deviance (F8.5).

execute.

Appropriate changes to variable names would need to be made if any of the assumptions noted above are not true. If an observed event time is indicated by a value other than 1, that value would need to be substituted in the computation of the martingale residuals in the first COMPUTE command.

For a discussion of the various types of residuals in a Cox regression model, see Section 5.1 (pp. 150-158) in Collett, D. (1994). Modelling Survival Data in Medical Research. London: Chapman & Hall. (Note that Collett refers to Schoenfeld residuals also as score residuals, but that there is another type of residual known as a score residual, that is distinct from a Schoenfeld residual.)

The CSCOXREG procedure in the Complex Samples module can directly produce all four types of residuals

## Historical Number

55067

### Document information

**More support for:**
SPSS Statistics

**Software version:**
Not Applicable

**Operating system(s):**
Platform Independent

**Reference #:**
1481010

**Modified date:**
2015-04-14