R package for Evaluation Platform in COPD (EPIC). Please refer to the published papers for more information:
Sadatsafavi, M., Ghanbarian, S., Adibi, A., Johnson, K., Mark FitzGerald, J., Flanagan, W., … Sin, D. (2019). Development and Validation of the Evaluation Platform in COPD (EPIC): A Population-Based Outcomes Model of COPD for Canada. Medical Decision Making. https://doi.org/10.1177/0272989X18824098
Johnson KM, Sadatsafavi M, Adibi A, Lynd L, Harrison M, Tavakoli H, Sin DD, Bryan S. Cost effectiveness of case detection strategies for the early detection of COPD. Applied Health Economics and Health Policy. 2021 Mar;19(2):203-15. https://doi.org/10.1007/s40258-020-00616-2
epicR provides an interface to to interact with the Evaluation Platform in COPD (EPIC), a discrete-event-simulation (DES) whole-disease model of Chronic Onstructive Pulmonary Disease.
- Download and Install the latest version of R from https://cran.r-project.org/bin/windows/base/
- Download and Install R Studio from https://www.rstudio.com/products/rstudio/download/
- Download and Install the latest version of Rtools from https://cran.r-project.org/bin/windows/Rtools/
- Using either an R session in Terminal or in R Studio, install the package
devtools
:
install.packages('remotes')
- Install epicR from GitHub:
remotes::install_github('resplab/epicR')
- Download and Install the latest version of R from https://cran.r-project.org/bin/macosx/
- Download and Install R Studio from https://www.rstudio.com/products/rstudio/download/
- Open the Terminal and remove previous installations of
clang
:
# Delete the clang4 binary
sudo rm -rf /usr/local/clang4
# Delete the clang6 binary
sudo rm -rf /usr/local/clang6
# Delete the prior version of gfortran installed
sudo rm -rf /usr/local/gfortran
sudo rm -rf /usr/local/bin/gfortran
# Remove the install receipts that indicate a package is present
# Remove the gfortran install receipts (run after the above commands)
sudo rm /private/var/db/receipts/com.gnu.gfortran.bom
sudo rm /private/var/db/receipts/com.gnu.gfortran.plist
# Remove the clang4 installer receipt
sudo rm /private/var/db/receipts/com.rbinaries.clang4.bom
sudo rm /private/var/db/receipts/com.rbinaries.clang4.plist
# Remove the Makevars file
rm ~/.R/Makevars
-
Install the latest version of
clang
by installing Xcode command tools: `xcode-select --install -
Install the appropriate version of
gfortran
based on your Mac OS version using the dmg file found at https://github.com/fxcoudert/gfortran-for-macOS/releases -
Using either an R session in Terminal or in R Studio, install the packages
remotes
andusethis
:
install.packages (c('remotes', 'usethis'))
-
Open the
.Renviron
file usibng the commandusethis::edit_r_environ()
-
Add the line
PATH="/usr/local/clang8/bin:${PATH}"
to the file. If you installed any clang version above 8, modify the file accordingly. Save the.Renviron
file and restart R. -
You should now be able to Install epicR from GitHub:
remotes::install_github('resplab/epicR')
- Install R by executing the following commands in Terminal:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
sudo add-apt-repository 'deb [arch=amd64,i386] https://cran.rstudio.com/bin/linux/ubuntu xenial/'
sudo apt-get update
sudo apt-get install r-base
If the installation is successful, you should be able to start R:
sudo -i R
- Download and Install R Studio from https://www.rstudio.com/products/rstudio/download/
- Install
libcurl
from Terminal:
sudo apt-get install libcurl4-openssl-dev libssl-dev
- Using either an R session in Terminal or in R Studio, install the package
devtools
:
install.packages ('remotes')
- Install epicR from GitHub:
remotes::install_github('resplab/epicR')
To run EPIC with default inputs and settings, use the code snippet below.
library(epicR)
init_session()
run()
Cget_output()
terminate_session()
Default inputs can be retrieved with get_input()
, changed as needed, and resubmitted as a parameter to the run function:
init_session()
input <- get_input()
input$values$global_parameters$time_horizon <- 5
run(input=input$values)
results <- Cget_output()
resultsExra <- Cget_output_ex()
terminate_session()
For some studies, having access to the entire event history of the simulated population might be beneficial. Capturing event history is possible by setting record_mode
as a setting
.
settings <- get_default_settings()
settings$record_mode <- 2
settings$n_base_agents <- 1e4
init_session(settings = settings)
run()
results <- Cget_output()
events <- as.data.frame(Cget_all_events_matrix())
head(events)
terminate_session()
Note that you might need a large amount of memory available, if you want to collect event history for a large number of patients.
In the events data frame, each type of event has a code corresponding to the table below:
Event | No. |
---|---|
start | 0 |
annual | 1 |
birthday | 2 |
smoking change | 3 |
COPD incidence | 4 |
Exacerbation | 5 |
Exacerbation end | 6 |
Death by Exacerbation | 7 |
Doctor visit | 8 |
Medication change | 9 |
Background death | 13 |
End | 14 |
Closed-cohort analysis can be specified by changing the appropriate input parameters.
library(epicR)
input <- get_input(closed_cohort = 1)$values
init_session()
run(input=input)
Cget_output()
terminate_session()
The Peer Models Network provides educational material abour the model. It also allows users to access EPIC through the cloud. A MACRO-enabled Excel-file can be used to interact with the model and see the results. To download the PRISM Excel template file for EPIC, or to access EPIC using APIs please refer to the PMN model repository
Please cite:
Sadatsafavi, M., Ghanbarian, S., Adibi, A., Johnson, K., Mark FitzGerald, J., Flanagan, W., … Sin, D. (2019). Development and Validation of the Evaluation Platform in COPD (EPIC): A Population-Based Outcomes Model of COPD for Canada. Medical Decision Making. https://doi.org/10.1177/0272989X18824098