Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

residuals.flexsurvreg

Calculate residuals for flexible survival models


Description

Calculates residuals for flexsurvreg or flexsurvspline model fits.

Usage

## S3 method for class 'flexsurvreg'
residuals(object, type = "response", ...)

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" is 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.

Value

Numeric vector with the same length as nobs(object).

See Also

Examples

fitg <- flexsurvreg(formula = Surv(futime, fustat) ~ age, data = ovarian, dist = "gengamma")
residuals(fitg)

flexsurv

Flexible Parametric Survival and Multi-State Models

v2.0
GPL (>= 2)
Authors
Christopher Jackson [aut, cre], Paul Metcalfe [ctb], Jordan Amdahl [ctb], Matthew T. Warkentin [ctb], Kevin Kunzmann [ctb]
Initial release
2021-02-22

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.