itrSurv is an R package designed to estimate optimal individualized treatment regimes for various survival endpoints. This package provides tools for survival data involving competing risks or recurrent events. Please use as appropriate for your data. The authors introduce a joint value function that determine the optimal rule via prioritizing survival while also accounting for a secondary endpoint. itrSurv works for multiple treatment options, but is only applicable to the single stage disease setting. Please refer to our papers for technical details.
This is the doctoral dissertation thesis work of Christina W Zhou under the mentorship of Michael R Kosorok at UNC-CH Department of Biostatistics.
You can install the package directly from GitHub:
# install.packages("devtools")
devtools::install_github("cwzhou/itrSurv")If you encounter any issues, please refer to the Installation Guide at the end of this README. Because the package contains C, C++, and Fortran code, appropriate compiler tools are required to successfully build and install it.
- Simulation Studies: R code for simulation studies is located at
https://github.com/cwzhou/Analyses/tree/main/Simulations. See Paper1_CR for Competing Risk simulation studies and Paper3_RE for Recurrent Event simulation studies. - University Cohort Application: R code for applying the methodology to the university cohort (not available for public use) can be found at
https://github.com/cwzhou/Analyses/tree/main/RDA/Paper1_CR. There is a sensitivity simulation analysis that can be used instead, set revision = 1 for Paper1_CR.
Currently, itrSurv is applicable to settings with either 1) competing risks with a priority cause of interest (as of April 2024), or 2) recurrent events with terminal events (as of January 2025).
- January 2025: Finished updates for developing RCIF and the itrSurv estimator for RE setting.
- June 2024: Now incorporating a second endpoint, recurrent events in the recurrent with terminal events setting. NOTE: data must be properly inputted before running itrSurv function!! Please read the documentation!!
- 1/17/24:
This guide walks you through installing the itrSurv R package from GitHub on macOS.
It includes installing Homebrew, GCC, configuring R to use the correct compiler, and installing the package.
Homebrew is the package manager for macOS. Open Terminal and run:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Verify installation: brew --version
itrSurv requires compilation, so you need GCC: brew install gcc
Check the installed GCC version: brew list gcc
You should see something like:
/usr/local/Cellar/gcc/15.1.0/bin/gcc-15
/usr/local/Cellar/gcc/15.1.0/bin/g++-15
/usr/local/Cellar/gcc/15.1.0/bin/gfortran-15
...Ensure Xcode command line tools are installed: xcode-select --install
Finally, open R and install the package:
# install.packages("remotes")
library(remotes)
remotes::install_github("cwzhou/itrSurv")
library(itrSurv)If you encounter errors while installing the package, try the tips below (as needed) and then re-run Step 4.
Create or edit the R Makevars file:
mkdir -p ~/.R
nano ~/.R/MakevarsAdd the following lines (adjust paths if your GCC version is different):
CC=/usr/local/Cellar/gcc/15.1.0/bin/gcc-15
CXX=/usr/local/Cellar/gcc/15.1.0/bin/g++-15
FC=/usr/local/Cellar/gcc/15.1.0/bin/gfortran-15
F77=/usr/local/Cellar/gcc/15.1.0/bin/gfortran-15Save and exit (Ctrl+O, Enter, Ctrl+X). Check your exact path with: which gcc-15.
NOTE: make sure this path is the same as found in brew list gcc!
Restart R or RStudio and run: pkgbuild::check_build_tools(debug = TRUE). If everything is configured correctly, it should compile a simple C file without errors.
Error: gcc-13: command not found → Make sure ~/.R/Makevars points to your installed GCC version.
Permission issues → Use R as a user, not sudo.
Failed to compile C/C++ files → Verify Xcode command line tools are installed and up to date.
To install in cluster (linux): First, build source .tar.gz file from .RProj on local machine, then copy to cluster location. Then, unzip the file by doing the following:
- go to the folder that has the R scripts you want to run
- open R by typing R (make sure you module load r/4.1.2 the right version)
- type: install.packages('[location of .tar.gz file]/itrSurv_0.1.0.tar.gz', repos = NULL, type='source')
- library(itrSurv)
- exit and run bash CR_S2run.sh
! If package is ONLY binary and not source, then go to DESCRIPTION and delete the line with "BUILT" and "PACKAGED"