residuals.flexsurvreg: Calculate residuals for flexible survival models

View source: R/residuals.flexsurvreg.R

residuals.flexsurvregR Documentation

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

Value

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

See Also

predict.flexsurvreg

Examples


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




flexsurv documentation built on June 18, 2022, 1:06 a.m.