# Quantify the time-varying reproduction number (Rt) of the outbreak
# Load required packages
library(outbreaks)
library(incidence)
library(epiparameter)
library(EpiEstim)
library(tidyverse)
# Load the simulated Ebola outbreak data
data(ebola_sim_clean)
# Extract the first element of the list
<- ebola_sim_clean$linelist
linelist
# Convert the data to an incidence object
<- incidence::incidence(linelist$date_of_onset)
incidence_data
# Extract parameter by disease, distribution, author
<-
epidist_ebola ::epiparam() %>%
epiparameterfilter(str_detect(disease,"Ebola")) %>%
filter(epi_distribution == "serial_interval") %>%
filter(region == "West Africa") %>%
filter(author == "WHO_Ebola_Response_Team") %>%
filter(year == 2015) %>%
::as_epidist()
epiparameter
# Estimate the time-varying reproduction number
<- estimate_R(
epiestim_output incid = incidence_data,
method = "parametric_si",
config = make_config(
mean_si = epidist_ebola$summary_stats$centre_spread$mean,
std_si = epidist_ebola$summary_stats$centre_spread$sd
)
)
# Plot the time-varying reproduction number
plot(epiestim_output)
How to quantify the time-varying reproduction number (Rt)?
Ingredients
- Use the
linelist
object in theebola_sim_clean
list from the{outbreaks}
R package.linelist
is an outbreak data set. - Use the
date_of _onset
column oflinelist
to calculate the case counts. - Use the distribution estimated from the WHO Ebola Response Team in 2015.
- Assume a known mean and standard deviation values of the serial interval distribution to quantify the time-varying effective reproduction number.
Steps in code
Steps in detail
The
outbreaks
package is loaded to access the simulated Ebola outbreak data.The
epiparameter
package is loaded to access the library of epidemiological parameters.The
ebola_sim_clean
object from the package contains the simulated outbreak data.The
linelist
object contains the first list element fromebola_sim_clean
.The
incidence()
function from theincidence
package converts the vectordate_of_onset
from thelinelist
data frame to anincidence
class object.The
epidist_db()
function from theepiparameter
package extract a parameter by specifying the disease name in thedisease
argument, epidemiological distribution in theepi_dist
argument, and author name in theauthor
argument.The
estimate_R()
function from theEpiEstim
package estimates the time-varying reproduction number (Rt). We provide theincidence_data
, specify the method as"parametric_si"
(parametric with a known serial interval), and pass the serial interval distribution parameters using themake_config
function.The
plot
function creates three plots from theestimate_R
class object.
Please note that the code assumes the necessary packages are already installed. If they are not, you can install them using first the install.packages("pak")
function and then the pak::pak()
function for both packages in CRAN or GitHub before loading them with library()
.
Additionally, make sure to adjust the serial interval distribution parameters according to the specific outbreak you are analyzing.