Description Usage Arguments Value NOTE References See Also Examples

View source: R/residuals.coxph.R

Calculates martingale, deviance, score or Schoenfeld residuals for a Cox proportional hazards model.

1 2 3 4 5 6 7 8 9 | ```
## S3 method for class 'coxph'
residuals(object,
type=c("martingale", "deviance", "score", "schoenfeld",
"dfbeta", "dfbetas", "scaledsch","partial"),
collapse=FALSE, weighted=FALSE, ...)
## S3 method for class 'coxph.null'
residuals(object,
type=c("martingale", "deviance","score","schoenfeld"),
collapse=FALSE, weighted=FALSE, ...)
``` |

`object` |
an object inheriting from class |

`type` |
character string indicating the type of residual desired.
Possible values are |

`collapse` |
vector indicating which rows to collapse (sum) over.
In time-dependent models more than one row data can pertain
to a single individual.
If there were 4 individuals represented by 3, 1, 2 and 4 rows of data
respectively, then |

`weighted` |
if |

`...` |
other unused arguments |

For martingale and deviance residuals, the returned object is a vector
with one element for each subject (without `collapse`

).
For score residuals it is a matrix
with one row per subject and one column per variable.
The row order will match the input data for the original fit.
For Schoenfeld residuals, the returned object is a matrix with one row
for each event and one column per variable. The rows are ordered by time
within strata, and an attribute `strata`

is attached that contains the
number of observations in each strata.
The scaled Schoenfeld residuals are used in the `cox.zph`

function.

The score residuals are each individual's contribution to the score vector.
Two transformations of
this are often more useful: `dfbeta`

is the approximate change in the
coefficient vector if that observation were dropped,
and `dfbetas`

is the approximate change in the coefficients, scaled by
the standard error for the coefficients.

For deviance residuals, the status variable may need to be reconstructed. For score and Schoenfeld residuals, the X matrix will need to be reconstructed.

T. Therneau, P. Grambsch, and T. Fleming. "Martingale based residuals
for survival models", *Biometrika*, March 1990.

1 2 3 |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.