Skip to contents

Search for the model with the lowest AIC and BIC given the output of a fpm_test_dfs call.

Usage

fpm_get_best_fit(x)

Arguments

x

A data.frame with AIC and BIC criteria for different FPMs obtained from fpm_test_dfs or a list thereof.

Value

A data.frame where the first row corresponds to the model with the lowest AIC and the second row to the model with the lowest BIC.

Examples

require(rstpm2)

data(brcancer)

test_model <- fpm_test_dfs(Surv(rectime, censrec) ~ hormon + x1,
                 dfs_bh  = 1:5,
                 dfs_tvc = list(hormon = 1:3,
                                x1     = 1:5),
                 same_dfs_tvc = TRUE,
                 data = rstpm2::brcancer)

fpm_get_best_fit(test_model)
#>   df_bh df_tvc_hormon df_tvc_x1      aic      bic
#> 4     4             1         1 5224.228 5265.006
#> 2     2             1         1 5225.531 5257.247