R/residuals.flexsurvreg.R
residuals.flexsurvreg.Rd
Calculates residuals for flexsurvreg
or flexsurvspline
model fits.
# S3 method for flexsurvreg residuals(object, type = "response", ...)
object | Output from |
---|---|
type | Character string for the type of residual desired. Currently only |
... | Not currently used. |
Numeric vector with the same length as nobs(object)
.
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.
fitg <- flexsurvreg(formula = Surv(futime, fustat) ~ age, data = ovarian, dist = "gengamma") residuals(fitg)#> [1] -187.21560 -88.78121 -255.36822 -873.56963 -1255.83883 -541.96330 #> [7] -483.01162 -258.61757 -25.66308 -541.58483 -324.11343 -977.14761 #> [13] 20.81491 -167.52130 -3640.36131 -2316.90107 -3552.79251 -1681.40682 #> [19] -105.56084 -1679.31116 476.11922 64.41307 -2839.10079 -193.52725 #> [25] -126.81187 -462.83150