Learn R Programming

hesim (version 0.5.5)

partsurvfit: Partitioned survival regression object

Description

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.

Usage

partsurvfit(object, data)

Value

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.

Arguments

object

An object of class flexsurvreg_list.

data

The data frame used to fit each survival model in object. flexsurvreg.

Examples

Run this code
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)

Run the code above in your browser using DataLab