convert_to_cr_survreg: Create a 'cr_survreg' model from a custom list of models

Description Usage Arguments Value

Description

Instead of using a predetermined type of survival-regression model for the submodels in cr_survreg, you can use any survival-regression model with a valid 'predict' method (one that takes type='survival' and times; see ?predict.flexsurvreg).

Usage

1
2
3
convert_to_cr_survreg(list_of_models, data, time_col_name, event_col_name,
  time_lb_col_name = NULL, time_dependent_config = list(time_start_col_name
  = NULL, id_col_name = NULL, time_dependent_col_names = NULL))

Arguments

list_of_models

A list, whose names correspond to each possible type of event. These should correspond to the values in the event_col_name column. Each element is a survival-regression model that can predict survival probabilities.

data

A data.frame

time_col_name

A character indicating the column-name of the 'time' column.

event_col_name

A character indicating the column-name for events. The values in this column (either factor or character), should match the names of the names of list_of_models, except for the value indicating censoring.

time_lb_col_name

Optional. A character indicating the column-name of the time 'lower-bound'.

time_dependent_config

If your data is in a 'counting process' format (i.e., there are multiple rows per 'person', with a 'start' column specifying right-truncation), you should supply this. A list with three entries: 'time_start_col_name', 'id_col_name', and 'time_dependent_col_names'.

Value

An object of type cr_survreg, with plot and summary methods.


jwdink/tidysurv documentation built on May 20, 2019, 6:24 a.m.