Create a partitioned survival regression object of class partsurvfit
. The object contains a list
of fitted survival models fit using either flexsurvreg
or flexsurvspline
(i.e.,
an object of class flexsurvreg_list
) and the data frame used to perform the fit of each model.
The same data frame must have been used for each fit.
partsurvfit(object, data)
An object of class flexsurvreg_list
.
The data frame used to fit each survival model in object
.
flexsurvreg
.
Returns an object of class partsurvfit
, which is a list containing two elements.
The first element, "models", contains the survival models passed to object
, and the second
element, "data" contains the data frame passed to data
.
library("flexsurv")
fit1 <- flexsurv::flexsurvreg(formula = Surv(endpoint1_time, endpoint1_status) ~ age,
data = psm4_exdata$survival,
dist = "weibull")
fit2 <- flexsurv::flexsurvreg(formula = Surv(endpoint2_time, endpoint2_status) ~ age,
data = psm4_exdata$survival,
dist = "weibull")
fsreg_list <- flexsurvreg_list(endpoint1 = fit1, endpoint2 = fit2)
fits <- partsurvfit(fsreg_list, data = psm4_exdata$survival)
class(fits)
#> [1] "partsurvfit"