Last updated: 2022-06-01

Checks: 6 1

Knit directory: ampel-leipzig-meld/

This reproducible R Markdown analysis was created with workflowr (version 1.7.0). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


The R Markdown file has unstaged changes. To know which version of the R Markdown file created these results, you’ll want to first commit it to the Git repo. If you’re still working on the analysis, you can ignore this warning. When you’re finished, you can run wflow_publish to commit the R Markdown file and build the HTML.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20210604) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 2f24e00. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    _targets/
    Ignored:    container/
    Ignored:    logs/

Untracked files:
    Untracked:  1907.00825.pdf
    Untracked:  METHODS
    Untracked:  TODO
    Untracked:  article.md
    Untracked:  s12874-018-0482-1.pdf
    Untracked:  scripts/R.sh
    Untracked:  scripts/env.sh

Unstaged changes:
    Modified:   _targets.R
    Modified:   analysis/article.Rmd
    Modified:   analysis/benchmarks.Rmd
    Modified:   analysis/bibliography/rpackages/article.bib
    Modified:   analysis/bibliography/rpackages/home.bib
    Modified:   analysis/elasticnet.Rmd
    Modified:   analysis/supplement.Rmd
    Modified:   code/01-data.R
    Modified:   code/05-ameld-elasticnet.R

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/elasticnet.Rmd) and HTML (docs/elasticnet.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
html 983ec69 Sebastian Gibb 2022-03-17 chore: rebuild site
Rmd 057f935 Sebastian Gibb 2022-03-17 feat: add elastic net bootstrap and timeROC evaluations

library("targets")
library("ameld")
library("viridisLite")
tar_load(arcvob)
tar_load(bootrcv)
tar_load(bootarcv)
tar_load(bootarcv7)
tar_load(bootarcv9)
tar_load(bootrcv.woICA)
tar_load(amelddata)
tar_load(ameldcfg)
tar_load(zlog_data)

1 Tuning alpha

arcvob

Call: arcv.glmnet(x = amelddata$x, y = amelddata$y, alpha = ameldcfg$alpha,      nrepcv = ameldcfg$nrepcv, nfolds = ameldcfg$nfolds, balanced = TRUE,      family = "cox", standardize = ameldcfg$standardize, trace.it = FALSE) 

Models: 11
Alpha: 0 0.001 0.008 0.027 0.064 0.125 0.216 0.343 0.512 0.729 1
Number of CV for Lambda: 3
Number of repeated CV for Lambda: 100


Measure: Partial Likelihood Deviance 

Lambda min:
      Alpha  Lambda Index Measure     SE Nonzero
 [1,] 0.000 0.99962    72   9.020 0.3263      42
 [2,] 0.001 0.99962    72   9.020 0.3257      38
 [3,] 0.008 0.96746    50   9.017 0.3225      26
 [4,] 0.027 0.72678    40   9.018 0.3228      20
 [5,] 0.064 0.53581    34   9.032 0.3213      18
 [6,] 0.125 0.39801    30   9.052 0.3195      16
 [7,] 0.216 0.27743    28   9.070 0.3209      12
 [8,] 0.343 0.19174    27   9.084 0.3231      11
 [9,] 0.512 0.14098    26   9.098 0.3231       9
[10,] 0.729 0.09901    26   9.109 0.3262       9
[11,] 1.000 0.07218    26   9.118 0.3285       9

Lambda 1se:
      Alpha Lambda Index Measure     SE Nonzero
 [1,] 0.000 4.8608    55   9.331 0.2800      42
 [2,] 0.001 4.8608    55   9.343 0.2789      32
 [3,] 0.008 3.9057    35   9.320 0.2781      23
 [4,] 0.027 2.6734    26   9.300 0.2764      17
 [5,] 0.064 1.7958    21   9.304 0.2753      12
 [6,] 0.125 1.2155    18   9.326 0.2736      10
 [7,] 0.216 0.8472    16   9.371 0.2713       8
 [8,] 0.343 0.5856    15   9.393 0.2709       6
 [9,] 0.512 0.3923    15   9.372 0.2743       6
[10,] 0.729 0.3024    14   9.433 0.2718       6
[11,] 1.000 0.2204    14   9.431 0.2740       6
plot(arcvob)

Version Author Date
983ec69 Sebastian Gibb 2022-03-17
plot(arcvob, what = "lambda.min")

Version Author Date
983ec69 Sebastian Gibb 2022-03-17
plot(arcvob, what = "lambda.1se")

Version Author Date
983ec69 Sebastian Gibb 2022-03-17

2 Bootstrapping

2.1 rcv.glmnet

plot(bootrcv, what = "calibration")

ps <- lapply(
    zlog_data[paste0("SurvProbMeld", c("Unos", "NaUnos", "Plus7"))],
    function(p) {
        ctpnts <- cutpoints(p, n = ameldcfg$m)
        f <- cut(p, ctpnts, include.lowest = TRUE)
        list(
            predicted = groupmean(p, f = f),
            observed = observed_survival(
                amelddata$y, f = f, times = ameldcfg$times
            )
        )
    }
)
names(ps) <- c("MELD", "MELD-Na", "MELD-Plus7")
col <- viridisLite::viridis(6)[4:6]

for (i in seq_along(ps)) {
    lines(
        ps[[i]]$predicted, ps[[i]]$observed, col = col[i], type = "b", pch = 19
    )
}
legend("topleft", col = col, legend = names(ps), pch = 19, bty = "n")

Version Author Date
983ec69 Sebastian Gibb 2022-03-17
plot(bootrcv, what = "selected", cex = 0.5)

Version Author Date
983ec69 Sebastian Gibb 2022-03-17
plot(bootrcv$fit$glmnet.fit, xvar = "norm")

Version Author Date
983ec69 Sebastian Gibb 2022-03-17
plot(bootrcv$fit$glmnet.fit, xvar = "lambda")

Version Author Date
983ec69 Sebastian Gibb 2022-03-17
plot(bootrcv$fit$glmnet.fit, xvar = "dev")

Version Author Date
983ec69 Sebastian Gibb 2022-03-17

2.2 bootrcv.woICA

plot(bootrcv.woICA, what = "calibration")

plot(bootrcv.woICA, what = "selected", cex = 0.5)

2.3 arcv.glmnet

a <- c(table(sapply(bootarcv$models, function(m)m$fit$alpha)))
plot(bootarcv, what = "calibration")

Version Author Date
983ec69 Sebastian Gibb 2022-03-17
plot(bootarcv, what = "selected")

Version Author Date
983ec69 Sebastian Gibb 2022-03-17
plot_dots(a, main = "Selected Alpha Values")

Version Author Date
983ec69 Sebastian Gibb 2022-03-17

2.4 arcv7.glmnet

a <- c(table(sapply(bootarcv9$models, function(m)m$fit$alpha)))
plot(bootarcv7 , what = "calibration")

plot(bootarcv7, what = "selected")

plot_dots(a, main = "Selected Alpha Values")

2.5 arcv9.glmnet

a <- c(table(sapply(bootarcv9$models, function(m)m$fit$alpha)))
plot(bootarcv9 , what = "calibration")

plot(bootarcv9, what = "selected")

plot_dots(a, main = "Selected Alpha Values")


sessionInfo()
R version 4.1.3 (2022-03-10)
Platform: x86_64-unknown-linux-gnu (64-bit)

Matrix products: default
BLAS/LAPACK: /gnu/store/ras6dprsw3wm3swk23jjp8ww5dwxj333-openblas-0.3.18/lib/libopenblasp-r0.3.18.so

locale:
[1] C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] viridisLite_0.4.0 ameld_0.0.21      survival_3.3-1    glmnet_4.1-3     
[5] Matrix_1.4-1      targets_0.12.0   

