residuals.flexsurvreg: Calculate residuals for flexible survival models

Description Usage Arguments Details Value See Also Examples

View source: R/residuals.flexsurvreg.R

Description

Calculates residuals for flexsurvreg or flexsurvspline model fits.

Usage

1
2
## 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

predict.flexsurvreg

Examples

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

flexsurv documentation built on Sept. 13, 2021, 5:07 p.m.