This is the repository for the rcea package, which accompanies a short course on model-based cost-effectiveness analysis (CEA) with R . A range of models are covered including time-homogeneous and time-inhomogeneous Markov cohort models, partitioned survival models, and semi-Markov individual patient simulations. In addition, the course shows how simulated costs and QALYs from a probabilistic sensitivity analysis can be used for decision-analysis within a cost-effectiveness framework. Analyses are conducted using both base R and the R package hesim.
The course materials are available at https://hesim-dev.github.io/rcea.
All required R packages and course materials can be installed with the following steps.
# install.packages("devtools") # You must install the "devtools" R package first. devtools::install_github("hesim-dev/rcea")
# Create a project named "rcea-exercises" within a directory named "Projects" usethis::create_project("~/Projects/rcea-exercises")
rcea::use_rcea("~/Projects/rcea-exercises")
The course contains six tutorials:
For those new to R , we recommend the following free online resources:
A list of additional resources is also available here.
One of the advantages of R is that there are huge number of publicly available add-on packages. We make use of a number of them, in addition to hesim .
We use data.table to summarize output because it is very fast when working with large datasets, as is often produced by simulation models. For those more familiar with dplyr , a nice comparison between dplyr and data.table can be found here.
A major benefit of R is its graphing capabilities and ggplot2 is the most popular package for creating visualizations.
flexsurv can be used to fit parametric and spline-based survival models. You can learn more from the vignettes and reference guide on the CRAN website or from the Journal of Statistical Software publication.
The tutorials on this site are built from R Markdown files that include both plain text and embedded code. You can learn more about creating reproducible documents with R using R Markdown here. We highly recommend you use R Markdown to share the results of your economic models since it increases transparency and reproducibility. As an additional step, you might consider creating an R package for your model and creating a website for it with pkgdown (as we have done on this site).
If you use R Markdown, you will probably want to make nice HTML or PDF tables. A great way to do this is with the kableExtra (https://haozhu233.github.io/kableExtra/) package.
R6 is an object oriented programming paradigm. It’s less traditional R , but we think it is a nice fit for health economic modeling, where it is helpful to write modular code and to build models by combining multiple objects. Indeed economic models in hesim are R6 classes. You can learn more about R6 on the package website or in the Advanced R textbook here.
There are also a number of packages related to health economics. A nice compilation of them is available here.