residuals.flexsurvreg: Calculate residuals for flexible survival models
Description
Calculates residuals for flexsurvreg or flexsurvspline model fits.
Usage
# S3 method for flexsurvreg
residuals(object, type = "response", ...)
Value
Numeric vector with the same length as nobs(object).
Arguments
object
Output from flexsurvreg or flexsurvspline, representing a fitted survival model object.
type
Character string for the type of residual desired. Currently only "response" and "coxsnell" are supported. More residual types may become available in future versions.
...
Not currently used.
Details
Residuals of type = "response" are calculated as the naive difference between the observed survival and the covariate-specific predicted mean survival from predict.flexsurvreg, ignoring whether the event time is observed or censored.
type="coxsnell" returns the Cox-Snell residual, defined as the estimated cumulative hazard at each data point. To check the fit of the
A more fully featured utility for this is provided in the function coxsnell_flexsurvreg.