This repository contains supplementary material for the paper: A review on statistical and machine learning competing risks survival methods.
It includes R vignettes to illustrate the usage of the following methods:
.
├── README.md
├── Data # Example dataset
│ └── HD
│ └── hd.csv
├── Docker # Files for building/using Docker image
│ ├── README.md
│ ├── examples.sh
│ ├── render
│ └── render.R
├── Source # Vignettes, includes Rmd and html files
│ ├── CIF_specification.Rmd
│ ├── CIF_specification.html
│ ├── CS_specification.Rmd
│ ├── CS_specification.html
│ ├── Discrete_specification.Rmd
│ ├── Discrete_specification.html
│ ├── Others.Rmd
│ ├── Others.html
│ ├── DataPreparation.Rmd
│ ├── DataPreparation.html
│ ├── Predictions.Rmd
│ ├── Predictions.html
│ ├── head.html
│ ├── index.Rmd
│ ├── navbar.html
│ ├── references.bib
│ └── style.css
├── Outputs # Resulting images and csv files
│ ├── Comparision_estimation_CIF.pdf
│ ├── Comparision_estimation_CIF_BW.pdf
│ ├── Comparision_estimation_CSH.pdf
│ ├── Comparision_estimation_CSH_BW.pdf
│ ├── Comparision_predictions_t5.pdf
│ ├── Comparision_predictions_t5_covariates.pdf
│ ├── pred_CIF.csv
│ ├── pred_BART.csv
│ ├── pred_CS.csv
│ └── pred_Others.csv
├── Data_prep # Data preparation
│ ├── data_prep.R
├── docs
│ └── .nojekill
├── LICENSE
├── Dockerfile
└── Competing_risks.Rproj
A Docker image is provided to support our aim of creating reproducible research by packaging together the operating system, the system packages, the R binary, and the R packages used in our reports. Docker containers can be thought of as being similar to virtual machines and an image contains what is inside the virtual machine (such as installed software). We provide images for both AMD64 (Intel and AMD processors) and ARM64 (Apple silicon) architectures. The correct image should automatically be downloaded for your platform.
Instructions
If you have not done so already, install Docker:
If you are using a Windows computer, you will most likely need support for Windows Subsystem for Linux 2 (WSL2) which requires BIOS-level hardware virtualisation support to be enabled in the BIOS settings.
If you are using a Mac computer, appropriate versions for the Intel or Apple Silicon chips are available here.
To use the Docker image, clone this repository and go into the directory.
git clone https://github.com/VallejosGroup/CompRisksVignettes.git
cd CompRisksVignettes
Note: You may need to allocate more RAM to Docker if 8GB of RAM or less is allocated. If you are using Docker Desktop, you can allocate more RAM in the settings panel (Settings > Resources > Advanced)
To pull (download) the image, run
docker image pull ghcr.io/vallejosgroup/comprisksvignettes:latest
There are two ways to use the docker image:
This will run an Rstudio session inside the docker container with all packages required available. This can be used to run our vignettes interactively and may be used when performing your own analysis. For example, this may be helpful when applying the same methods to different data or when running a systematic benchmark across methods (which may also include new methods).
To do this, you can run:
docker container run \
--mount type=bind,source="$(pwd)"/docs,target=/docs \
--mount type=bind,source="$(pwd)"/Data_prep,target=/Data_prep \
--mount type=bind,source="$(pwd)"/Source,target=/Source \
--mount type=bind,source="$(pwd)"/Data,target=/Data \
--mount type=bind,source="$(pwd)"/Outputs,target=/Outputs \
-e PASSWORD=password \
-ti \
-p 8787:8787 \
ghcr.io/vallejosgroup/comprisksvignettes
Replacing the lowercase "password
" with an alternative if desired. You can
then browse to localhost:8787
in a web browser to get an Rstudio session. The
login username should be "rstudio" and the password will be "password" (unless
you have changed it).
You may wish to set the root directory as your working directory in Rstudio as this is the working directory in the non-interactive approach. This can be achieved by running the below code in the Rstudio console:
setwd("/")
This can be used to reproduce our results by rendering the html reports. To render the html reports, run
docker container run \
--mount type=bind,source="$(pwd)"/docs,target=/docs \
--mount type=bind,source="$(pwd)"/Data_prep,target=/Data_prep \
--mount type=bind,source="$(pwd)"/Source,target=/Source \
--mount type=bind,source="$(pwd)"/Data,target=/Data \
--mount type=bind,source="$(pwd)"/Outputs,target=/Outputs \
ghcr.io/vallejosgroup/comprisksvignettes ./render
which will then use the R markdown files in the Source
directory to
render HTML files to the docs
directory using the Docker image.
Cleanup
The Docker image is large (3.98GB), so you may wish to delete the image once you are finished:
docker image rm ghcr.io/vallejosgroup/comprisksvignettes
If you wish/have to avoid using Docker, you can instead run the below R code
from the top-level directory of this repository which should install all
required packages and render out the R markdown files. However, please note this
approach will only work for as long as all dependencies (except binaryLogic
and DPWeibull
) are available on CRAN.
if (!require("renv")) install.packages("renv")
if (!require("remotes")) install.packages("remotes")
install.packages(unique(renv::dependencies()[["Package"]]))
remotes::install_github('cran/binaryLogic')
remotes::install_github('cran/DPWeibull')
source("Docker/render.R")
Author | Affiliation | Contribution |
---|---|---|
Karla Monterrubio-Gómez | University of Edinburgh | Author of .Rmd files |
Nathan Constantine-Cooke | University of Edinburgh | Review .Rmd files, author Docker image |
Catalina A. Vallejos | University of Edinburgh, The Alan Turing Institute | Author/Reviewer .Rmd files |
We welcome contributions!
If you are interested in adding a method to the list, please create a PR adding the method to the corresponding vignette using the same example dataset.
R version 4.3.1 (2023-06-16)
Platform: aarch64-unknown-linux-gnu (64-bit)
locale: _LC_CTYPE=enUS.UTF-8, _LCNUMERIC=C, _LC_TIME=enUS.UTF-8, _LC_COLLATE=enUS.UTF-8, _LC_MONETARY=enUS.UTF-8, _LC_MESSAGES=enUS.UTF-8, _LC_PAPER=enUS.UTF-8, _LCNAME=C, _LCADDRESS=C, _LCTELEPHONE=C, _LC_MEASUREMENT=enUS.UTF-8 and _LCIDENTIFICATION=C
attached base packages: parallel, stats, graphics, grDevices, utils, datasets, methods and base
other attached packages: GGally(v.2.1.2), randomForestSRC(v.3.2.2), BART(v.2.9.4), nlme(v.3.1-162), nnet(v.7.3-19), table1(v.1.4.3), splitstackshape(v.1.4.8), pander(v.0.6.5), patchwork(v.1.1.3), lubridate(v.1.9.2.9000), forcats(v.1.0.0), stringr(v.1.5.0), dplyr(v.1.1.2), purrr(v.1.0.2), readr(v.2.1.4), tidyr(v.1.3.0), tibble(v.3.2.1), ggplot2(v.3.4.3), tidyverse(v.2.0.0), coda(v.0.19-4), DPWeibull(v.1.8), timereg(v.2.0.5), pseudo(v.1.4.3), geepack(v.1.3.9), KMsurv(v.0.1-5), cmprsk(v.2.2-11), mboost(v.2.9-7), stabs(v.0.6-4), glmnet(v.4.1-8), Matrix(v.1.6-1), pec(v.2023.04.12), prodlim(v.2023.08.28), riskRegression(v.2023.03.22), rms(v.6.7-0), Hmisc(v.5.1-0) and survival(v.3.5-5)
loaded via a namespace (and not attached): gridExtra(v.2.3), sandwich(v.3.0-2), rlang(v.1.1.1), magrittr(v.2.0.3), multcomp(v.1.4-25), polspline(v.1.1.23), compiler(v.4.3.1), vctrs(v.0.6.3), quantreg(v.5.97), quadprog(v.1.5-8), pkgconfig(v.2.0.3), shape(v.1.4.6), fastmap(v.1.1.1), backports(v.1.4.1), inum(v.1.0-5), utf8(v.1.2.3), rmarkdown(v.2.24), tzdb(v.0.4.0), MatrixModels(v.0.5-2), xfun(v.0.40), jsonlite(v.1.8.7), reshape(v.0.8.9), data.tree(v.1.0.0), broom(v.1.0.5), cluster(v.2.1.4), R6(v.2.5.1), RColorBrewer(v.1.1-3), stringi(v.1.7.12), parallelly(v.1.36.0), rpart(v.4.1.19), numDeriv(v.2016.8-1.1), Rcpp(v.1.0.11), iterators(v.1.0.14), knitr(v.1.43), future.apply(v.1.11.0), zoo(v.1.8-12), base64enc(v.0.1-3), timechange(v.0.2.0), nnls(v.1.4), splines(v.4.3.1), tidyselect(v.1.2.0), rstudioapi(v.0.15.0), partykit(v.1.2-20), codetools(v.0.2-19), listenv(v.0.9.0), plyr(v.1.8.8), lattice(v.0.21-8), withr(v.2.5.0), evaluate(v.0.21), foreign(v.0.8-84), future(v.1.33.0), pillar(v.1.9.0), DiagrammeR(v.1.0.10), checkmate(v.2.2.0), foreach(v.1.5.2), stats4(v.4.3.1), generics(v.0.1.3), hms(v.1.1.3), munsell(v.0.5.0), scales(v.1.2.1), globals(v.0.16.2), glue(v.1.6.2), binaryLogic(v.0.3.9), tools(v.4.3.1), data.table(v.1.14.8), SparseM(v.1.81), visNetwork(v.2.1.2), mvtnorm(v.1.2-3), grid(v.4.3.1), libcoin(v.1.0-9), truncdist(v.1.0-2), colorspace(v.2.1-0), htmlTable(v.2.4.1), Formula(v.1.2-5), cli(v.3.6.1), evd(v.2.3-6.1), fansi(v.1.0.4), lava(v.1.7.2.1), mets(v.1.3.2), gtable(v.0.3.4), digest(v.0.6.33), TH.data(v.1.1-2), htmlwidgets(v.1.6.2), htmltools(v.0.5.6), lifecycle(v.1.0.3) and MASS(v.7.3-60)