This tutorial is meant to be an approachable introduction to estimating \(R_t\). It’s meant for any and all levels of comfort with writing code.
This tutorial will work best if you spend a little time in advance to get set up. It can take a little time for your computer to install the necessary packages (about 15 minutes). If you’ve never used R before, follow the detailed instructions below for a step-by-step guide to get set up. If you have R and RStudio installed on your computer, feel free to skip ahead to the tutorial.
Rmarkdown and can be opened in RStudio. It
contains all the code and explanations for the tutorial.
The set up process comes in three parts:
Downloading the folder with the necessary code onto your machine.
If this document is sitting in your computer in a folder called
cste-forecasting-workshop, then you’ve successfully
completed this step. If not, look for a file with a *.zip extension in
an email. Download and unzip the folder.
Download and install R and Rstudio from this website
Double click on the
object in the
cste-forecasting-workshop folder to open the
R project associated with this tutorial. This should launch R and
RStudio. Then, type
renv::restore(prompt = FALSE) into the
open console (with the
> symbol) to download all the
These steps should take around 20 minutes. Once completed, you’re all
set up to run the code in
tutorial.Rmd as part of the
We recommend that you run the code on your own machine. However, if you are unable to do this, there are a few other options.
One option is to use codespaces for which we provide a prebuilt environment (for vscode users this is also available for local use).
Another option is to use binder
which we have set up with all the necessary packages installed. This
will take a little while to load and is a little unstable but should
allow you to run the code in
tutorial.Rmd as part of the
workshop. Note that this will not save any changes you make to the code
and may be slower than running the code on your own machine. If you run
into an SSL error you could try editing the address in your URL bar to
http (from https) and change your browser security settings
for this site. Note: do this at your own risk, and never on a state or
federal government computer.
If you are interested in finding additional resources for estimating the effective reproduction number or learning about nowcasting in R, explore the following:
EpiNow2 package. This is the package
we will be using in this tutorial. It is designed to be easy to use,
robust to a wide range of contexts, and flexible.
in use, see the CDC’s technical reports on Mpox. These reports use
EpiNow2 to estimate the effective reproduction number and
forecast future cases.
EpiNow2 and the
challenges of estimating the effective reproduction number in real-time
EpiNow2 to estimate the effective
reproduction number with adjustments for known delays and right
is currently under development. It is designed to be more general and
even more flexible than
epinowcast but is potentially
more difficult to use. It also generally has less functionality for
dealing with delays than