loaded via a namespace (and not attached):
 [1] shape_1.4.6       tidyselect_1.1.2  xfun_0.30         bslib_0.3.1      
 [5] purrr_0.3.4       splines_4.1.3     lattice_0.20-45   vctrs_0.4.0      
 [9] htmltools_0.5.2   yaml_2.3.5        utf8_1.2.2        rlang_1.0.2      
[13] jquerylib_0.1.4   later_1.3.0       pillar_1.7.0      glue_1.6.2       
[17] withr_2.5.0       foreach_1.5.2     lifecycle_1.0.1   stringr_1.4.0    
[21] workflowr_1.7.0   codetools_0.2-18  evaluate_0.15     knitr_1.38       
[25] callr_3.7.0       fastmap_1.1.0     httpuv_1.6.5      ps_1.6.0         
[29] fansi_1.0.3       highr_0.9         Rcpp_1.0.8.3      promises_1.2.0.1 
[33] backports_1.4.1   jsonlite_1.8.0    fs_1.5.2          digest_0.6.29    
[37] stringi_1.7.6     bookdown_0.25     processx_3.5.3    rprojroot_2.0.3  
[41] grid_4.1.3        cli_3.2.0         tools_4.1.3       magrittr_2.0.3   
[45] base64url_1.4     sass_0.4.1        tibble_3.1.6      crayon_1.5.1     
[49] whisker_0.4       pkgconfig_2.0.3   ellipsis_0.3.2    data.table_1.14.2
[53] rmarkdown_2.13    iterators_1.0.14  R6_2.5.1          igraph_1.3.0     
[57] git2r_0.30.1      compiler_4.1.3