multi_surv_reg: Best suvreg adjust

Description Usage Arguments Details Value Examples

View source: R/multi_surv_reg.R

Description

Finds best suvreg adjust

Usage

1
2
multi_surv_reg(surv_data, time_col = "time", status_col = "status",
  surv_formula = "~ 1", dist_list = "", ...)

Arguments

dist_list:

A vector containing a list of distributions to fit survival models and pick the best.

status_col:

The ame of the column containing the status

surv_data:

a data.frame

surv_formula:

A formula for the regression.

time_col:

name of the column containing the time

...:

further arguments for flexsurvreg()

Details

All distributions in the dist_list are used as link functions for the survival regresion model. The models are returned in the models slot of the result, ordered by best fit. The slot erros contains the fits that had erros. Adjust_table contains the goodness of fit of the models. ff_table contains the faulire frequency table. KM_fit has the Kaplan-Meier fit.

Value

A list containing the best survreg fits

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
da = system.file("extdata", "example.csv", package = "reliabilitytools")
da = read.csv2(da)

da_status = da %>%#'   
  mutate(status = as.integer(failure_cause_group == 560)) # cause of failure
  
  
# -- prepare life data
da_prepared = prepare_life_times(da_status
                                 , indiv_col = 'id'
                                 , status_col = 'status'
                                 , obs_time_col = 'cycles')
# -- suvival models
surv_model = multi_surv_reg(da_prepared
                            , time_col = 'elapsed'
                            , status_col = 'status')

# -- plot
plot_life_curve(surv_model$models,
                title_aux = '\nFailure cause: 560')

leonardommarques/reliabilitytools documentation built on Aug. 1, 2019, 8:03 p.m.