diff --git a/README.Rmd b/README.Rmd
index 0e163ba6..8b113d48 100644
--- a/README.Rmd
+++ b/README.Rmd
@@ -52,3 +52,10 @@ Read the [License](LICENSE.md) of this tutorial.
```{r,eval=FALSE,echo=FALSE}
readCitationFile(file = "inst/CITATION")
```
+
+## Related projects
+
++ R package vignettes: Look at all Epiverse-TRACE packages in [our developer space](https://epiverse-trace.github.io/).
++ [How-to guides](https://epiverse-trace.github.io/howto/): reproducible recipes with concrete steps to solve specific Outbreak Analysis questions.
++ [The Epidemiologist R Handbook](https://www.epirhandbook.com/en/index.html): Quick R code reference manual with task-centered examples that address common epidemiological problems.
++ *COMING SOON* case studies: reproducible case-studies of outbreak data analysis tasks using R packages.
diff --git a/README.md b/README.md
index 8690ca1e..f3afb357 100644
--- a/README.md
+++ b/README.md
@@ -44,3 +44,17 @@ Read the [License](LICENSE.md) of this tutorial.
- [@amanda-minter](https://github.com/amanda-minter/)
- [@avallecam](https://github.com/avallecam/)
+
+## Related projects
+
+- R package vignettes: Look at all Epiverse-TRACE packages in [our
+ developer space](https://epiverse-trace.github.io/).
+- [How-to guides](https://epiverse-trace.github.io/howto/): reproducible
+ recipes with concrete steps to solve specific Outbreak Analysis
+ questions.
+- [The Epidemiologist R
+ Handbook](https://www.epirhandbook.com/en/index.html): Quick R code
+ reference manual with task-centered examples that address common
+ epidemiological problems.
+- *COMING SOON* case studies: reproducible case-studies of outbreak data
+ analysis tasks using R packages.
diff --git a/config.yaml b/config.yaml
index c62ee29f..7433421f 100644
--- a/config.yaml
+++ b/config.yaml
@@ -59,14 +59,8 @@ contact: 'andree.valle-campos@lshtm.ac.uk'
# Order of episodes in your lesson
episodes:
+# - template.Rmd
- introduction.Rmd
-- read-delays.Rmd
-- quantify-transmissibility.Rmd
-- create-forecast.Rmd
-- simulating-transmission.Rmd
-- model-choices.Rmd
-- modelling-interventions.Rmd
-- compare-interventions.Rmd
# Information for Learners
learners:
@@ -84,4 +78,4 @@ profiles:
varnish: epiverse-trace/varnish@epiversetheme
# this is carpentries/sandpaper#533 in our fork so we can keep it up to date with main
-sandpaper: epiverse-trace/sandpaper@patch-renv-github-bug
+sandpaper: epiverse-trace/sandpaper@patch-renv-github-bug
diff --git a/episodes/compare-interventions.Rmd b/episodes/compare-interventions.Rmd
deleted file mode 100644
index 419379da..00000000
--- a/episodes/compare-interventions.Rmd
+++ /dev/null
@@ -1,275 +0,0 @@
----
-title: 'Comparing public health outcomes of interventions'
-teaching: 45 # teaching time in minutes
-exercises: 30 # exercise time in minutes
-
----
-
-:::::::::::::::::::::::::::::::::::::: questions
-
-- How can I quantify the effect of an intervention?
-
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-::::::::::::::::::::::::::::::::::::: objectives
-
-- Compare intervention scenarios
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-::::::::::::::::::::::::::::::::::::: prereq
-
-## Prerequisites
-+ Complete tutorials [Simulating transmission](../episodes/simulating-transmission.md) and [Modelling interventions](../episodes/modelling-interventions.md)
-
-Learners should familiarise themselves with following concept dependencies before working through this tutorial:
-
-**Outbreak response** : [Intervention types](https://www.cdc.gov/nonpharmaceutical-interventions/).
-:::::::::::::::::::::::::::::::::
-
-
-## Introduction
-
-In this tutorial we will compare intervention scenarios against each other. To quantify the effect of the intervention we need to compare our intervention scenario to a counter factual scenario. The *counter factual* is the scenario in which nothing changes, often referred to as the 'do nothing' scenario. The counter factual scenario may include no interventions, or if we are investigating the potential impact of an additional intervention in the later stages of an outbreak there may be existing interventions in place.
-
-We must also decide what our *outcome of interest* is to make comparisons between intervention and counter factual scenarios. The outcome of interest can be:
-
-+ a model outcome, e.g. number of infections or hospitalisations,
-+ a metric such as the epidemic peak time or size,
-+ a measure that uses the model outcomes such as QALY/DALYs.
-
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: instructor
-
-In this tutorial we introduce the concept of the counter factual and how to compare scenarios (counter factual versus intervention) against each other.
-
-::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-## Vacamole model
-
-The Vacamole model is a deterministic model based on a system of ODEs in [Ainslie et al. 2022]( https://doi.org/10.2807/1560-7917.ES.2022.27.44.2101090) to describe the effect of vaccination on COVID-19 dynamics. The model consists of 11 compartments, individuals are classed as one of the following:
-
-+ susceptible, $S$,
-+ partial vaccination ($V_1$), fully vaccination ($V_2$),
-+ exposed, $E$ and exposed while vaccinated, $E_V$,
-+ infectious, $I$ and infectious while vaccinated, $I_V$,
-+ hospitalised, $H$ and hospitalised while vaccinated, $H_V$,
-+ dead, $D$,
-+ recovered, $R$.
-
-The diagram below describes the flow of individuals through the different compartments.
-
-```{r, echo = FALSE, message = FALSE}
-DiagrammeR::grViz("digraph{
- # graph statement
- #################
- graph [layout = dot,
- rankdir = LR,
- overlap = true,
- fontsize = 10]
-
- # nodes
- #######
- node [shape = square,
- fixedsize = true
- width = 1.3]
-
- S
- E
- Ev [label = 'E@_{V}', style = filled, fillcolour = 'gray']
- I
- Iv [label = 'I@_{V}', style = filled, fillcolour = 'gray']
- H
- Hv [label = 'H@_{V}', style = filled, fillcolour = 'gray']
- D
- R
- V1 [label = 'V@_{1}', style = filled, fillcolour = 'gray']
- V2 [label = 'V@_{2}', style = filled, fillcolour = 'gray']
-
-
- # edges
- #######
- S -> E [label = ' infection (β) ']
- S -> V1 [label = ' vaccination (ν1)']
- V1 -> E [label = ' infection (β)']
- V1 -> V2 [label = ' vaccination\n(second dose) (ν2)']
- V2 -> Ev [label = ' infection (β)']
- Ev -> Iv [label = ' onset of \ninfectiousness (α) ']
- E -> I [label = ' onset of \ninfectiousness (α) ']
- I -> H [label = ' hospitalisation (η)']
- Iv -> Hv [label = ' hospitalisation (η@_{V})']
- I -> D [label = ' death (ω)']
- I -> R [label = ' recovery (γ)']
- Iv -> D [label = ' death (ω@_{V})']
- Iv -> R [label = ' recovery (γ)']
- Hv -> D [label = ' death (ω@_{V})']
- Hv -> R [label = ' recovery (γ)']
- H -> D [label = ' death (ω)']
- H -> R [label = ' recovery (γ)']
-
- subgraph {
- rank = same; S; V1;V2;
- }
-}")
-```
-
-
-::::::::::::::::::::::::::::::::::::: challenge
-
-## Running a counterfactual scenario using the Vacamole model
-
-1. Run the model with the default parameter values for the UK population assuming that :
-
-+ 1 in a million individual are infectious (and not vaccinated) at the start of the simulation
-+ The contact matrix for the United Kingdom has age bins:
- + age between 0 and 20 years,
- + age between 20 and 40,
- + 40 years and over.
-+ There is no vaccination scheme in place
-
-2. Using the output, plot the number of deaths through time
-
-
-::::::::::::::::: hint
-
-### Vaccination code
-
-To run the model with no vaccination in place we can *either* create two vaccination objects (one for each dose) using `vaccination()` with the time start, time end and vaccination rate all set to 0, or we can use the `no_vaccination()` function to create a vaccination object for two doses with all values set to 0.
-
-```{r, eval = FALSE}
-no_vaccination <- no_vaccination(population = uk_population, doses = 2)
-```
-::::::::::::::::::::::
-
-::::::::::::::::: hint
-
-### HINT : Running the model with default parameter values
-
-We can run the Vacamole model with [default parameter values](https://epiverse-trace.github.io/epidemics/articles/vacamole.html#model-epidemic-using-vacamole) by just specifying the population object and number of time steps to run the model for:
-
-
-```{r, eval = FALSE}
-output <- model_vacamole_cpp(
- population = uk_population,
- vaccination = no_vaccination,
- time_end = 300
-)
-```
-
-::::::::::::::::::::::
-
-
-
-::::::::::::::::: solution
-
-### SOLUTION
-
-1. Run the model
-
-```{r}
-polymod <- socialmixr::polymod
-contact_data <- socialmixr::contact_matrix(
- survey = polymod,
- countries = "United Kingdom",
- age.limits = c(0, 20, 40),
- symmetric = TRUE
-)
-# prepare contact matrix
-contact_matrix <- t(contact_data$matrix)
-
-# extract demography vector
-demography_vector <- contact_data$demography$population
-names(demography_vector) <- rownames(contact_matrix)
-
-# prepare initial conditions
-initial_i <- 1e-6
-
-initial_conditions <- c(
- S = 1 - initial_i,
- V1 = 0, V2 = 0,
- E = 0, EV = 0,
- I = initial_i, IV = 0,
- H = 0, HV = 0, D = 0, R = 0
-)
-
-initial_conditions <- rbind(
- initial_conditions,
- initial_conditions,
- initial_conditions
-)
-rownames(initial_conditions) <- rownames(contact_matrix)
-
-# prepare population object
-uk_population <- population(
- name = "UK",
- contact_matrix = contact_matrix,
- demography_vector = demography_vector,
- initial_conditions = initial_conditions
-)
-
-no_vaccination <- no_vaccination(population = uk_population, doses = 2)
-
-# run model
-output <- model_vacamole_cpp(
- population = uk_population,
- vaccination = no_vaccination,
- time_end = 300
-)
-```
-
-2. Plot the number of deaths through time
-
-```{r}
-ggplot(output[output$compartment == "dead", ]) +
- geom_line(
- aes(time, value, colour = demography_group),
- linewidth = 1
- ) +
- scale_colour_brewer(
- palette = "Dark2",
- labels = rownames(contact_matrix),
- name = "Age group"
- ) +
- scale_y_continuous(
- labels = scales::comma
- ) +
- labs(
- x = "Simulation time (days)",
- y = "Individuals"
- ) +
- theme(
- legend.position = "top"
- ) +
- theme_bw(
- base_size = 15
- )
-```
-
-
-
-:::::::::::::::::::::::::::
-
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-
-
-## Comparing scenarios
-
-*Coming soon*
-
-
-
-## Challenge : Ebola outbreak analysis
-
-*Coming soon*
-
-
-
-
-::::::::::::::::::::::::::::::::::::: keypoints
-
-- The counter factual scenario must be defined to make comparisons
-
-::::::::::::::::::::::::::::::::::::::::::::::::
diff --git a/episodes/create-forecast.Rmd b/episodes/create-forecast.Rmd
deleted file mode 100644
index 48c85e5f..00000000
--- a/episodes/create-forecast.Rmd
+++ /dev/null
@@ -1,348 +0,0 @@
----
-title: 'Create a short-term forecast'
-teaching: 30
-exercises: 30
-editor_options:
- chunk_output_type: inline
----
-
-```{r setup, echo = FALSE, warning = FALSE, message = FALSE}
-library(EpiNow2)
-withr::local_options(list(mc.cores = 4))
-```
-
-
-:::::::::::::::::::::::::::::::::::::: questions
-
-- How do I create short-term forecasts from case data?
-- How do I account for incomplete reporting in forecasts?
-
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-::::::::::::::::::::::::::::::::::::: objectives
-
-- Learn how to make forecasts of cases using R package `EpiNow2`
-- Learn how to include an observation process in estimation
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-::::::::::::::::::::::::::::::::::::: prereq
-
-## Prerequisites
-
-+ Complete tutorial [Quantifying transmission](../episodes/quantify-transmissibility.md)
-
-Learners should familiarise themselves with following concept dependencies before working through this tutorial:
-
-**Statistics** : probability distributions, principle of Bayesian analysis.
-
-**Epidemic theory** : Effective reproduction number.
-
-:::::::::::::::::::::::::::::::::
-
-## Introduction
-
-Given case data, we can create estimates of the current and future number of cases by accounting for both delays in reporting and under reporting. To make statements about the future, we need to make an assumption of how observations up to today are related to what we expect to happen in the future. The simplest way of doing so is to assume "no change", i.e. the reproduction number remains the same in the future as last observed. In this tutorial we will create short-term forecasts by assuming the reproduction number will remain the same as it was estimated to be on the final date for which data was available.
-
-## Create a short-term forecast
-
-The function `epinow()` described in the previous tutorial is a wrapper for the function `estimate_infections()` used to estimate cases by date of infection. Using the same code in the previous tutorial we can extract the short-term forecast using:
-
-```{r, echo = FALSE}
-cases <- aggregate(
- cases_new ~ date,
- data = incidence2::covidregionaldataUK[, c("date", "cases_new")],
- FUN = sum
-)
-colnames(cases) <- c("date", "confirm")
-rt_log_mean <- convert_to_logmean(2, 1)
-rt_log_sd <- convert_to_logsd(2, 1)
-
-incubation_period_fixed <- dist_spec(
- mean = 4, sd = 2,
- max = 20, distribution = "gamma"
-)
-
-log_mean <- convert_to_logmean(2, 1)
-log_sd <- convert_to_logsd(2, 1)
-reporting_delay_fixed <- dist_spec(
- mean = log_mean, sd = log_sd,
- max = 10, distribution = "lognormal"
-)
-
-generation_time_fixed <- dist_spec(
- mean = 3.6, sd = 3.1,
- max = 20, distribution = "lognormal"
-)
-```
-
-
-```{r, message = FALSE, eval = TRUE}
-reported_cases <- cases[1:90, ]
-estimates <- epinow(
- reported_cases = reported_cases,
- generation_time = generation_time_opts(generation_time_fixed),
- delays = delay_opts(incubation_period_fixed + reporting_delay_fixed),
- rt = rt_opts(prior = list(mean = rt_log_mean, sd = rt_log_sd))
-)
-```
-
-
-We can visualise the estimates of the effective reproduction number and the estimated number of cases using `plot()`. The estimates are split into three categories:
-
-+ **Estimate** (green): utilises all data,
-
-+ **Estimate based on partial data** (orange): estimates that are based less data are therefore more uncertain,
-
-+ **Forecast** (purple): forecasts into the future.
-
-
-```{r}
-plot(estimates)
-```
-
-
-::::::::::::::::::::::::::::::::::::: callout
-### Forecasting with estimates of $R_t$
-
-By default, the short-term forecasts are created using the latest estimate of the reproduction number $R_t$. As this estimate is based on partial data, it has considerable uncertainty.
-
-The reproduction number that is projected into the future can be changed to a less recent estimate based on more data using `rt_opts()`:
-
-```{r, eval = FALSE}
-rt_opts(future = "estimate")
-```
-
-The result will be less uncertain forecasts (as they are based on $R_t$ with a narrower uncertainty interval) but the forecasts will be based on less recent estimates of $R_t$ and assume no change since then.
-
-Additionally, there is the option to project the value of $R_t$ into the future using a generic model by setting `future = "project"`. As this option uses a model to forecast the value of $R_t$, the result will be forecasts that are more uncertain than `estimate`, for an example [see here](https://epiforecasts.io/EpiNow2/dev/articles/estimate_infections_options.html#projecting-the-reproduction-number-with-the-gaussian-process).
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-
-### Incomplete observations
-
-In the previous tutorial we accounted for delays in reporting. In `EpiNow2` we also can account for incomplete observations as in reality, 100% of cases are not reported.
-
-We will pass another input into `epinow()` called `obs` to define an observation model. The format of `obs` must be the `obs_opt()` function (see `?EpiNow2::obs_opts` for more detail).
-
-Let's say we believe the COVID-19 outbreak data from the previous tutorial do not include all reported cases. We believe that we only observe 40% of cases. To specify this in the observation model, we must pass a scaling factor with a mean and standard deviation. If we assume that 40% of cases are in the case data (with standard deviation 1%), then we specify the `scale` input to `obs_opts()` as follows:
-
-```{r}
-obs_scale <- list(mean = 0.4, sd = 0.01)
-```
-
-To run the inference framework with this observation process, we add `obs = obs_opts(scale = obs_scale)` to the input arguments of `epinow()`:
-
-```{r, message = FALSE, eval = TRUE}
-obs_scale <- list(mean = 0.4, sd = 0.01)
-reported_cases <- cases[1:90, ]
-estimates <- epinow(
- reported_cases = reported_cases,
- generation_time = generation_time_opts(generation_time_fixed),
- delays = delay_opts(incubation_period_fixed + reporting_delay_fixed),
- rt = rt_opts(prior = list(mean = rt_log_mean, sd = rt_log_sd)),
- obs = obs_opts(scale = obs_scale)
-)
-summary(estimates)
-```
-
-
-The estimates of transmission measures such as the effective reproduction number and rate of growth are similar (or the same in value) compared to when we didn't account for incomplete observations (see previous tutorial). However the number of new confirmed cases by infection date has changed substantially in magnitude to reflect the assumption that only 40% of cases are in the data set.
-
-We can also change the default distribution from Negative Binomial to Poisson, remove the default week effect and more. See `?EpiNow2::obs_opts` for more detail.
-
-
-## Forecast secondary observations
-
-`EpiNow2` also has the ability to estimate and forecast secondary observations e.g. deaths, hospitalisations from a primary observation e.g. cases. Here we will illustrate how to forecast the number of deaths arising from observed cases of COVID-19 in the early stages of the UK outbreak.
-
-First, we must format our data to have the following columns:
-
-+ `date` : the date (as a date object see `?is.Date()`),
-+ `primary` : number of primary observations on that date, in this example **cases**,
-+ `secondary` : number of secondary observations date, in this example **deaths**.
-
-```{r}
-reported_cases_deaths <- aggregate(
- cbind(cases_new, deaths_new) ~ date,
- data =
- incidence2::covidregionaldataUK[, c("date", "cases_new", "deaths_new")],
- FUN = sum
-)
-colnames(reported_cases_deaths) <- c("date", "primary", "secondary")
-```
-
-
-Using the first 30 days of data on cases and deaths, we will estimate the relationship between the primary and secondary observations using `estimate_secondary()`, then forecast future deaths using `forecast_secondary()`. For detail on the model see the [model documentation](https://epiforecasts.io/EpiNow2/dev/articles/estimate_secondary.html).
-
-We must specify the type of observation using `type` in `secondary_opts()`, options include:
-
-+ "incidence" : secondary observations arise from previous primary observations, i.e. deaths arising from recorded cases.
-+ "prevalence" : secondary observations arise from a combination current primary observations and past secondary observations, i.e. hospital bed usage arising from current hospital admissions and past hospital bed usage.
-
-In this example we specify `secondary_opts(type = "incidence")`. See `?EpiNow2::secondary_opts` for more detail).
-
-The final key input is the delay distribution between the primary and secondary observations. Here this is the delay between case report and death, we assume this follows a gamma distribution with mean of 14 days and standard deviation of 5 days. Using `dist_spec()` we specify a fixed gamma distribution.
-
-There are further function inputs to `estimate_secondary()` which can be specified, including adding an observation process, see `?EpiNow2::estimate_secondary` for detail on the options.
-
-To find the model fit between cases and deaths :
-```{r}
-estimate_cases_to_deaths <- estimate_secondary(
- reports = reported_cases_deaths[1:30, ],
- secondary = secondary_opts(type = "incidence"),
- delays = delay_opts(dist_spec(
- mean = 14, sd = 5,
- max = 30, distribution = "gamma"
- ))
-)
-```
-
-
-::::::::::::::::::::::::::::::::::::: callout
-### Be cautious of timescale
-
-In the early stages of an outbreak there can be substantial changes in testing and reporting. If there are testing changes from one month to another, then there will be a bias in the model fit. Therefore, you should be cautious of the time-scale of data used in the model fit and forecast.
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-We plot the model fit (shaded ribbons) with the secondary observations (bar plot) and primary observations (dotted line) as follows:
-
-```{r}
-plot(estimate_cases_to_deaths, primary = TRUE)
-```
-
-To use this model fit to forecast deaths, we pass a data frame consisting of the primary observation (cases) for dates not used in the model fit.
-
-*Note : in this tutorial we are using data where we know the deaths and cases, so we create a data frame by extracting the cases. But in practice, this would be a different data set consisting of cases only.*
-```{r}
-cases_to_forecast <- reported_cases_deaths[31:60, c("date", "primary")]
-colnames(cases_to_forecast) <- c("date", "value")
-```
-
-To forecast, we use the model fit `estimate_cases_to_deaths`:
-
-```{r}
-deaths_forecast <- forecast_secondary(
- estimate = estimate_cases_to_deaths,
- primary = cases_to_forecast
-)
-plot(deaths_forecast)
-```
-
-The plot shows the forecast secondary observations (deaths) over the dates which we have recorded cases for.
-It is also possible to forecast deaths using forecast cases, here you would specify `primary` as the `estimates` output from `estimate_infections()`.
-
-
-## Challenge : Ebola outbreak analysis
-
-::::::::::::::::::::::::::::::::::::: challenge
-
-Download the file [ebola_cases.csv](data/ebola_cases.csv) and read it into R. The simulated data consists of the date of symptom onset and number of confirmed cases of the early stages of the Ebola outbreak in Sierra Leone in 2014.
-
-Using the first 3 months (120 days) of data:
-
-1. Estimate of cases increasing or decreasing on day 120 of the outbreak (Hint: Find the effective reproduction number and growth rate on day 120)
-2. Create a two week forecast of number of cases
-
-You can use the following parameter values for the delay distribution(s) and generation time distribution.
-
-+ Incubation period : Log normal$(2.487,0.330)$ ([Eichner et al. 2011](https://doi.org/10.1016/j.phrp.2011.04.001) via `{epiparameter}`)
-+ Generation time : Gamma$(15.3, 10.1)$ ([WHO Ebola Response Team 2014](https://www.nejm.org/doi/full/10.1056/NEJMoa1411100))
-
-You may include some uncertainty around the mean and standard deviation of these distributions.
-
-::::::::::::::::: hint
-
-### HINT : data format
-
-Ensure the data is in the correct format :
-
-+ `date` : the date (as a date object see `?is.Date()`),
-+ `confirm` : number of confirmed cases on that date.
-
-
-::::::::::::::::::::::
-
-
-::::::::::::::::: solution
-
-### SOLUTION
-
-To estimate the effective reproduction number and growth rate, we will use the function `epinow()`.
-
-As the data consists of date of symptom onset, we only need to specify a delay distribution for the incubation period and the generation time.
-
-We specify the distributions with some uncertainty around the mean and standard deviation of the log normal distribution for the incubation period and the Gamma distribution for the generation time.
-
-```{r,eval=TRUE,echo=TRUE}
-ebola_incubation_period <- dist_spec(
- mean = 2.487, sd = 0.330,
- mean_sd = 0.5, sd_sd = 0.5,
- max = 20, distribution = "lognormal"
-)
-
-ebola_generation_time <- dist_spec(
- mean = 15.3, sd = 10.1,
- mean_sd = 0.5, sd_sd = 0.5,
- max = 30, distribution = "gamma"
-)
-```
-
-As we want to also create a two week forecast, we specify `horizon = 14` to forecast 14 days instead of the default 7 days.
-
-```{r, eval=TRUE,echo=FALSE}
-# read data from the tutorial repository R project
-ebola_cases <-
- read.csv(file.path("data", "ebola_cases.csv"))
-```
-
-```{r,eval=FALSE,echo=TRUE}
-# read data
-# e.g.: if path to file is data/raw-data/ebola_cases.csv then:
-ebola_cases <-
- read.csv(here::here("data", "raw-data", "ebola_cases.csv"))
-```
-
-```{r,eval=TRUE,echo=TRUE, message = FALSE}
-# format date column
-ebola_cases$date <- as.Date(ebola_cases$date)
-
-ebola_estimates <- epinow(
- reported_cases = ebola_cases[1:120, ], # first 3 months of data only
- generation_time = generation_time_opts(ebola_generation_time),
- delays = delay_opts(ebola_incubation_period),
- # horizon needs to be 14 days to create two week forecast (default is 7 days)
- horizon = 14
-)
-
-summary(ebola_estimates)
-```
-
-The effective reproduction number $R_t$ estimate (on the last date of the data) is `r summary(ebola_estimates)[measure=="Effective reproduction no."]$estimate`. The exponential growth rate of case numbers is `r summary(ebola_estimates)[measure=="Rate of growth"]$estimate`.
-
-Visualize the estimates:
-
-```{r,eval=FALSE,echo=TRUE}
-plot(ebola_estimates)
-```
-
-:::::::::::::::::::::::::::
-
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-## Summary
-
-`EpiNow2` can be used to create short term forecasts and to estimate the relationship between different outcomes. There are a range of model options that can be implemented for different analysis, including adding an observational process to account for incomplete reporting. See the [vignette](https://epiforecasts.io/EpiNow2/dev/articles/estimate_infections_options.html) for more details on different model options in `EpiNow2` that aren't covered in these tutorials.
-
-
-::::::::::::::::::::::::::::::::::::: keypoints
-
-- We can create short-term forecasts by making assumptions about the future behaviour of the reproduction number
-- Incomplete case reporting can be accounted for in estimates
-
-
-::::::::::::::::::::::::::::::::::::::::::::::::
diff --git a/episodes/fig/disease-reporting.jpg b/episodes/fig/disease-reporting.jpg
deleted file mode 100644
index 709b07ad..00000000
Binary files a/episodes/fig/disease-reporting.jpg and /dev/null differ
diff --git a/episodes/fig/distribution-zoo.png b/episodes/fig/distribution-zoo.png
new file mode 100644
index 00000000..312dc5e0
Binary files /dev/null and b/episodes/fig/distribution-zoo.png differ
diff --git a/episodes/fig/fig5a-normaldistribution.png b/episodes/fig/fig5a-normaldistribution.png
deleted file mode 100644
index c6bcbb86..00000000
Binary files a/episodes/fig/fig5a-normaldistribution.png and /dev/null differ
diff --git a/episodes/fig/generation-time-gr2_lrg.jpg b/episodes/fig/generation-time-gr2_lrg.jpg
new file mode 100644
index 00000000..0c2962ec
Binary files /dev/null and b/episodes/fig/generation-time-gr2_lrg.jpg differ
diff --git a/episodes/fig/incubation-period-serial-interval.jpg b/episodes/fig/incubation-period-serial-interval.jpg
deleted file mode 100644
index 896c7e92..00000000
Binary files a/episodes/fig/incubation-period-serial-interval.jpg and /dev/null differ
diff --git a/episodes/fig/infectiousness-covid19.jpg b/episodes/fig/infectiousness-covid19.jpg
deleted file mode 100644
index 48385dce..00000000
Binary files a/episodes/fig/infectiousness-covid19.jpg and /dev/null differ
diff --git a/episodes/fig/pkgs-hexlogos-2.png b/episodes/fig/pkgs-hexlogos-2.png
new file mode 100644
index 00000000..8390cf89
Binary files /dev/null and b/episodes/fig/pkgs-hexlogos-2.png differ
diff --git a/episodes/fig/reproduction-generation-time.png b/episodes/fig/reproduction-generation-time.png
deleted file mode 100644
index 06b3978f..00000000
Binary files a/episodes/fig/reproduction-generation-time.png and /dev/null differ
diff --git a/episodes/fig/reproduction-number-pre-symptomatic.png b/episodes/fig/reproduction-number-pre-symptomatic.png
deleted file mode 100644
index 379580ab..00000000
Binary files a/episodes/fig/reproduction-number-pre-symptomatic.png and /dev/null differ
diff --git a/episodes/fig/rt-adjusting-delays.png b/episodes/fig/rt-adjusting-delays.png
deleted file mode 100644
index 7d1e19c1..00000000
Binary files a/episodes/fig/rt-adjusting-delays.png and /dev/null differ
diff --git a/episodes/fig/seria-interval-fitted-distributions.jpg b/episodes/fig/seria-interval-fitted-distributions.jpg
deleted file mode 100644
index 58138c55..00000000
Binary files a/episodes/fig/seria-interval-fitted-distributions.jpg and /dev/null differ
diff --git a/episodes/fig/serial-interval-covid-sars.jpg b/episodes/fig/serial-interval-covid-sars.jpg
deleted file mode 100644
index e76bc073..00000000
Binary files a/episodes/fig/serial-interval-covid-sars.jpg and /dev/null differ
diff --git a/episodes/fig/serial-interval-observed.jpeg b/episodes/fig/serial-interval-observed.jpeg
deleted file mode 100644
index acec2e44..00000000
Binary files a/episodes/fig/serial-interval-observed.jpeg and /dev/null differ
diff --git a/episodes/fig/serial-interval-pairs.jpg b/episodes/fig/serial-interval-pairs.jpg
deleted file mode 100644
index c6f4fd5a..00000000
Binary files a/episodes/fig/serial-interval-pairs.jpg and /dev/null differ
diff --git a/episodes/fig/time-periods.jpg b/episodes/fig/time-periods.jpg
deleted file mode 100644
index 63ef3b0b..00000000
Binary files a/episodes/fig/time-periods.jpg and /dev/null differ
diff --git a/episodes/introduction.Rmd b/episodes/introduction.Rmd
index bf059f68..881f7b21 100644
--- a/episodes/introduction.Rmd
+++ b/episodes/introduction.Rmd
@@ -81,23 +81,39 @@ example_confirmed
### Then, set the generation time
-Not all primary cases have the same probability of generating a secondary case. The onset and cessation of [infectiousness](../learners/reference.md#infectiousness) may occur gradually. For `{EpiNow2}`, we can specify it as a probability `distribution` with `mean`, standard deviation `sd`, and maximum value `max`:
+Not all primary cases have the same probability of generating a secondary case. The onset and cessation of [infectiousness](../learners/reference.md#infectiousness) may occur gradually.
+
+For `{EpiNow2}`, we can specify it as a probability `distribution` adding its `mean`, standard deviation (`sd`), and maximum value (`max`). To specify a generation time that follows a _Gamma_ distribution with mean $\mu = 4$, standard deviation $\sigma^2 = 2$, and a maximum value of 20, we write:
```{r}
generation_time <- dist_spec(
- mean = 3.6,
- sd = 3.1,
+ mean = 4,
+ sd = 2,
max = 20,
- distribution = "lognormal"
+ distribution = "gamma"
)
```
-### Let's calculate the reproduction number!
+:::::::::::::::::::::::::::: instructor
+
+As an example, we can show a generation time distribution from [Manica et al., 2022](https://www.thelancet.com/journals/lanepe/article/PIIS2666-7762%2822%2900140-5/fulltext#gr2)
+
+![Manica et al. (2022) estimated a mean intrinsic generation time of 6.84 days (95% credible intervals, CrI, 5.72–8.60), and a mean realized household generation time of 3.59 days (95%CrI: 3.55–3.60)](fig/generation-time-gr2_lrg.jpg)
+
+We can show the a figure from the [Distribution Zoo](https://ben18785.shinyapps.io/distribution-zoo/).
+
+A _Gamma_ distribution with summary statistics of mean $\mu = 4$ and standard deviation $\sigma^2 = 2$, is equivalent to the distribution parameters of $shape = 4$ and $scale = 1$ ($rate = 1/shape$).
+
+![](fig/distribution-zoo.png)
-In the `epinow()` function we can add:
+::::::::::::::::::::::::::::
-- the `reported_cases` data frame,
-- the `generation_time` delay distribution, and
+### Now, let's calculate the reproduction number!
+
+In the `epinow()` function we can input these two elements:
+
+- the `reported_cases` data frame, and
+- the `generation_time` delay distribution, plus
- the computation `stan` parameters for this calculation:
```{r,message=FALSE,warning=FALSE}
@@ -107,10 +123,7 @@ epinow_estimates <- epinow(
# delays
generation_time = generation_time_opts(generation_time),
# computation
- stan = stan_opts(
- cores = 4, samples = 1000, chains = 3,
- control = list(adapt_delta = 0.99)
- )
+ stan = stan_opts(cores = 4, samples = 1000)
)
```
@@ -124,7 +137,9 @@ base::plot(epinow_estimates)
### Is this $Rt$ estimation biased?
-Review [Gostic et al., 2020](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1008409) about what additional adjustments this estimation requires to avoid false precision in $Rt$.
+In the following episodes we are going to explore how to improve this initial estimate like adjusting by delays or incomplete observations.
+
+In the meanwhile, we recommend you to review [Gostic et al., 2020](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1008409) on "Practical considerations for measuring the effective reproductive number, $Rt$" to avoid false precision in our reported $Rt$ estimates.
:::::::::::::::::::::::::
@@ -168,6 +183,13 @@ Our plan for these tutorials is to introduce key solutions from packages in all
- Lastly, we will use _Quantify transmission_ data outputs to compare it to other indicators and simulate epidemic scenarios as part of the __Late tasks__. This includes `{finalsize}`, `{epidemics}`, and `{scenarios}`.
+::::::::::::::::::::::::::::::: checklist
+
+### let's start!
+
+Lets start our learning path with the [Early Task Tutorials](https://epiverse-trace.github.io/tutorials-early/)!
+
+:::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::: keypoints
diff --git a/episodes/model-choices.Rmd b/episodes/model-choices.Rmd
deleted file mode 100644
index 4a60e366..00000000
--- a/episodes/model-choices.Rmd
+++ /dev/null
@@ -1,418 +0,0 @@
----
-title: 'Choosing an appropriate model'
-teaching: 10 # teaching time in minutes
-exercises: 20 # exercise time in minutes
-
----
-
-```{r setup, echo = FALSE, message = FALSE, warning = FALSE}
-library(epidemics)
-library(dplyr)
-library(ggplot2)
-```
-
-:::::::::::::::::::::::::::::::::::::: questions
-
-- How do I choose a mathematical model that's appropriate to complete my analytical task?
-
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-::::::::::::::::::::::::::::::::::::: objectives
-
-- Understand the model requirements for a specific research question
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-::::::::::::::::::::::::::::::::::::: prereq
-
-## Prerequisites
-+ Complete tutorial [Simulating transmission](../episodes/simulating-transmission.md)
-:::::::::::::::::::::::::::::::::
-
-
-## Introduction
-
-There are existing mathematical models for different infections, interventions and transmission patterns which can be used to answer new questions. In this tutorial, we will learn how to choose an existing model to complete a given task.
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: instructor
-
-The focus of this tutorial is understanding existing models to decide if they are appropriate for a defined question.
-
-::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-::::::::::::::::::::::::::::::::::::::: discussion
-
-### Choosing a model
-
-When deciding which mathematical model to use, there are a number of questions we must consider :
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::
-
-:::::::::::::::: solution
-
-### What is the infection/disease of interest?
-
-A model may already exist for your study disease, or there may be a model for an infection that has the same transmission pathways and epidemiological features that can be used.
-
-:::::::::::::::::::::::::
-
-:::::::::::::::: solution
-
-### Do we need a [deterministic](../learners/reference.md#deterministic) or [stochastic](../learners/reference.md#stochastic) model?
-
-Model structures differ for whether the disease has pandemic potential or not. When predicted numbers of infection are small, stochastic variation in output can have an effect on whether an outbreak takes off or not. Outbreaks are usually smaller in magnitude than epidemics, so its often appropriate to use a stochastic model to characterise the uncertainty in the early stages of the outbreak. Epidemics are larger in magnitude than outbreaks and so a deterministic model is suitable as we have less interest in the stochastic variation in output.
-
-:::::::::::::::::::::::::
-
-:::::::::::::::: solution
-
-## What is the outcome of interest?
-
-The outcome of interest can be a feature of a mathematical model. It may be that you are interested in the predicted numbers of infection through time, or in a specific outcome such as hospitalisations or cases of severe disease.
-
-:::::::::::::::::::::::::
-
-:::::::::::::::: solution
-
-## How is transmission modelled?
-
-For example, [direct](../learners/reference.md#direct) or [indirect](../learners/reference.md#indirect), [airborne](../learners/reference.md#airborne) or [vector-borne](../learners/reference.md#vectorborne).
-:::::::::::::::::::::::::
-
-
-:::::::::::::::: solution
-
-## How are the different processes (e.g. transmission) formulated in the equations?
-
-There can be subtle differences in model structures for the same infection or outbreak type which can be missed without studying the equations. For example, transmissibility parameters can be specified as rates or probabilities. If you want to use parameter values from other published models, you must check that transmission is formulated in the same way.
-:::::::::::::::::::::::::
-
-:::::::::::::::: solution
-
-## Will any interventions be modelled?
-
-Finally, interventions such as vaccination may be of interest. A model may or may not have the capability to include the impact of different interventions on different time scales (continuous time or at discrete time points). We discuss interventions in detail in the tutorial [Modelling interventions](../episodes/modelling-interventions.md).
-
-:::::::::::::::::::::::::
-
-
-
-
-
-
-## Available models in `epidemics`
-
-The R package `epidemics` contains functions to run existing models.
-For details on the models that are available, see the package [vignettes](https://epiverse-trace.github.io/epidemics/articles). To learn how to run the models in R, read the documentation using `?epidemics::model_ebola_r`.
-
-
-::::::::::::::::::::::::::::::::::::: challenge
-
-## What model?
-
-You have been asked to explore the variation in numbers of infectious individuals in the early stages of an Ebola outbreak.
-
-Which of the following models would be an appropriate choice for this task:
-
-+ `model_default_cpp()`
-
-+ `model_ebola_r()`
-
-::::::::::::::::: hint
-
-### HINT
-
-Consider the following questions:
-
-::::::::::::::::::::::::::::::::::::: checklist
-
-+ What is the infection/disease of interest?
-+ Do we need a deterministic or stochastic model?
-+ What is the outcome of interest?
-+ Will any interventions be modelled?
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-
-::::::::::::::::::::::
-
-
-::::::::::::::::: solution
-
-### SOLUTION
-
-
-+ What is the infection/disease of interest? **Ebola**
-+ Do we need a deterministic or stochastic model? **A stochastic model would allow us to explore variation in the early stages of the outbreak**
-+ What is the outcome of interest? **Number of infections**
-+ Will any interventions be modelled? **No**
-
-#### `model_default_cpp()`
-
-A deterministic SEIR model with age specific direct transmission.
-
-```{r diagram, echo = FALSE, message = FALSE}
-DiagrammeR::grViz("digraph {
-
- # graph statement
- #################
- graph [layout = dot,
- rankdir = LR,
- overlap = true,
- fontsize = 10]
-
- # nodes
- #######
- node [shape = square,
- fixedsize = true
- width = 1.3]
-
- S
- E
- I
- R
-
- # edges
- #######
- S -> E [label = ' infection \n(transmissibility β)']
- E -> I [label = ' onset of infectiousness \n(infectiousness rate α)']
- I -> R [label = ' recovery \n(recovery rate γ)']
-
-}")
-```
-
-
-The model is capable of predicting an Ebola type outbreak, but as the model is deterministic, we are not able to explore stochastic variation in the early stages of the outbreak.
-
-
-#### `model_ebola_r()`
-
-A stochastic SEIHFR (Susceptible, Exposed, Infectious, Hospitalised, Funeral, Removed) model that was developed specifically for infection with Ebola. The model has stochasticity in the passage times between states, which are modelled as Erlang distributions.
-
-The key parameters affecting the transition between states are:
-
-+ $R_0$, the basic reproduction number,
-+ $\rho^I$, the mean infectious period,
-+ $\rho^E$, the mean preinfectious period,
-+ $p_{hosp}$ the probability of being transferred to the hospitalised compartment.
-
-**Note: the functional relationship between the preinfectious period ($\rho^E$) and the transition rate between exposed and infectious ($\gamma^E$) is $\rho^E = k^E/\gamma^E$ where $k^E$ is the shape of the Erlang distribution. Similarly for the infectious period $\rho^I = k^I/\gamma^I$. See [here](https://epiverse-trace.github.io/epidemics/articles/ebola_model.html#details-discrete-time-ebola-virus-disease-model) for more detail on the stochastic model formulation. **
-
-```{r, echo = FALSE, message = FALSE}
-DiagrammeR::grViz("digraph {
-
- # graph statement
- #################
- graph [layout = dot,
- rankdir = LR,
- overlap = true,
- fontsize = 10]
-
- # nodes
- #######
- node [shape = square,
- fixedsize = true
- width = 1.3]
-
- S
- E
- I
- H
- F
- R
-
- # edges
- #######
- S -> E [label = ' infection (β)']
- E -> I [label = ' onset of \ninfectiousness (γ E)']
- I -> F [label = ' death (funeral) \n(γ I)']
- F -> R [label = ' safe burial (one timestep) ']
- I -> H [label = ' hospitalisation (p hosp)']
- H -> R [label = ' recovery or safe burial \n (γ I)']
-
- subgraph {
- rank = same; I; F;
- }
- subgraph {
- rank = same; H; R;
- }
-}")
-```
-
-The model has additional parameters describing the transmission risk in hospital and funeral settings:
-
-+ $p_{ETU}$, the proportion of hospitalised cases contributing to the infection of susceptibles (ETU = Ebola virus treatment units),
-+ $p_{funeral}$, the proportion of funerals at which the risk of transmission is the same as of infectious individuals in the community.
-
-As this model is stochastic, it is the most appropriate choice to explore how variation in numbers of infected individuals in the early stages of an Ebola outbreak.
-
-
-:::::::::::::::::::::::::::
-
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-
-## Challenge : Ebola outbreak analysis
-
-
-
-::::::::::::::::::::::::::::::::::::: challenge
-
-## Running the model
-
-You have been tasked to generate initial trajectories of an Ebola outbreak in Guinea. Using `model_ebola_r()` and the the information detailed below, complete the following tasks:
-
-1. Run the model once and plot the number of infectious individuals through time
-2. Run model 100 times and plot the mean, upper and lower 95% quantiles of the number of infectious individuals through time
-
-+ Population size : 14 million
-+ Initial number of exposed individuals : 10
-+ Initial number of infectious individuals : 5
-+ Time of simulation : 120 days
-+ Parameter values :
- + $R_0$ (`r0`) = 1.1,
- + $p^I$ (`infectious_period`) = 12,
- + $p^E$ (`preinfectious_period`) = 5,
- + $k^E=k^I = 2$,
- + $1-p_{hosp}$ (`prop_community`) = 0.9,
- + $p_{ETU}$ (`etu_risk`) = 0.7,
- + $p_{funeral}$ (`funeral_risk`) = 0.5
-
-::::::::::::::::: hint
-
-### Code for initial conditions
-
-```{r}
-# set population size
-population_size <- 14e6
-
-E0 <- 10
-I0 <- 5
-# prepare initial conditions as proportions
-initial_conditions <- c(
- S = population_size - (E0 + I0), E = E0, I = I0, H = 0, F = 0, R = 0
-) / population_size
-
-guinea_population <- population(
- name = "Guinea",
- contact_matrix = matrix(1), # note dummy value
- demography_vector = population_size, # 14 million, no age groups
- initial_conditions = matrix(
- initial_conditions,
- nrow = 1
- )
-)
-```
-
-
-::::::::::::::::::::::
-
-
-::::::::::::::::: hint
-
-### HINT : Multiple model simulations
-
-Adapt the code from the [accounting for uncertainty](../episodes/simulating-transmission.md#accounting-for-uncertainty) section
-
-::::::::::::::::::::::
-
-::::::::::::::::: solution
-
-### SOLUTION
-
-1. Run the model once and plot the number of infectious individuals through time
-
-
-```{r}
-output <- model_ebola_r(
- population = guinea_population,
- transmissibility = 1.1 / 12,
- infectiousness_rate = 2.0 / 5,
- removal_rate = 2.0 / 12,
- prop_community = 0.9,
- etu_risk = 0.7,
- funeral_risk = 0.5,
- time_end = 100
-)
-
-ggplot(output[output$compartment == "infectious", ]) +
- geom_line(
- aes(time, value),
- linewidth = 1.2
- ) +
- scale_y_continuous(
- labels = scales::comma
- ) +
- labs(
- x = "Simulation time (days)",
- y = "Individuals"
- ) +
- theme_bw(
- base_size = 15
- )
-```
-
-2. Run model 100 times and plot the mean, upper and lower 95% quantiles of the number of infectious individuals through time
-
-We run the model 100 times with the *same* parameter values.
-
-```{r}
-output_samples <- Map(
- x = seq(100),
- f = function(x) {
- output <- model_ebola_r(
- population = guinea_population,
- transmissibility = 1.1 / 12,
- infectiousness_rate = 2.0 / 5,
- removal_rate = 2.0 / 12,
- prop_community = 0.9,
- etu_risk = 0.7,
- funeral_risk = 0.5,
- time_end = 100
- )
- # add replicate number and return data
- output$replicate <- x
- output
- }
-)
-
-output_samples <- bind_rows(output_samples) # requires the dplyr package
-
-ggplot(
- output_samples[output_samples$compartment == "infectious", ],
- aes(time, value)
-) +
- stat_summary(geom = "line", fun = mean) +
- stat_summary(
- geom = "ribbon",
- fun.min = function(z) {
- quantile(z, 0.025)
- },
- fun.max = function(z) {
- quantile(z, 0.975)
- },
- alpha = 0.3
- ) +
- labs(
- x = "Simulation time (days)",
- y = "Individuals"
- ) +
- theme_bw(
- base_size = 15
- )
-```
-
-:::::::::::::::::::::::::::
-
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-
-
-::::::::::::::::::::::::::::::::::::: keypoints
-
-- Existing mathematical models should be selected according to the research question
-- It is important to check that a model has appropriate assumptions about transmission, outbreak potential, outcomes and interventions
-::::::::::::::::::::::::::::::::::::::::::::::::
diff --git a/episodes/modelling-interventions.Rmd b/episodes/modelling-interventions.Rmd
deleted file mode 100644
index fd035843..00000000
--- a/episodes/modelling-interventions.Rmd
+++ /dev/null
@@ -1,442 +0,0 @@
----
-title: 'Modelling interventions'
-teaching: 45 # teaching time in minutes
-exercises: 30 # exercise time in minutes
-
----
-
-```{r setup, echo= FALSE, message = FALSE, warning = FALSE}
-library(ggplot2)
-library(epidemics)
-```
-
-:::::::::::::::::::::::::::::::::::::: questions
-
-- How do I investigate the effect of interventions on disease trajectories?
-
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-::::::::::::::::::::::::::::::::::::: objectives
-
-- Add pharmaceutical and non-pharmaceutical interventions to an {epidemics} model
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-::::::::::::::::::::::::::::::::::::: prereq
-
-## Prerequisites
-+ Complete tutorial [Simulating transmission](../episodes/simulating-transmission.md)
-
-Learners should familiarise themselves with following concept dependencies before working through this tutorial:
-
-**Outbreak response** : [Intervention types](https://www.cdc.gov/nonpharmaceutical-interventions/).
-:::::::::::::::::::::::::::::::::
-
-
-## Introduction
-
-Mathematical models can be used to generate trajectories of disease spread under the implementation of interventions at different stages of an outbreak. These predictions can be used to make decisions on what interventions could be implemented to slow down the spread of diseases.
-
-We can assume interventions in mathematical models reduce the values of relevant parameters e.g. reduce transmissibility while in place. Or it may be appropriate to assume individuals are classified into a new disease state, e.g. once vaccinated we assume individuals are no longer susceptible to infection and therefore move to a vaccinated state. In this tutorial, we will introduce how to include three different interventions in model of COVID-19 transmission.
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: instructor
-
-In this tutorial different types of intervention and how they can be modelled are introduced. Learners should be able to understand the underlying mechanism of these interventions (e.g. reduce contact rate) as well as how to implement the code to include such interventions.
-
-::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-## Non-pharmaceutical interventions
-
-[Non-pharmaceutical interventions](../learners/reference.md#NPIs) (NPIs) are measures put in place to reduce transmission that do not include the administration of drugs or vaccinations. NPIs aim reduce contact between infectious and susceptible individuals. For example, washing hands, wearing masks and closures of school and workplaces.
-
-We will investigate the effect of interventions on a COVID-19 outbreak using an SEIR model (`model_default_cpp()` in the R package `{epidemics}`). We will set $R_0 = 2.7$, latent period or preinfectious period $= 4$ and the infectious_period $= 5.5$ (parameters adapted from [Davies et al. (2020)](https://doi.org/10.1016/S2468-2667(20)30133-X)). We load a contact matrix with age bins 0-18, 18-65, 65 years and older using `{socialmixr}` and assume that one in every 1 million in each age group is infectious at the start of the epidemic.
-
-```{r model_setup, echo = TRUE, message = FALSE}
-polymod <- socialmixr::polymod
-contact_data <- socialmixr::contact_matrix(
- polymod,
- countries = "United Kingdom",
- age.limits = c(0, 15, 65),
- symmetric = TRUE
-)
-
-# prepare contact matrix
-contact_matrix <- t(contact_data$matrix)
-
-# prepare the demography vector
-demography_vector <- contact_data$demography$population
-names(demography_vector) <- rownames(contact_matrix)
-
-# initial conditions: one in every 1 million is infected
-initial_i <- 1e-6
-initial_conditions <- c(
- S = 1 - initial_i, E = 0, I = initial_i, R = 0, V = 0
-)
-
-# build for all age groups
-initial_conditions <- matrix(
- rep(initial_conditions, dim(contact_matrix)[1]),
- ncol = 5, byrow = TRUE
-)
-rownames(initial_conditions) <- rownames(contact_matrix)
-
-# prepare the population to model as affected by the epidemic
-uk_population <- population(
- name = "UK",
- contact_matrix = contact_matrix,
- demography_vector = demography_vector,
- initial_conditions = initial_conditions
-)
-```
-
-#### Effect of school closures on COVID-19 spread
-
-The first NPI we will consider is the effect of school closures on reducing the number of individuals infectious with COVID-19 through time. We assume that a school closure will reduce the frequency of contacts within and between different age groups. We assume that school closures will reduce the contacts between school aged children (aged 0-15) by 0.5, and will cause a small reduction (0.01) in the contacts between adults (aged 15 and over).
-
-To include an intervention in our model we must create an `intervention` object. The inputs are the name of the intervention (`name`), the type of intervention (`contacts` or `rate`), the start time (`time_begin`), the end time (`time_end`) and the reduction (`reduction`). The values of the reduction matrix are specified in the same order as the age groups in the contact matrix.
-
-```{r}
-rownames(contact_matrix)
-```
-
-Therefore, we specify ` reduction = matrix(c(0.5, 0.01, 0.01))`. We assume that the school closures start on day 50 and are in place for a further 100 days. Therefore our intervention object is :
-
-```{r intervention}
-close_schools <- intervention(
- name = "School closure",
- type = "contacts",
- time_begin = 50,
- time_end = 50 + 100,
- reduction = matrix(c(0.5, 0.01, 0.01))
-)
-```
-
-::::::::::::::::::::::::::::::::::::: callout
-### Effect of interventions on contacts
-
-In `epidemics`, the contact matrix is scaled down by proportions for the period in which the intervention is in place. To understand how the reduction is calculated within the model functions, consider a contact matrix for two age groups with equal number of contacts:
-
-```{r echo = FALSE}
-reduction <- matrix(c(0.5, 0.1))
-contact_matrix_example <- matrix(c(1, 1, 1, 1), nrow = 2)
-contact_matrix_example
-```
-
-If the reduction is 50% in group 1 and 10% in group 2, the contact matrix during the intervention will be:
-
-```{r echo = FALSE}
-contact_matrix_example[1, ] <- contact_matrix_example[1, ] * (1 - reduction[1])
-contact_matrix_example[, 1] <- contact_matrix_example[, 1] * (1 - reduction[1])
-contact_matrix_example[2, ] <- contact_matrix_example[2, ] * (1 - reduction[2])
-contact_matrix_example[, 2] <- contact_matrix_example[, 2] * (1 - reduction[2])
-contact_matrix_example
-```
-
-The contacts within group 1 are reduced by 50% twice to accommodate for a 50% reduction in outgoing and incoming contacts ($1\times 0.5 \times 0.5 = 0.25$). Similarly, the contacts within group 2 are reduced by 10% twice. The contacts between group 1 and group 2 are reduced by 50% and then by 10% ($1 \times 0.5 \times 0.9= 0.45$).
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-Using transmissibility $= 2.7/5.5$ (remember that [transmissibility = $R_0$/ infectious period](../episodes/simulating-transmission.md#the-basic-reproduction-number-r_0)), infectiousness rate $1/= 4$ and the recovery rate $= 1/5.5$ we run the model with` intervention = list(contacts = close_schools)` as follows :
-
-```{r school}
-output_school <- model_default_cpp(
- population = uk_population,
- transmissibility = 2.7 / 5.5,
- infectiousness_rate = 1.0 / 4.0,
- recovery_rate = 1.0 / 5.5,
- intervention = list(contacts = close_schools),
- time_end = 300, increment = 1.0
-)
-```
-
-
-To be able to see the effect of our intervention, we also run the model where there is no intervention, combine the two outputs into one data frame and then plot the output. Here we plot the total number of infectious individuals in all age groups using `ggplot2::stat_summary()`:
-
-```{r baseline, echo = TRUE, fig.width = 10}
-# run baseline simulation with no intervention
-output_baseline <- model_default_cpp(
- population = uk_population,
- transmissibility = 2.7 / 5.5,
- infectiousness_rate = 1.0 / 4.0,
- recovery_rate = 1.0 / 5.5,
- time_end = 300, increment = 1.0
-)
-
-# create intervention_type column for plotting
-output_school$intervention_type <- "school closure"
-output_baseline$intervention_type <- "baseline"
-output <- rbind(output_school, output_baseline)
-
-ggplot(data = output[output$compartment == "infectious", ]) +
- aes(
- x = time,
- y = value,
- color = intervention_type,
- linetype = intervention_type
- ) +
- stat_summary(
- fun = "sum",
- geom = "line",
- linewidth = 1
- ) +
- scale_y_continuous(
- labels = scales::comma
- ) +
- labs(
- x = "Simulation time (days)",
- y = "Individuals"
- ) +
- theme_bw(
- base_size = 15
- ) +
- geom_vline(
- xintercept = c(close_schools$time_begin, close_schools$time_end),
- colour = "black",
- linetype = "dashed",
- linewidth = 0.2
- ) +
- annotate(
- geom = "text",
- label = "Schools closed",
- colour = "black",
- x = (close_schools$time_end - close_schools$time_begin) / 2 +
- close_schools$time_begin,
- y = 10,
- angle = 0,
- vjust = "outward"
- )
-```
-We see that with the intervention in place, the infection still spreads through the population, though the peak number of infectious individuals is smaller than the baseline with no intervention in place (solid line).
-
-
-
-#### Effect of mask wearing on COVID-19 spread
-
-We can model the effect of other NPIs as reducing the value of relevant parameters. For example, we want to investigate the effect of mask wearing on the number of individuals infectious with COVID-19 through time.
-
-We expect that mask wearing will reduce an individual's infectiousness. As we are using a population based model, we cannot make changes to individual behaviour and so assume that the transmissibility $\beta$ is reduced by a proportion due to mask wearing in the population. We specify this proportion, $\theta$ as product of the proportion wearing masks multiplied by the proportion reduction in transmissibility (adapted from [Li et al. 2020](https://doi.org/10.1371/journal.pone.0237691))
-
-We create an intervention object with `type = rate` and `reduction = 0.161`. Using parameters adapted from [Li et al. 2020](https://doi.org/10.1371/journal.pone.0237691) we have proportion wearing masks = coverage $\times$ availability = $0.54 \times 0.525 = 0.2835$, proportion reduction in transmissibility = $0.575$. Therefore, $\theta = 0.2835 \times 0.575 = 0.163$. We assume that the mask wearing mandate starts at day 40 and is in place for 200 days.
-
-```{r masks}
-mask_mandate <- intervention(
- name = "mask mandate",
- type = "rate",
- time_begin = 40,
- time_end = 40 + 200,
- reduction = 0.163
-)
-```
-
-To implement this intervention on the parameter $\beta$, we specify `intervention = list(beta = mask_mandate)`.
-
-```{r output_masks}
-output_masks <- model_default_cpp(
- population = uk_population,
- transmissibility = 2.7 / 5.5,
- infectiousness_rate = 1.0 / 4.0,
- recovery_rate = 1.0 / 5.5,
- intervention = list(transmissibility = mask_mandate),
- time_end = 300, increment = 1.0
-)
-```
-
-
-```{r plot_masks, echo = TRUE, message = FALSE, fig.width = 10}
-# create intervention_type column for plotting
-output_masks$intervention_type <- "mask mandate"
-output_baseline$intervention_type <- "baseline"
-output <- rbind(output_masks, output_baseline)
-
-ggplot(data = output[output$compartment == "infectious", ]) +
- aes(
- x = time,
- y = value,
- color = intervention_type,
- linetype = intervention_type
- ) +
- stat_summary(
- fun = "sum",
- geom = "line",
- linewidth = 1
- ) +
- scale_y_continuous(
- labels = scales::comma
- ) +
- labs(
- x = "Simulation time (days)",
- y = "Individuals"
- ) +
- theme_bw(
- base_size = 15
- ) +
- geom_vline(
- xintercept = c(mask_mandate$time_begin, mask_mandate$time_end),
- colour = "black",
- linetype = "dashed",
- linewidth = 0.2
- ) +
- annotate(
- geom = "text",
- label = "Mask mandate",
- colour = "black",
- x = (mask_mandate$time_end - mask_mandate$time_begin) / 2 +
- mask_mandate$time_begin,
- y = 10,
- angle = 0,
- vjust = "outward"
- )
-```
-
-::::::::::::::::::::::::::::::::::::: callout
-### Intervention types
-
-There are two intervention types for `model_default_cpp()`. Rate interventions on model parameters (`transmissibillity` $\beta$, `infectiousness_rate` $\sigma$ and `recovery_rate` $\gamma$) and contact matrix reductions `contacts`.
-
-To implement both contact and rate interventions in the same simulation they must be passed as a list e.g. `intervention = list(transmissibility = mask_mandate, contacts = close_schools)`. But if there are multiple interventions that target contact rates, these must be passed as one `contacts` input. See the [vignette on modelling overlapping interventions](https://epiverse-trace.github.io/epidemics/articles/multiple_interventions.html) for more detail.
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-
-## Pharmaceutical interventions
-
-Pharmaceutical interventions (PIs) are measures such as vaccination and mass treatment programs. In the previous section, we assumed that interventions reduced the value of parameter values while the intervention was in place. In the case of vaccination, we assume that after the intervention individuals are no longer susceptible and should be classified into a different disease state. Therefore, we specify the rate at which individuals are vaccinated and track the number of vaccinated individuals through time.
-
-The diagram below shows the SEIRV model implemented using `model_default_cpp()` where susceptible individuals are vaccinated and then move to the $V$ class.
-
-```{r diagram_SEIRV, echo = FALSE, message = FALSE}
-DiagrammeR::grViz("digraph {
-
- # graph statement
- #################
- graph [layout = dot,
- rankdir = LR,
- overlap = true,
- fontsize = 10]
-
- # nodes
- #######
- node [shape = square,
- fixedsize = true
- width = 1.3]
-
- S
- E
- I
- R
- V
-
- # edges
- #######
- S -> E [label = ' infection (β)']
- S -> V [label = ' vaccination (ν)']
- E -> I [label = ' onset of \ninfectiousness (α)']
- I -> R [label = ' recovery (γ)']
-
-}")
-```
-
-
-
-The equations describing this model are as follows:
-
-$$
-\begin{aligned}
-\frac{dS_i}{dt} & = - \beta S_i \sum_j C_{i,j} I_j -\nu_{t} S_i \\
-\frac{dE_i}{dt} &= \beta S_i\sum_j C_{i,j} I_j - \alpha E_i \\
-\frac{dI_i}{dt} &= \alpha E_i - \gamma I_i \\
-\frac{dR_i}{dt} &=\gamma I_i \\
-\frac{dV_i}{dt} & =\nu_{i,t} S_i\\
-\end{aligned}
-$$
-Individuals are vaccinated at an age group ($i$) specific time dependent ($t$) vaccination rate ($\nu_{i,t}$). The SEIR components of these equations are described in the tutorial [simulating transmission](../episodes/simulating-transmission.md#simulating-disease-spread).
-
-To explore the effect of vaccination we need to create a vaccination object to pass as an input into `model_default_cpp()` that includes an age groups specific vaccination rate `nu` and age group specific start and end times of the vaccination program (`time_begin` and `time_end`).
-
-Here we will assume all age groups are vaccinated at the same rate 0.01 and that the vaccination program starts on day 40 and is in place for 150 days.
-
-```{r vaccinate}
-# prepare a vaccination object
-vaccinate <- vaccination(
- name = "vaccinate all",
- time_begin = matrix(40, nrow(contact_matrix)),
- time_end = matrix(40 + 150, nrow(contact_matrix)),
- nu = matrix(c(0.01, 0.01, 0.01))
-)
-```
-
-We pass our vaccination object using `vaccination = vaccinate`:
-
-```{r output_vaccinate}
-output_vaccinate <- model_default_cpp(
- population = uk_population,
- transmissibility = 2.7 / 5.5,
- infectiousness_rate = 1.0 / 4.0,
- recovery_rate = 1.0 / 5.5,
- vaccination = vaccinate,
- time_end = 300, increment = 1.0
-)
-```
-
-
-::::::::::::::::::::::::::::::::::::: challenge
-
-## Compare interventions
-
-Plot the three interventions vaccination, school closure and mask mandate and the baseline simulation on one plot. Which intervention reduces the peak number of infectious individuals the most?
-
-
-:::::::::::::::::::::::: solution
-
-## Output
-
-```{r plot_vaccinate, echo = TRUE, message = FALSE, fig.width = 10}
-# create intervention_type column for plotting
-output_vaccinate$intervention_type <- "vaccination"
-output <- rbind(output_school, output_masks, output_vaccinate, output_baseline)
-
-ggplot(data = output[output$compartment == "infectious", ]) +
- aes(
- x = time,
- y = value,
- color = intervention_type,
- linetype = intervention_type
- ) +
- stat_summary(
- fun = "sum",
- geom = "line",
- linewidth = 1
- ) +
- scale_y_continuous(
- labels = scales::comma
- ) +
- labs(
- x = "Simulation time (days)",
- y = "Individuals"
- ) +
- theme_bw(
- base_size = 15
- )
-```
-
-From the plot we see that the peak number of total number of infectious individuals when vaccination is in place is much lower compared to school closures and mask wearing interventions.
-
-:::::::::::::::::::::::::::::::::
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-
-
-
-## Summary
-
-Different types of intervention can be implemented using mathematical modelling. Modelling interventions requires assumptions of which model parameters are affected (e.g. contact matrices, transmissibility), by what magnitude and and what times in the simulation of an outbreak.
-
-The next step is to quantify the effect of an interventions. If you are interested in learning how to compare interventions, please complete the tutorial [Comparing public health outcomes of interventions](../episodes/compare-interventions.md).
-
-::::::::::::::::::::::::::::::::::::: keypoints
-
-- The effect of NPIs can be modelled as reducing contact rates between age groups or reducing the transmissibility of infection
-- Vaccination can be modelled by assuming individuals move to a different disease state $V$
-
-::::::::::::::::::::::::::::::::::::::::::::::::
diff --git a/episodes/quantify-transmissibility.Rmd b/episodes/quantify-transmissibility.Rmd
deleted file mode 100644
index 1ecf1b9a..00000000
--- a/episodes/quantify-transmissibility.Rmd
+++ /dev/null
@@ -1,416 +0,0 @@
----
-title: 'Quantifying transmission'
-teaching: 30
-exercises: 0
----
-
-```{r setup, echo = FALSE, warning = FALSE, message = FALSE}
-library(EpiNow2)
-library(ggplot2)
-withr::local_options(list(mc.cores = 4))
-```
-
-:::::::::::::::::::::::::::::::::::::: questions
-
-- How can I estimate key transmission metrics from a time series of case data?
-- How can I quantify geographical heterogeneity in these metrics?
-
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-::::::::::::::::::::::::::::::::::::: objectives
-
-- Learn how to estimate transmission metrics from a time series of case data using the R package `EpiNow2`
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-::::::::::::::::::::::::::::::::::::: prereq
-
-## Prerequisites
-
-Learners should familiarise themselves with following concept dependencies before working through this tutorial:
-
-**Statistics** : probability distributions, principle of Bayesian analysis.
-
-**Epidemic theory** : Effective reproduction number.
-
-:::::::::::::::::::::::::::::::::
-
-
-
-::::::::::::::::::::::::::::::::::::: callout
-### Reminder: the Effective Reproduction Number, $R_t$
-
-The [basic reproduction number](../learners/reference.md#basic), $R_0$, is the average number of cases caused by one infectious individual in a entirely susceptible population.
-
-But in an ongoing outbreak, the population does not remain entirely susceptible as those that recover from infection are typically immune. Moreover, there can be changes in behaviour or other factors that affect transmission. When we are interested in monitoring changes in transmission we are therefore more interested in the value of the **effective reproduction number**, $R_t$, the average number of cases caused by one infectious individual in the population at time $t$.
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-
-## Introduction
-
-Quantifying transmission metrics at the start of an outbreak can give important information on the strength of transmission (reproduction number) and the speed of transmission ([growth rate](../learners/reference.md#growth), doubling/halving time). To estimate these key metrics using case data we must account for delays between the date of infections and date of reported cases. In an outbreak situation, data are usually available on reported dates only, therefore we must use estimation methods to account for these delays when trying to understand changes in transmission over time.
-
-In the next tutorials we will focus on how to implement the functions in `{EpiNow2}` to estimate transmission metrics of case data. We will not cover the theoretical background of the models or inference framework, for details on these concepts see the [vignette](https://epiforecasts.io/EpiNow2/dev/articles/estimate_infections.html).
-For more details on the distinction between speed and strength of transmission and implications for control, see [Dushoff & Park, 2021](https://royalsocietypublishing.org/doi/full/10.1098/rspb.2020.1556).
-
-
-::::::::::::::::::::::::::::::::::::: callout
-### Bayesian inference
-
-The R package `EpiNow2` uses a [Bayesian inference](../learners/reference.md#bayesian) framework to estimate reproduction numbers and infection times based on reporting dates.
-
-In Bayesian inference, we use prior knowledge (prior distributions) with data (in a likelihood function) to find the posterior probability.
-
-
Posterior probability $\propto$ likelihood $\times$ prior probability
-
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-
-The first step is to load the `{EpiNow2}` package :
-
-```{r, eval = FALSE}
-library(EpiNow2)
-```
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: instructor
-
-This tutorial illustrates the usage of `epinow()` to estimate the time-varying reproduction number and infection times. Learners should understand the necessary inputs to the model and the limitations of the model output.
-
-::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-
-## Delay distributions and case data
-### Case data
-
-To illustrate the functions of `EpiNow2` we will use outbreak data of the start of the COVID-19 pandemic from the United Kingdom. The data are available in the R package `{incidence2}`.
-
-```{r}
-head(incidence2::covidregionaldataUK)
-```
-
-To use the data, we must format the data to have two columns:
-
-+ `date` : the date (as a date object see `?is.Date()`),
-+ `confirm` : number of confirmed cases on that date.
-
-```{r}
-cases <- aggregate(
- cases_new ~ date,
- data = incidence2::covidregionaldataUK[, c("date", "cases_new")],
- FUN = sum
-)
-colnames(cases) <- c("date", "confirm")
-```
-
-
-There are case data available for `r dim(cases)[1]` days, but in an outbreak situation it is likely we would only have access to the beginning of this data set. Therefore we assume we only have the first 90 days of this data.
-
-```{r echo = FALSE}
-ggplot(cases[1:90, ], aes(x = date, y = confirm)) +
- geom_col() +
- theme_grey(
- base_size = 15
- )
-```
-
-
-
-### Delay distributions
-We assume there are delays from the time of infection until the time a case is reported. We specify these delays as distributions to account for the uncertainty in individual level differences. The delay can consist of multiple types of delays/processes. A typical delay from time of infection to case reporting may consist of :
-
-
**time from infection to symptom onset** (the [incubation period](../learners/reference.md#incubation)) + **time from symptom onset to case notification** (the reporting time)
-.
-
-The delay distribution for each of these processes can either estimated from data or obtained from the literature. We can express uncertainty about what the correct parameters of the distributions by assuming the distributions have **fixed** parameters or whether they have **variable** parameters. To understand the difference between **fixed** and **variable** distributions, let's consider the incubation period.
-
-::::::::::::::::::::::::::::::::::::: callout
-### Delays and data
-The number of delays and type of delay is a flexible input that depends on the data. The examples below highlight how the delays can be specified for different data sources:
-
-
-
-| Data source | Delay(s) |
-| ------------- |-------------|
-|Time of case report |Incubation period + time from symptom onset to case notification |
-|Time of hospitalisation |Incubation period + time from symptom onset to hospitalisation |
-|Time of symptom onset |Incubation period |
-
-
-
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-
-
-#### Incubation period distribution
-
-The distribution of incubation period can usually be obtained from the literature. The package `{epiparameter}` contains a library of epidemiological parameters for different diseases obtained from the literature.
-
-We specify a (fixed) gamma distribution with mean $\mu = 4$ and standard deviation $\sigma^2= 2$ (shape = $4$, scale = $1$) using the function `dist_spec()` as follows:
-
-```{r}
-incubation_period_fixed <- dist_spec(
- mean = 4, sd = 2,
- max = 20, distribution = "gamma"
-)
-incubation_period_fixed
-```
-
-The argument `max` is the maximum value the distribution can take, in this example 20 days.
-
-::::::::::::::::::::::::::::::::::::: callout
-### Why a gamma distrubution?
-
-The incubation period has to be positive in value. Therefore we must specific a distribution in `dist_spec` which is for positive values only.
-
-`dist_spec()` supports log normal and gamma distributions, which are distributions for positive values only.
-
-For all types of delay, we will need to use distributions for positive values only - we don't want to include delays of negative days in our analysis!
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-
-
-#### Including distribution uncertainty
-
-To specify a **variable** distribution, we include uncertainty around the mean $\mu$ and standard deviation $\sigma^2$ of our gamma distribution. If our incubation period distribution has a mean $\mu$ and standard deviation $\sigma^2$, then we assume the mean ($\mu$) follows a Normal distribution with standard deviation $\sigma_{\mu}^2$:
-
-$$\mbox{Normal}(\mu,\sigma_{\mu}^2)$$
-
-and a standard deviation ($\sigma^2$) follows a Normal distribution with standard deviation $\sigma_{\sigma^2}^2$:
-
-$$\mbox{Normal}(\sigma^2,\sigma_{\sigma^2}^2).$$
-
-We specify this using `dist_spec` with the additional arguments `mean_sd` ($\sigma_{\mu}^2$) and `sd_sd` ($\sigma_{\sigma^2}^2$).
-
-```{r}
-incubation_period_variable <- dist_spec(
- mean = 4, sd = 2,
- mean_sd = 0.5, sd_sd = 0.5,
- max = 20, distribution = "gamma"
-)
-incubation_period_variable
-```
-
-
-
-#### Reporting delays
-
-After the incubation period, there will be an additional delay of time from symptom onset to case notification: the reporting delay. We can specify this as a fixed or variable distribution, or estimate a distribution from data.
-
-When specifying a distribution, it is useful to visualise the probability density to see the peak and spread of the distribution, in this case we will use a log normal distribution. We can use the functions `convert_to_logmean()` and `convert_to_logsd()` to convert the mean and standard deviation of a normal distribution to that of a log normal distribution.
-
-If we want to assume that the mean reporting delay is 2 days (with a standard deviation of 1 day), the log normal distribution will look like:
-
-```{r}
-log_mean <- convert_to_logmean(2, 1)
-log_sd <- convert_to_logsd(2, 1)
-x <- seq(from = 0, to = 10, length = 1000)
-df <- data.frame(x = x, density = dlnorm(x, meanlog = log_mean, sdlog = log_sd))
-ggplot(df) +
- geom_line(
- aes(x, density)
- ) +
- theme_grey(
- base_size = 15
- )
-```
-
-Using the mean and standard deviation for the log normal distribution, we can specify a fixed or variable distribution using `dist_spec()` as before:
-
-```{r}
-reporting_delay_variable <- dist_spec(
- mean = log_mean, sd = log_sd,
- mean_sd = 0.5, sd_sd = 0.5,
- max = 10, distribution = "lognormal"
-)
-```
-
-If data is available on the time between symptom onset and reporting, we can use the function `estimate_delay()` to estimate a log normal distribution from a vector of delays. The code below illustrates how to use `estimate_delay()` with synthetic delay data.
-
-```{r, eval = FALSE }
-delay_data <- rlnorm(500, log(5), 1) # synthetic delay data
-reporting_delay <- estimate_delay(
- delay_data,
- samples = 1000,
- bootstraps = 10
-)
-```
-
-
-#### Generation time
-
-We also must specify a distribution for the generation time. Here we will use a log normal distribution with mean 3.6 and standard deviation 3.1 ([Ganyani et al. 2020](https://doi.org/10.2807/1560-7917.ES.2020.25.17.2000257)).
-
-
-```{r}
-generation_time_variable <- dist_spec(
- mean = 3.6, sd = 3.1,
- mean_sd = 0.5, sd_sd = 0.5,
- max = 20, distribution = "lognormal"
-)
-```
-
-
-## Finding estimates
-
-The function `epinow()` is a wrapper for the function `estimate_infections()` used to estimate cases by date of infection. The generation time distribution and delay distributions must be passed using the functions ` generation_time_opts()` and `delay_opts()` respectively.
-
-There are numerous other inputs that can be passed to `epinow()`, see `EpiNow2::?epinow()` for more detail.
-One optional input is to specify a log normal prior for the effective reproduction number $R_t$ at the start of the outbreak. We specify a mean and standard deviation as arguments of `prior` within `rt_opts()`:
-
-```{r, eval = FALSE}
-rt_log_mean <- convert_to_logmean(2, 1)
-rt_log_sd <- convert_to_logsd(2, 1)
-rt <- rt_opts(prior = list(mean = rt_log_mean, sd = rt_log_sd))
-```
-
-::::::::::::::::::::::::::::::::::::: callout
-### Bayesian inference using Stan
-
-The Bayesian inference is performed using MCMC methods with the program [Stan](https://mc-stan.org/). There are a number of default inputs to the Stan functions including the number of chains and number of samples per chain (see `?EpiNow2::stan_opts()`).
-
-To reduce computation time, we can run chains in parallel. To do this, we must set the number of cores to be used. By default, 4 MCMC chains are run (see `stan_opts()$chains`), so we can set an equal number of cores to be used in parallel as follows:
-
-```{r}
-withr::local_options(list(mc.cores = 4))
-```
-
-To find the maximum number of available cores on your machine, use `parallel::detectCores()`.
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-```{r, echo = FALSE}
-rt_log_mean <- convert_to_logmean(2, 1)
-rt_log_sd <- convert_to_logsd(2, 1)
-
-incubation_period_fixed <- dist_spec(
- mean = 4, sd = 2,
- max = 20, distribution = "gamma"
-)
-
-log_mean <- convert_to_logmean(2, 1)
-log_sd <- convert_to_logsd(2, 1)
-reporting_delay_fixed <- dist_spec(
- mean = log_mean, sd = log_sd,
- max = 10, distribution = "lognormal"
-)
-
-generation_time_fixed <- dist_spec(
- mean = 3.6, sd = 3.1,
- max = 20, distribution = "lognormal"
-)
-```
-
-*Note : in the code below fixed distributions are used instead of variable. This is to speed up computation time. It is generally recommended to use variable distributions that account for additional uncertainty.*
-
-```{r, message = FALSE, eval = TRUE}
-reported_cases <- cases[1:90, ]
-estimates <- epinow(
- reported_cases = reported_cases,
- generation_time = generation_time_opts(generation_time_fixed),
- delays = delay_opts(incubation_period_fixed + reporting_delay_fixed),
- rt = rt_opts(prior = list(mean = rt_log_mean, sd = rt_log_sd))
-)
-```
-
-### Results
-
-We can extract and visualise estimates of the effective reproduction number through time:
-
-```{r}
-estimates$plots$R
-```
-
-The uncertainty in the estimates increases through time. This is because estimates are informed by data in the past - within the delay periods. This difference in uncertainty is categorised into **Estimate** (green) utilises all data and **Estimate based on partial data** (orange) estimates that are based on less data (because infections that happened at the time are more likely to not have been observed yet) and therefore have increasingly wider intervals towards the date of the last data point. Finally, the **Forecast** (purple) is a projection ahead of time.
-
-We can also visualise the growth rate estimate through time:
-```{r}
-estimates$plots$growth_rate
-```
-
-To extract a summary of the key transmission metrics at the *latest date* in the data:
-
-```{r}
-summary(estimates)
-```
-
-As these estimates are based on partial data, they have a wide uncertainty interval.
-
-+ From the summary of our analysis we see that the expected change in daily cases is `r summary(estimates)$estimate[summary(estimates)$measure=="Expected change in daily cases"]` with the estimated new confirmed cases `r summary(estimates)$estimate[summary(estimates)$measure=="New confirmed cases by infection date"]`.
-
-+ The effective reproduction number $R_t$ estimate (on the last date of the data) is `r summary(estimates)$estimate[summary(estimates)$measure=="Effective reproduction no."]`.
-
-+ The exponential growth rate of case numbers is `r summary(estimates)$estimate[summary(estimates)$measure=="Rate of growth"]`.
-
-+ The doubling time (the time taken for case numbers to double) is `r summary(estimates)$estimate[summary(estimates)$measure=="Doubling/halving time (days)"]`.
-
-::::::::::::::::::::::::::::::::::::: callout
-### `Expected change in daily cases`
-
-A factor describing expected change in daily cases based on the posterior probability that $R_t < 1$.
-
-
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-
-
-
-## Quantify geographical heterogeneity
-
-The outbreak data of the start of the COVID-19 pandemic from the United Kingdom from the R package `{incidence2}` includes the region in which the cases were recorded. To find regional estimates of the effective reproduction number and cases, we must format the data to have three columns:
-
-+ `date` : the date,
-+ `region` : the region,
-+ `confirm` : number of confirmed cases for a region on a given date.
-
-```{r}
-regional_cases <-
- incidence2::covidregionaldataUK[, c("date", "cases_new", "region")]
-colnames(regional_cases) <- c("date", "confirm", "region")
-
-# extract the first 90 dates for all regions
-dates <- sort(unique(regional_cases$date))[1:90]
-regional_cases <- regional_cases[which(regional_cases$date %in% dates), ]
-
-head(regional_cases)
-```
-
-To find regional estimates, we use the same inputs as `epinow()` to the function `regional_epinow()`:
-
-```{r, message = FALSE, eval = TRUE}
-estimates_regional <- regional_epinow(
- reported_cases = regional_cases,
- generation_time = generation_time_opts(generation_time_fixed),
- delays = delay_opts(incubation_period_fixed + reporting_delay_fixed),
- rt = rt_opts(prior = list(mean = rt_log_mean, sd = rt_log_sd))
-)
-
-estimates_regional$summary$summarised_results$table
-
-estimates_regional$summary$plots$R
-```
-
-
-## Summary
-
-`EpiNow2` can be used to estimate transmission metrics from case data at the start of an outbreak. The reliability of these estimates depends on the quality of the data and appropriate choice of delay distributions. In the next tutorial we will learn how to make forecasts and investigate some of the additional inference options available in `EpiNow2`.
-
-::::::::::::::::::::::::::::::::::::: keypoints
-
-- Transmission metrics can be estimated from case data after accounting for delays
-- Uncertainty can be accounted for in delay distributions
-
-::::::::::::::::::::::::::::::::::::::::::::::::
diff --git a/episodes/read-delays.Rmd b/episodes/read-delays.Rmd
deleted file mode 100644
index 90e6c8e3..00000000
--- a/episodes/read-delays.Rmd
+++ /dev/null
@@ -1,1380 +0,0 @@
----
-title: 'Read delays'
-teaching: 10
-exercises: 2
-editor_options:
- chunk_output_type: console
----
-
-:::::::::::::::::::::::::::::::::::::: questions
-
-- How to get delay distributions from a systematic review?
-- How to connect reused delays with my existing analysis pipeline?
-- When should delays be reused from a systematic review?
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-::::::::::::::::::::::::::::::::::::: objectives
-
-- Get delays from a systematic review with `{epiparameter}`.
-- Get statistical summaries and distribution parameters of delay distributions.
-- Use distribution functions from delay distributions.
-- Convert a continuous to a discrete delay distribution.
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-::::::::::::::::::::::::::::::::::::: prereq
-
-## Prerequisites
-
-This episode requires you to be familiar with:
-
-**Data science** : Basic programming with R.
-
-**Epidemic theory** : Epidemiological parameters. Time periods.
-
-:::::::::::::::::::::::::::::::::
-
-## Introduction
-
-The [natural history](../learners/reference.md#naturalhistory) of an infectious disease shows that its development has a regularity from stage to stage. The time periods from an infectious disease inform about the timing of transmission and interventions.
-
-![Definition of key time periods. From [Xiang et al, 2021](https://www.sciencedirect.com/science/article/pii/S2468042721000038)](fig/time-periods.jpg)
-
-
-::::::::::::::::: callout
-
-### Definitions
-
-Look at the [glossary](../learners/reference.md) for the definitions of all the time periods of the figure above!
-
-:::::::::::::::::::::::::
-
-However, early in an epidemic, modelling efforts can be delayed by the lack of a centralized resource that summarises input parameters for the disease of interest ([Nash et al., 2023](https://mrc-ide.github.io/epireview/)). Projects like `{epiparameter}` and `{epireview}` are building online catalogues following systematic review protocols that can help build models faster for coming outbreaks and epidemics from known pathogens and unknown ones related to known families of viruses.
-
-
-
-To exemplify how to use `{epiparameter}` in your analysis pipeline, our goal in this episode will be to replace the `generation_time` input that we can use for `EpiNow2::epinow()`.
-
-```r
-epinow_estimates <- epinow(
- # cases
- reported_cases = example_confirmed[1:60],
- # delays
- generation_time = generation_time_opts(generation_time),
- # computation
- stan = stan_opts(
- cores = 4, samples = 1000, chains = 3,
- control = list(adapt_delta = 0.99)
- )
-)
-```
-
-To do this replacement, instead of plug-in numeric values to `EpiNow2::dist_spec()` to manually specify the delay distribution parameters, we are going to collect them from the library of epidemiological parameters provided by `{epiparameter}`:
-
-```r
-generation_time <- dist_spec(
- mean = 3.6,
- sd = 3.1,
- max = 20,
- distribution = "lognormal"
-)
-```
-
-Let's explore how we can access this and other time delays using `{epiparameter}`. We'll use the pipe `%>%` to connect some of their functions, so let's also call to the `{tidyverse}` package:
-
-```{r,warning=FALSE,message=FALSE}
-library(epiparameter)
-library(EpiNow2)
-library(tidyverse)
-```
-
-## Find a Generation time
-
-The generation time, jointly with the $R$, can inform about the speed of spread and its feasibility of control. Given a $R>1$, with a shorter generation time, cases can appear more quickly.
-
-![Video from the MRC Centre for Global Infectious Disease Analysis, Ep 76. Science In Context - Epi Parameter Review Group with Dr Anne Cori (27-07-2023) at ](fig/reproduction-generation-time.png)
-
-In calculating the effective reproduction number ($R_{t}$), the *generation time* distribution is often approximated by the [serial interval](../learners/reference.md#serialinterval) distribution.
-This frequent approximation is because it is easier to observe and measure the onset of symptoms than the onset of infectiousness.
-
-![A schematic of the relationship of different time periods of transmission between an infector and an infectee in a transmission pair. Exposure window is defined as the time interval having viral exposure, and transmission window is defined as the time interval for onward transmission with respect to the infection time ([Chung Lau et al. 2021](https://academic.oup.com/jid/article/224/10/1664/6356465)).](fig/serial-interval-observed.jpeg)
-
-However, using the *serial interval* as an approximation of the *generation time* is primarily valid for diseases in which infectiousness starts after symptom onset ([Chung Lau et al. 2021](https://academic.oup.com/jid/article/224/10/1664/6356465)). In cases where infectiousness starts before symptom onset, the serial intervals can have negative values, which is the case of a pre-symptomatic transmission ([Nishiura et al. (2020)](https://www.ijidonline.com/article/S1201-9712(20)30119-3/fulltext#gr2)).
-
-Additionally, even if the *generation time* and *serial interval* have the same mean, their variance usually differs, propagating bias to the $R_{t}$ estimation. $R_{t}$ estimates are sensitive not only to the mean generation time but also to the variance and form of the generation interval distribution [(Gostic et al., 2020)](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1008409).
-
-::::::::::::::::: callout
-
-### From time periods to probability distributions.
-
-When we calculate the *serial interval*, we see that not all case pairs have the same time length. We will observe this variability for any case pair and individual time period, including the [incubation period](../learners/reference.md#incubation) and [infectious period](../learners/reference.md#infectiousness).
-
-![Serial intervals of possible case pairs in (a) COVID-19 and (b) MERS-CoV. Pairs represent a presumed infector and their presumed infectee plotted by date of symptom onset ([Althobaity et al., 2022](https://www.sciencedirect.com/science/article/pii/S2468042722000537#fig6)).](fig/serial-interval-pairs.jpg)
-
-To summarize these data from individual and pair time periods, we can find the **statistical distributions** that best fit the data ([McFarland et al., 2023](https://www.eurosurveillance.org/content/10.2807/1560-7917.ES.2023.28.27.2200806)).
-
-
-
-![Fitted serial interval distribution for (a) COVID-19 and (b) MERS-CoV based on reported transmission pairs in Saudi Arabia. We fitted three commonly used distributions, Lognormal, Gamma, and Weibull distributions, respectively ([Althobaity et al., 2022](https://www.sciencedirect.com/science/article/pii/S2468042722000537#fig5)).](fig/seria-interval-fitted-distributions.jpg)
-
-Statistical distributions are summarized in terms of their **summary statistics** like the *location* (mean and percentiles) and *spread* (variance or standard deviation) of the distribution, or with their **distribution parameters** that inform about the *form* (shape and rate/scale) of the distribution. These estimated values can be reported with their **uncertainty** (95% confidence intervals).
-
-| Gamma | mean | shape | rate/scale |
-|:--------------|:--------------|:--------------|:--------------|
-| MERS-CoV | 14.13(13.9–14.7) | 6.31(4.88–8.52) | 0.43(0.33–0.60) |
-| COVID-19 | 5.1(5.0–5.5) | 2.77(2.09–3.88) | 0.53(0.38–0.76) |
-
-| Weibull | mean | shape | rate/scale |
-|:--------------|:--------------|:--------------|:--------------|
-| MERS-CoV | 14.2(13.3–15.2) | 3.07(2.64–3.63) | 16.1(15.0–17.1) |
-| COVID-19 | 5.2(4.6–5.9) | 1.74(1.46–2.11) | 5.83(5.08–6.67) |
-
-| Log normal | mean | mean-log | sd-log |
-|:--------------|:--------------|:--------------|:--------------|
-| MERS-CoV | 14.08(13.1–15.2) | 2.58(2.50–2.68) | 0.44(0.39–0.5) |
-| COVID-19 | 5.2(4.2–6.5) | 1.45(1.31–1.61) | 0.63(0.54–0.74) |
-
-Table: Serial interval estimates using Gamma, Weibull, and Log normal distributions. 95% confidence intervals for the shape and scale (logmean and sd for Log normal) parameters are shown in brackets ([Althobaity et al., 2022](https://www.sciencedirect.com/science/article/pii/S2468042722000537#tbl3)).
-
-:::::::::::::::::::::::::
-
-::::::::::::::::::::::::::::::::: challenge
-
-### Serial interval
-
-Assume that COVID-19 and SARS have similar reproduction number values and that the serial interval approximates the generation time.
-
-Given the Serial interval of both infections in the figure below:
-
-- Which one would be harder to control?
-- Why do you conclude that?
-
-![Serial interval of novel coronavirus (COVID-19) infections overlaid with a published distribution of SARS. ([Nishiura et al, 2020](https://www.ijidonline.com/article/S1201-9712(20)30119-3/fulltext))](fig/serial-interval-covid-sars.jpg)
-
-::::::::::::::::: hint
-
-The peak of each curve can inform you about the location of the mean of each distribution. The larger the mean, the larger the serial interval.
-
-::::::::::::::::::::::
-
-::::::::::::::::: solution
-
-Which one would be harder to control?
-
-- COVID-19
-
-Why do you conclude that?
-
-- COVID-19 has the lowest mean serial interval. The approximate mean value for the serial interval of COVID-19 is around four days, and SARS is about seven days. Thus, COVID-19 will likely have newer generations in less time than SARS, assuming similar reproduction numbers.
-
-::::::::::::::::::::::::::
-
-:::::::::::::::::::::::::::::::::::::::::::
-
-:::::::::::::::::::::: instructor
-
-The objective of the assessment above is to assess the interpretation of a larger or shorter generation time.
-
-::::::::::::::::::::::
-
-## Extract epidemiological parameters
-
-First, let's assume that the data set `example_confirmed` has COVID-19 observed cases. So, we need to find a reported generation time for COVID-19 or any other useful parameter for this aim.
-
-Let's start by looking at how many parameters we have in the epidemiological distributions database (`epidist_db`) for the `disease` named `covid`-19:
-
-```{r}
-epiparameter::epidist_db(
- disease = "covid"
-)
-```
-
-From the `{epiparameter}` package, we can use the `epidist_db()` function to ask for any `disease` and also for a specific epidemiological distribution (`epi_dist`).
-
-Let's ask now how many parameters we have in the epidemiological distributions database (`epidist_db`) with the generation time using the string `generation`:
-
-```{r}
-epiparameter::epidist_db(
- epi_dist = "generation"
-)
-```
-
-Currently, in the library of epidemiological parameters, we have one `generation` time entry for Influenza. Considering the abovementioned considerations, we can look at the `serial` intervals for `COVID`-19.
-
-```{r}
-epiparameter::epidist_db(
- disease = "COVID",
- epi_dist = "serial"
-)
-```
-
-::::::::::::::::: callout
-
-### CASE-INSENSITIVE
-
-`epidist_db` is [case-insensitive](https://dillionmegida.com/p/case-sensitivity-vs-case-insensitivity/#case-insensitivity). This means that you can use strings with letters in upper or lower case indistinctly.
-
-:::::::::::::::::::::::::
-
-We get more than one epidemiological delay. To summarize this view and get the column names from the underlying parameter dataset, we can add the `epiparameter::list_distributions()` function to the previous code using the pipe `%>%`:
-
-```{r}
-epiparameter::epidist_db(
- disease = "covid",
- epi_dist = "serial"
-) %>%
- epiparameter::list_distributions()
-```
-
-::::::::::::::::::::::::::::::::: challenge
-
-### Ebola's incubation periods
-
-Take 5 minutes:
-
-- How many delay distributions are for the Ebola disease?
-
-- How many delay distributions are for the incubation period of Ebola?
-
-- Explore the library and find the disease with the delay distribution of your interest! Do you recognize the paper?
-
-::::::::::::::::: hint
-
-The `{epiparameter}` combo of `epidist_db()` plus `list_distributions()` list all the entries by:
-
-- disease,
-- epidemiological distribution,
-- the type of the probability distribution,
-- author of the study, and
-- year of study.
-
-::::::::::::::::::::::
-
-::::::::::::::::: solution
-
-```{r,eval=FALSE}
-# 16 delays distributions
-epiparameter::epidist_db(
- disease = "ebola"
-)
-
-# 5 delay distributions are for the incubation period
-epiparameter::epidist_db(
- disease = "ebola",
- epi_dist = "incubation"
-)
-```
-
-Now, from the output of `epiparameter::epidist_db()`, What is an [offspring distribution](../learners/reference.md#offspringdist)?
-
-::::::::::::::::::::::::::
-
-:::::::::::::::::::::::::::::::::::::::::::
-
-
-## Select a single distribution
-
-The `epiparameter::epidist_db()` function works as a filtering or subset function. Let's use the `author` argument to filter `Hiroshi Nishiura` parameters:
-
-```{r}
-epiparameter::epidist_db(
- disease = "covid",
- epi_dist = "serial",
- author = "Hiroshi"
-) %>%
- epiparameter::list_distributions()
-```
-
-We still get more than one epidemiological parameter. We can set the `single_epidist` argument to `TRUE` to only one:
-
-```{r}
-epiparameter::epidist_db(
- disease = "covid",
- epi_dist = "serial",
- author = "Hiroshi",
- single_epidist = TRUE
-)
-```
-
-::::::::::::::::: callout
-
-### How does `single_epidist` works?
-
-Looking at the help documentation for `?epiparameter::epidist_db()`:
-
-- If multiple entries match the arguments supplied and `single_epidist = TRUE`,
-- Then, the parameterised `` with the largest sample size will be returned.
-- If multiple entries are equal after this sorting, the first entry will be returned.
-
-What does a parametrised `` is? Look at `?is_parameterised`.
-
-:::::::::::::::::::::::::
-
-Now, we have an epidemiological parameter we can reuse! We can replace the numbers we plug into `EpiNow2::dist_spec()`.
-
-Let's assign this `` class object to the `covid_serialint` object.
-
-```{r}
-covid_serialint <-
- epiparameter::epidist_db(
- disease = "covid",
- epi_dist = "serial",
- author = "Nishiura",
- single_epidist = TRUE
- )
-
-covid_serialint
-```
-
-::::::::::::::::::::::::::::::::: challenge
-
-### Ebola's incubation period
-
-Take 2 minutes:
-
-- What type of distribution has the incubation period of Ebola with the highest sample size?
-- How would you access to the sample size of the other studies in the `` class object?
-
-::::::::::::::::: hint
-
-The `{epiparameter}` combo of `epidist_db()` plus `list_distributions()` list all the entries by:
-
-- disease,
-- epidemiological distribution,
-- the type of the probability distribution,
-- author of the study, and
-- year of study.
-
-This is a `` class object:
-
-```{r,eval=FALSE}
-epiparameter::epidist_db(
- disease = "ebola",
- epi_dist = "incubation"
-)
-```
-
-
-::::::::::::::::::::::
-
-::::::::::::::::: solution
-
-```{r,eval=FALSE}
-# the distribution with the highest sample size has a gamma distribution
-epiparameter::epidist_db(
- disease = "ebola",
- epi_dist = "incubation",
- single_epidist = TRUE
-)
-```
-
-To access the `sample_size`, review an [issue reported in the GitHub repository](https://github.com/epiverse-trace/epiparameter/issues/227) of the `{epiparameter}` package.
-
-::::::::::::::::::::::::::
-
-:::::::::::::::::::::::::::::::::::::::::::
-
-## Extract the summary statistics
-
-We can get the `mean` and standard deviation (`sd`) from this `` diving into the `summary_stats` object:
-
-```{r}
-# get the mean
-covid_serialint$summary_stats$mean
-```
-
-:::::::::::::::::::::::::::::: challenge
-
-### How to get the `sd` and other nested elements?
-
-Take 1 minute to:
-
-1. Get the `sd` of the epidemiological distribution.
-
-2. Find the `sample_size` used in the study.
-
-3. Explore all the other nested elements within the `` object.
-
-Share about:
-
-- What elements do you find useful for your analysis?
-- What other elements would you like to see in this object? How?
-
-::::::::: hint
-
-Use the `$` operator plus the tab keyboard button to explore them as an expandable list:
-
-```r
-covid_serialint$
-```
-
-Use the `str()` to display the structure of the `` R object.
-
-::::::::::::::::::
-
-:::::::::: solution
-
-```{r,eval=FALSE}
-# get the sd
-covid_serialint$summary_stats$sd
-
-# get the sample_size
-covid_serialint$metadata$sample_size
-```
-
-::::::::::::::::::::
-
-::::::::::::::::::::::::::::::::
-
-:::::::::::::::::::: intructor
-
-An interesting element is the `method_assess` nested entry, which refers to the methods used by the study authors to assess for bias while estimating the serial interval distribution.
-
-```{r}
-covid_serialint$method_assess
-```
-
-We will explore these concepts at the end!
-
-::::::::::::::::::::::::::::::
-
-
-::::::::::::::::::::::::::::::::: challenge
-
-### Ebola's severity parameter
-
-A severity parameter like the duration of hospitalization could add to the information needed about the bed capacity in response to an outbreak ([Cori et al., 2017](https://royalsocietypublishing.org/doi/10.1098/rstb.2016.0371)).
-
-For Ebola:
-
-- what is a reported point estimate and uncertainty of the mean duration of health-care and case isolation?
-
-::::::::::::::::: hint
-
-An informative delay measures the time from symptom onset to recovery or death.
-
-::::::::::::::::::::::
-
-::::::::::::::::: solution
-
-```{r,eval=FALSE}
-# one way to get the list of all the available parameters
-epidist_db(disease = "all") %>%
- list_distributions() %>%
- as_tibble() %>%
- distinct(epi_distribution)
-
-ebola_severity <- epidist_db(
- disease = "ebola",
- epi_dist = "onset to discharge"
-)
-
-# point estimate
-ebola_severity$summary_stats$mean
-# 95% confidence intervals
-ebola_severity$summary_stats$mean_ci
-# limits of the confidence intervals
-ebola_severity$summary_stats$mean_ci_limits
-```
-
-::::::::::::::::::::::::::
-
-:::::::::::::::::::::::::::::::::::::::::::
-
-
-## Continuous distributions
-
-The following output has four entries with different content in the **probability distribution** (`prob_distribution`) column:
-
-```{r}
-distribution <-
- epiparameter::epidist_db(
- disease = "covid",
- epi_dist = "serial"
- )
-
-distribution %>%
- list_distributions()
-```
-
-Entries with a missing value (``) in the `prob_distribution` column are *non-parameterised* entries. They have summary statistics but no probability distribution. Compare these two outputs:
-
-```{r,eval=FALSE}
-distribution[[1]]$summary_stats
-distribution[[1]]$prob_dist
-```
-
-::::::::::::::::: spoiler
-
-### Parameterised entries have an Inference method
-
-As detailed in `?is_parameterised`, a parameterised distribution is the entry that has a probability distribution associated with it provided by an `inference_method` as shown in `metadata`:
-
-```{r,eval=FALSE}
-distribution[[1]]$metadata$inference_method
-distribution[[2]]$metadata$inference_method
-distribution[[4]]$metadata$inference_method
-```
-
-:::::::::::::::::::::::::
-
-In the `epiparameter::list_distributions()` output, we can also find different types of probability distributions (e.g., Log-normal, Weibull, Normal).
-
-```{r}
-distribution %>%
- list_distributions()
-```
-
-In `{epiparameter}`, you will mostly find **continuous** distributions like these. You can visualize any of them with the `plot()` function and access to:
-
-- the *Probability Density Function (PDF)* and
-- the *Cumulative Distribution Function (CDF)*.
-
-```{r}
-plot(distribution[[2]])
-```
-
-With the `day_range` argument, you can change the length or number of days in the `x` axis. Explore what it look like:
-
-```{r,eval=FALSE}
-plot(distribution[[2]], day_range = 0:20)
-```
-
-::::::::::::::::: discussion
-
-### The distribution Zoo
-
-Explore this shinyapp called **The Distribution Zoo**!
-
-Follow these steps to reproduce the form of the `covid_serialint` distribution:
-
-1. Access to shinyapp website,
-2. Go to the left panel,
-3. Keep the *Category of distribution*: `Continuous Univariate`,
-4. Select a new *Type of distribution*: `Log-Normal`,
-5. Move the **sliders**, i.e. the graphical control element that allows you to adjust a value by moving a handle along a horizontal track or bar to the `covid_serialint` parameters.
-
-Replicate these with the `distribution` object and all its list elements: `2`, `3`, and `4`. Explore how the shape of a distribution changes when its parameters change.
-
-Share about:
-
-- What other features of the website do you find helpful?
-
-:::::::::::::::::::::::::
-
-
-
-## Distribution functions
-
-In R, all the statistical distributions have functions to access the:
-
-- Probability **Density** function (PDF),
-- Cumulative Distribution function (**CDF**),
-- **Quantile** function, and
-- **Random** values from the given distribution.
-
-:::::::::::: spoiler
-
-### Functions for the Normal distribution
-
-If you need it, read in detail about the [R probability functions for the normal distribution](https://sakai.unc.edu/access/content/group/3d1eb92e-7848-4f55-90c3-7c72a54e7e43/public/docs/lectures/lecture13.htm#probfunc), each of its definitions and identify in which part of a distribution they are located!
-
-![The four probability functions for the normal distribution ([Jack Weiss, 2012](https://sakai.unc.edu/access/content/group/3d1eb92e-7848-4f55-90c3-7c72a54e7e43/public/docs/lectures/lecture13.htm#probfunc))](fig/fig5a-normaldistribution.png)
-
-::::::::::::::::::::
-
-If you look at `?stats::Distributions`, each type of distribution has a unique set of functions. However, `{epiparameter}` gives you the same four functions to access each of the values above for any `` object you want!
-
-```{r,eval=FALSE}
-# plot this to have a visual reference
-plot(covid_serialint, day_range = 0:20)
-```
-
-```{r}
-# the density value at quantile value of 10 (days)
-density(covid_serialint, at = 10)
-
-# the cumulative probability at quantile value of 10 (days)
-cdf(covid_serialint, q = 10)
-
-# the quantile value (day) at a cumulative probability of 60%
-quantile(covid_serialint, p = 0.6)
-
-# generate 10 random values (days) given
-# the distribution family and its parameters
-generate(covid_serialint, times = 10)
-```
-
-::::::::: instructor
-
-Access to the reference documentation (Help files) for these functions is accessible with the three double-colon notation: `epiparameter:::`
-
-- `?epiparameter:::density.epidist()`
-- `?epiparameter:::cdf.epidist()`
-- `?epiparameter:::quantile.epidist()`
-- `?epiparameter:::generate.epidist()`
-
-::::::::::::::::::
-
-::::::::::::::::::::::::::::::::: challenge
-
-### Window for contact tracing and the Serial interval
-
-The **serial interval** is important in the optimization of contact tracing since it provides a time window for the containment of a disease spread ([Fine, 2003](https://academic.oup.com/aje/article/158/11/1039/162725)). Depending on the serial interval, we can evaluate the need to expand the number of days pre-onset to consider in the contact tracing to include more backwards contacts ([Davis et al., 2020](https://assets.publishing.service.gov.uk/media/61e9ab3f8fa8f50597fb3078/S0523_Oxford_-_Backwards_contact_tracing.pdf)).
-
-With the COVID-19 serial interval (`covid_serialint`) calculate:
-
-- How much more of the backward cases could be captured if the contact tracing method considered contacts up to 6 days pre-onset compared to 2 days pre-onset?
-
-::::::::::::::::: hint
-
-In Figure 5 from the [R probability functions for the normal distribution](https://sakai.unc.edu/access/content/group/3d1eb92e-7848-4f55-90c3-7c72a54e7e43/public/docs/lectures/lecture13.htm#probfunc), the shadowed section represents a cumulative probability of `0.997` for the quantile value at `x = 2`.
-
-::::::::::::::::::::::
-
-::::::::::::::::: solution
-
-```{r,eval=FALSE}
-plot(covid_serialint)
-```
-
-```{r,eval=FALSE}
-cdf(covid_serialint, q = 2)
-cdf(covid_serialint, q = 6)
-```
-
-Given the COVID-19 serial interval:
-
-- A contact tracing method considering contacts up to 2 days pre-onset will capture around 11.1% of backward cases.
-
-- If this period is extended to 6 days pre-onset, this could include 76.2% of backward contacts.
-
-::::::::::::::::::::::::::
-
-::::::::::::::::: solution
-
-### What if
-
-If we exchange the question between days and cumulative probability to:
-
-- When considering secondary cases, how many days following the symptom onset of primary cases can we expect 55% of symptom onset to occur?
-
-```{r,eval=FALSE}
-quantile(covid_serialint, p = 0.55)
-```
-
-An interpretation could be:
-
-- The 55% percent of the symptom onset of secondary cases will happen after 4.2 days after the symptom onset of primary cases.
-
-::::::::::::::::::::::::::
-
-
-:::::::::::::::::::::::::::::::::::::::::::
-
-
-## Discretize a continuous distribution
-
-We are getting closer to the end! `EpiNow2::dist_spec()` still needs a maximum value (`max`).
-
-One way to do this is to get the quantile value for the distribution's 99.9th percentile or `0.999` cumulative probability. For this, we need access to the set of distribution functions for our `` object.
-
-We can use the set of distribution functions for a _continuous_ distribution (as above). However, these values will be _continuous_ numbers. We can **discretize** the continuous distribution stored in our `` object to get discrete values from a continuous distribution.
-
-When we `epiparameter::discretise()` the continuous distribution we get a **discrete**(-ized) distribution:
-
-```{r}
-covid_serialint_discrete <-
- epiparameter::discretise(covid_serialint)
-
-covid_serialint_discrete
-```
-
-We identify this change in the `Distribution:` output line of the `` object. Take a double check to this line:
-
-```
-Distribution: discrete lnorm
-```
-
-While for a **continuous** distribution, we plot the *Probability Density Function (PDF)*, for a **discrete** distribution, we plot the *Probability Mass Function (PMF)*:
-
-```{r,eval=FALSE}
-# continuous
-plot(covid_serialint)
-
-# discrete
-plot(covid_serialint_discrete)
-```
-
-To finally get a `max` value, let's access the quantile value of the 99.9th percentile or `0.999` probability of the distribution with the `prob_dist$q` notation, similarly to how we access the `summary_stats` values.
-
-```{r}
-covid_serialint_discrete_max <-
- covid_serialint_discrete$prob_dist$q(p = 0.999)
-```
-
-::::::::::::::::::::::::::::::::: challenge
-
-### Lenght of quarantine and Incubation period
-
-The **incubation period** distribution is a useful delay to assess the length of active monitoring or quarantine ([Lauer et al., 2020](https://www.acpjournals.org/doi/10.7326/M20-0504)). Similarly, delays from symptom onset to recovery (or death) will determine the required duration of health-care and case isolation ([Cori et al., 2017](https://royalsocietypublishing.org/doi/10.1098/rstb.2016.0371)).
-
-Calculate:
-
-- Within what exact time frame do 99% of individuals who develop COVID-19 symptoms exhibit them after infection?
-
-::::::::::::::::: hint
-
-What delay distribution measures the time between infection and the onset of symptoms?
-
-The probability function for `` **discrete** distributions differ from the *continuous* ones!
-
-```{r,eval=FALSE}
-# plot to have a visual reference
-plot(covid_serialint_discrete, day_range = 0:20)
-
-# density value at quantile value 10 (day)
-covid_serialint_discrete$prob_dist$d(10)
-
-# cumulative probability at quantile value 10 (day)
-covid_serialint_discrete$prob_dist$cdf(10)
-
-# In what quantile value (days) do we have the 60% cumulative probability?
-covid_serialint_discrete$prob_dist$q(0.6)
-
-# generate random values
-covid_serialint_discrete$prob_dist$r(10)
-```
-
-::::::::::::::::::::::
-
-::::::::::::::::: solution
-
-```{r,eval=FALSE}
-covid_incubation <-
- epiparameter::epidist_db(
- disease = "covid",
- epi_dist = "incubation",
- single_epidist = TRUE
- )
-
-covid_incubation_discrete <- epiparameter::discretise(covid_incubation)
-
-covid_incubation_discrete$prob_dist$q(0.99)
-```
-
-99% of those who develop COVID-19 symptoms will do so within 16 days of infection.
-
-Now, _Is this result expected in epidemiological terms?_
-
-::::::::::::::::::::::::::
-
-::::::::::::::::: solution
-
-### how to create a distribution plot?
-
-From a maximum value with `$prob_dist$q()`, we can create a sequence of quantile values as a numeric vector and map density values for each:
-
-```{r,eval=FALSE}
-# create a discrete distribution visualization
-# from a maximum value from the distribution
-covid_serialint_discrete$prob_dist$q(0.999) %>%
- # generate quantile values
- # as a sequence for each natural number
- seq(1L, to = ., by = 1L) %>%
- # coerce numeric vector to data frame
- as_tibble_col(column_name = "quantile_values") %>%
- mutate(
- # map density values
- # for each quantile in the density function
- density_values =
- covid_serialint_discrete$prob_dist$d(quantile_values)
- ) %>%
- # create plot
- ggplot(
- aes(
- x = quantile_values,
- y = density_values
- )
- ) +
- geom_col()
-```
-
-::::::::::::::::::::::::::
-
-:::::::::::::::::::::::::::::::::::::::::::
-
-
-## Plug-in `{epiparameter}` to `{EpiNow2}`
-
-Now we can plug everything into the `EpiNow2::dist_spec()` function!
-
-```{r}
-serial_interval_covid <-
- dist_spec(
- mean = covid_serialint$summary_stats$mean,
- sd = covid_serialint$summary_stats$sd,
- max = covid_serialint_discrete_max,
- distribution = "lognormal"
- )
-
-serial_interval_covid
-```
-
-:::::::::: callout
-
-### Warning
-
-Using the serial interval instead of the generation time is an alternative that can propagate bias in your estimates, even more so in diseases with reported pre-symptomatic transmission.
-
-::::::::::::::::::
-
-Let's replace the `generation_time` input we used for `EpiNow2::epinow()`.
-
-```{r,eval=FALSE}
-epinow_estimates <- epinow(
- # cases
- reported_cases = example_confirmed[1:60],
- # delays
- generation_time = generation_time_opts(serial_interval_covid),
- # computation
- stan = stan_opts(
- cores = 4, samples = 1000, chains = 3,
- control = list(adapt_delta = 0.99)
- )
-)
-
-base::plot(epinow_estimates)
-```
-
-::::::::::::::::::::::::::::::::: challenge
-
-### Ebola's effective reproduction number
-
-Download and read the [Ebola dataset](data/ebola_cases.csv):
-
-- Reuse one epidemiological parameter to estimate the effective reproduction number for the Ebola dataset.
-- Why did you choose that parameter?
-
-::::::::::::::::: hint
-
-To calculate the $R_t$, we need:
-
-- data set with confirmed cases per day and
-- one key delay distribution
-
-Key functions we applied in this episode are:
-
-- `epidist_db()`
-- `list_distributions()`
-- `discretise()`
-- probability functions for continuous and discrete distributions
-
-::::::::::::::::::::::
-
-::::::::::::::::: solution
-
-```{r,eval=FALSE,echo=FALSE}
-# read data from the tutorial repository R project
-ebola_confirmed <-
- read_csv(file.path("episodes", "data", "ebola_cases.csv"))
-```
-
-```{r,message=FALSE,warning=FALSE,eval=FALSE}
-# read data
-# e.g.: if path to file is data/raw-data/ebola_cases.csv then:
-ebola_confirmed <-
- read_csv(here::here("data", "raw-data", "ebola_cases.csv"))
-
-# list distributions
-epidist_db(disease = "ebola") %>%
- list_distributions()
-
-# subset one distribution
-ebola_serial <- epidist_db(
- disease = "ebola",
- epi_dist = "serial",
- single_epidist = TRUE
-)
-
-ebola_serial_discrete <- discretise(ebola_serial)
-
-serial_interval_ebola <-
- dist_spec(
- mean = ebola_serial$summary_stats$mean,
- sd = ebola_serial$summary_stats$sd,
- max = ebola_serial_discrete$prob_dist$q(p = 0.999),
- distribution = "gamma"
- )
-
-# name of the type of distribution
-# only for the discretised distribution
-ebola_serial_discrete$prob_dist$name
-
-epinow_estimates <- epinow(
- # cases
- reported_cases = ebola_confirmed,
- # delays
- generation_time = generation_time_opts(serial_interval_ebola),
- # computation
- stan = stan_opts(
- cores = 4, samples = 1000, chains = 3,
- control = list(adapt_delta = 0.99)
- )
-)
-
-plot(epinow_estimates)
-
-```
-
-::::::::::::::::::::::::::
-
-
-:::::::::::::::::::::::::::::::::::::::::::
-
-## Adjusting for reporting delays
-
-Estimating $R_t$ requires data on the daily number of new infections. Due to lags in the development of detectable viral loads, symptom onset, seeking care, and reporting, these numbers are not readily available. All observations reflect transmission events from some time in the past. In other words, if $d$ is the delay from infection to observation, then observations at time $t$ inform $R_{t−d}$, not $R_t$. [(Gostic et al., 2020)](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1008409#sec007)
-
-![Timeline for chain of disease reporting, the Netherlands. Lab, laboratory; PHA, public health authority. From [Marinović et al., 2015](https://wwwnc.cdc.gov/eid/article/21/2/13-0504_article)](fig/disease-reporting.jpg)
-
-The **delay distribution** could be inferred jointly with the underlying times of infection or estimated as the sum of the **[incubation period](../learners/reference.md#incubation)** distribution and the distribution of delays from symptom onset to observation from line list data **([reporting delay](../learners/reference.md#reportingdelay))**.
-
-For `{EpiNow2}`, we can specify these two complementary delay distributions in the `delays` argument.
-
-![Rt is a measure of transmission at time t. Observations after time t must be adjusted. ICU, intensive care unit. From [Gostic et al., 2020](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1008409#sec007)](fig/rt-adjusting-delays.png)
-
-::::::::::::::::::::::::::::::::: challenge
-
-### Reuse an Incubation period for COVID-19
-
-Use `{epiparameter}` to:
-
-- Find an incubation period for COVID-19.
-- Add our last `epinow()` code chunk using the `delays` argument and the `delay_opts()` helper function.
-
-::::::::::::::::: hint
-
-The `delays` argument and the `delay_opts()` helper function are analogous to the `generation_time` argument and the `generation_time_opts()` helper function.
-
-```r
-epinow_estimates <- epinow(
- # cases
- reported_cases = example_confirmed[1:60],
- # delays
- generation_time = generation_time_opts(serial_interval_covid),
- delays = delay_opts(incubation_time_covid),
- # computation
- stan = stan_opts(
- cores = 4, samples = 1000, chains = 3,
- control = list(adapt_delta = 0.99)
- )
-)
-```
-
-::::::::::::::::::::::
-
-::::::::::::::::: solution
-
-```{r,eval=FALSE}
-covid_incubation <- epiparameter::epidist_db(
- disease = "covid",
- epi_dist = "incubation",
- author = "Natalie",
- single_epidist = TRUE
-)
-
-covid_incubation
-
-covid_incubation_discrete <- epiparameter::discretise(covid_incubation)
-
-incubation_time_covid <- dist_spec(
- mean = covid_incubation$summary_stats$mean,
- sd = covid_incubation$summary_stats$sd,
- max = covid_incubation_discrete$prob_dist$q(p = 0.999),
- distribution = "lognormal"
-)
-
-epinow_estimates <- epinow(
- # cases
- reported_cases = example_confirmed[1:60],
- # delays
- generation_time = generation_time_opts(serial_interval_covid),
- delays = delay_opts(incubation_time_covid),
- # computation
- stan = stan_opts(
- cores = 4, samples = 1000, chains = 3,
- control = list(adapt_delta = 0.99)
- )
-)
-
-base::plot(epinow_estimates)
-```
-
-::::::::::::::::::::::::::
-
-:::::::::::::: solution
-
-### How much has it changed?
-
-After adding the incubation period, discuss:
-
-- Does the retrospective trend of forecast change?
-- Has the uncertainty changed?
-- How would you explain or interpret any of these changes?
-
-::::::::::::::::::::::::::::
-
-:::::::::::::::::::::::::::::::::::::::::::
-
-
-::::::::::::::::::::::::::::::::: challenge
-
-### Ebola's effective reproduction number was adjusted by reporting delays
-
-Using the same [Ebola dataset](data/ebola_cases.csv):
-
-- Reuse one additional epidemiological parameter for the `delays` argument in `EpiNow2::epinow()`.
-- Estimate the effective reproduction number using `EpiNow2::epinow()`.
-- Why did you choose that parameter?
-
-::::::::::::::::: hint
-
-We can use two complementary delay distributions to estimate the $R_t$ at time $t$.
-
-::::::::::::::::::::::
-
-::::::::::::::::: solution
-
-```{r,eval=FALSE,echo=FALSE}
-# read data from the tutorial repository R project
-ebola_confirmed <-
- read_csv(file.path("episodes", "data", "ebola_cases.csv"))
-```
-
-```{r,message=FALSE,warning=FALSE,eval=FALSE}
-# read data
-# e.g.: if path to file is data/raw-data/ebola_cases.csv then:
-ebola_confirmed <-
- read_csv(here::here("data", "raw-data", "ebola_cases.csv"))
-
-# list distributions
-epidist_db(disease = "ebola") %>%
- list_distributions()
-
-# subset one distribution for the generation time
-ebola_serial <- epidist_db(
- disease = "ebola",
- epi_dist = "serial",
- single_epidist = TRUE
-)
-
-ebola_serial_discrete <- discretise(ebola_serial)
-
-serial_interval_ebola <-
- dist_spec(
- mean = ebola_serial$summary_stats$mean,
- sd = ebola_serial$summary_stats$sd,
- max = ebola_serial_discrete$prob_dist$q(p = 0.999),
- distribution = "gamma"
- )
-
-# subset one distribution for delay of the incubation period
-ebola_incubation <- epidist_db(
- disease = "ebola",
- epi_dist = "incubation",
- single_epidist = TRUE
-)
-
-ebola_incubation_discrete <- discretise(ebola_incubation)
-
-incubation_period_ebola <-
- dist_spec(
- mean = ebola_incubation$summary_stats$mean,
- sd = ebola_incubation$summary_stats$sd,
- max = ebola_incubation_discrete$prob_dist$q(p = 0.999),
- distribution = "gamma"
- )
-
-epinow_estimates <- epinow(
- # cases
- reported_cases = ebola_confirmed,
- # delays
- generation_time = generation_time_opts(serial_interval_ebola),
- delays = delay_opts(incubation_period_ebola),
- # computation
- stan = stan_opts(
- cores = 4, samples = 1000, chains = 3,
- control = list(adapt_delta = 0.99)
- )
-)
-
-plot(epinow_estimates)
-
-```
-
-::::::::::::::::::::::::::
-
-:::::::::::::::::::::::::::::::::::::::::::
-
-
-::::::::::::::::::::::::::::::::: challenge
-
-### Extract parameters
-
-Use the `influenza_england_1978_school` from the `{outbreaks}` package to calculate the effective reproduction number.
-
-::::::::::::::::: hint
-
-How to get the mean and standard deviation from a generation time with median and quantiles as summary statistics?
-
-- Look at how to extract parameters from `{epiparameter}` vignette on [parameter extraction and conversion](https://epiverse-trace.github.io/epiparameter/articles/extract_convert.html)
-
-::::::::::::::::::::::
-
-::::::::::::::::: solution
-
-
-
-```{r,eval=FALSE}
-# What parameters are available for Influenza?
-epidist_db(disease = "influenza") %>%
- list_distributions() %>%
- as_tibble() %>%
- count(epi_distribution)
-
-influenza_generation <-
- epidist_db(
- disease = "influenza",
- epi_dist = "generation"
- )
-
-influenza_generation_discrete <-
- discretise(influenza_generation)
-
-# problem
-# the summary statistics do not have mean and sd
-influenza_generation$summary_stats
-influenza_generation$summary_stats$median
-influenza_generation$summary_stats$quantiles
-
-# solution
-# extract parameters from percentiles
-influenza_extracted <- extract_param(
- type = "percentiles",
- values = c(influenza_generation$summary_stats$quantiles[1],
- influenza_generation$summary_stats$quantiles[2]),
- distribution = "lnorm",
- percentiles = c(0.05, 0.95)
-)
-
-influenza_extracted
-
-generation_time_influenza <-
- dist_spec(
- mean = influenza_extracted[1],
- sd = influenza_extracted[2],
- max = influenza_generation_discrete$prob_dist$q(p = 0.999),
- distribution = "lognormal"
- )
-
-influenza_cleaned <-
- outbreaks::influenza_england_1978_school %>%
- select(date, confirm = in_bed)
-
-epinow_estimates <- epinow(
- # cases
- reported_cases = influenza_cleaned,
- # delays
- generation_time = generation_time_opts(generation_time_influenza),
- # computation
- stan = stan_opts(
- cores = 4, samples = 1000, chains = 3,
- control = list(adapt_delta = 0.99)
- )
-)
-
-plot(epinow_estimates)
-```
-
-
-
-
-
-
-
-
-
-
-::::::::::::::::::::::::::
-
-:::::::::::::::::::::::::::::::::::::::::::
-
-## When to reuse? When to estimate?
-
-In the early stage of an outbreak, we can rely on reusing parameters for known pathogens to unknown ones, like for the [Disease X](https://en.wikipedia.org/wiki/Disease_X), a pathogen currently unknown to cause human disease and potentially cause a serious international epidemic ([WHO, 2018](https://www.who.int/activities/prioritizing-diseases-for-research-and-development-in-emergency-contexts)).
-
-But when data from **lines list paired with contact tracing** is available, we can estimate the key delay distributions that best fit our data. These will help us to inform, compare and update any previous estimate about questions like:
-
-- How long should contacts be followed?
-- What is the required duration of contact tracing?
-- How long should cases be isolated to reduce transmission?
-
-However, the methods to accurately estimate delays like the generation interval from contact tracing data involve adjusting for biases like **[censoring](../learners/reference.md#censoring)**, **[right truncation](../learners/reference.md#truncation)** and **[epidemic phase bias](../learners/reference.md#phasebias)**. [(Gostic et al., 2020)](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1008409)
-
-We can identify what entries in the `{epiparameter}` library assessed for these biases in their methodology with the `method_assess` nested entry:
-
-```{r}
-covid_serialint$method_assess
-```
-
-::::::::::::::::: testimonial
-
-### How to estimate delay distributions for Disease X?
-
-Refer to this excellent tutorial on estimating the serial interval and incubation period of Disease X accounting for *censoring* using Bayesian inference with packages like `{rstan}` and `{coarseDataTools}`.
-
-- Tutorial in English:
-- Tutorial en Español:
-
-:::::::::::::::::::::::::::::
-
-:::::::::::::::::::::::::: spoiler
-
-### How to assess for pre-symptomatic infection?
-
-The lengths of the Serial interval and Incubation period determine the type of disease transmission.
-
-![The relationship between the incubation period and serial interval. From [Nishiura 2020](https://www.ijidonline.com/article/S1201-9712(20)30119-3/fulltext)](fig/incubation-period-serial-interval.jpg)
-
-Estimating the proportion of pre-symptomatic infections, or the extent to which infectiousness precedes symptom onset will determine the effectiveness of contact tracing and the feasibility of controlling an outbreak ([Fraser et al., 2004](https://www.pnas.org/doi/full/10.1073/pnas.0307506101) and [Hellewell et al., 2020](https://www.thelancet.com/article/S2214-109X(20)30074-7/fulltext)).
-
-
-
-![Parameter estimates. Plausible ranges for the key parameters R0 and θ (read the main text for sources) for four viral infections of public concern are shown as shaded regions. The size of the shaded area reflects the uncertainties in the parameter estimates. [Fraser et al., 2004](https://www.pnas.org/doi/10.1073/pnas.0307506101)](fig/reproduction-number-pre-symptomatic.png)
-
-Meta-analysis on the proportion of pre-symptomatic and asymptomatic transmission in SARS-CoV-2 found limitations of the evidence given high heterogeneity and high risk of selection and information bias between studies ([Buitrago-Garcia et al., 2022](https://journals.plos.org/plosmedicine/article/figure?id=10.1371/journal.pmed.1003987.g003)). This is a call to action to improve the Outbreak Analytic pipelines to use and reuse in the early phase of an outbreak.
-
-:::::::::::::::::::::::::::::::::::
-
-::::::::::::::::::::::::::::::::: challenge
-
-### What type of transmission?
-
-Compare the serial interval and incubation period of Influenza and MERS:
-
-- What type of transmission has Influenza?
-- What type of transmission has MERS?
-- Do these results correlate with the available evidence?
-
-::::::::::::::::: hint
-
-For types of transmission, we refer to infections with symptomatic or pre-symptomatic transmission.
-
-Key functions:
-
-- `epidist_db()`
-- `epidist$summary_stats$`
-
-::::::::::::::::::::::
-
-::::::::::::::::: solution
-
-In this solution we use `purrr::pluck()` to extract elements within the `summary_stats` object which is of class `list`.
-
-```{r,eval=FALSE}
-# pre-symptomatic transmission
-epidist_db(
- disease = "influenza",
- epi_dist = "incubation",
- single_epidist = TRUE
-) %>%
- pluck("summary_stats") %>%
- pluck("mean")
-
-epidist_db(
- disease = "influenza",
- epi_dist = "serial",
- single_epidist = TRUE
-) %>%
- pluck("summary_stats") %>%
- pluck("mean")
-
-# symptomatic transmission
-epidist_db(
- disease = "mers",
- epi_dist = "incubation",
- single_epidist = TRUE
-) %>%
- pluck("summary_stats") %>%
- pluck("median")
-
-epidist_db(
- disease = "mers",
- epi_dist = "serial",
- single_epidist = TRUE
-) %>%
- pluck("summary_stats") %>%
- pluck("mean")
-```
-
-```{r,eval=FALSE}
-# pre-symptomatic transmission
-epidist_db(
- disease = "covid",
- epi_dist = "incubation",
- author = "Stephen",
- single_epidist = TRUE
-) %>%
- pluck("summary_stats") %>%
- pluck("mean")
-
-epidist_db(
- disease = "covid",
- epi_dist = "serial",
- author = "Nishiura",
- single_epidist = TRUE
-) %>%
- pluck("summary_stats") %>%
- pluck("mean")
-
-# symptomatic transmission
-epidist_db(
- disease = "ebola",
- epi_dist = "incubation",
- single_epidist = TRUE
-) %>%
- pluck("summary_stats") %>%
- pluck("mean")
-
-epidist_db(
- disease = "ebola",
- epi_dist = "serial",
- single_epidist = TRUE
-) %>%
- pluck("summary_stats") %>%
- pluck("mean")
-```
-
-::::::::::::::::::::::::::
-
-:::::::::::::::::::::::::::::::::::::::::::
-
-
-
-
-::::::::::::::::::::::::::::::::::::: keypoints
-
-- Use `{epiparameter}` to access the systematic review catalogue of epidemiological delay distributions.
-- Use `epidist_db()` to select single delay distributions.
-- Use `list_distributions()` for an overview of multiple delay distributions.
-- Use `discretise()` to convert continuous to discrete delay distributions.
-- Use `{epiparameter}` probability functions for any delay distributions.
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
diff --git a/episodes/simulating-transmission.Rmd b/episodes/simulating-transmission.Rmd
deleted file mode 100644
index c0804502..00000000
--- a/episodes/simulating-transmission.Rmd
+++ /dev/null
@@ -1,555 +0,0 @@
----
-title: 'Simulating transmission'
-teaching: 45 # teaching time in minutes
-exercises: 30 # exercise time in minutes
----
-
-```{r setup, echo= FALSE, message = FALSE, warning = FALSE}
-library(ggplot2)
-library(dplyr)
-library(tidyverse)
-library(DiagrammeR)
-library(webshot)
-library(epidemics)
-webshot::install_phantomjs(force = TRUE)
-```
-
-
-:::::::::::::::::::::::::::::::::::::: questions
-
-- How do I simulate disease spread using a mathematical model?
-- What inputs are needed for a model simulation?
-- How do I account for uncertainty?
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-::::::::::::::::::::::::::::::::::::: objectives
-
-- Load an existing model structure from `{epidemics}` R package
-- Load an existing social contact matrix with `{socialmixr}`
-- Generate a disease spread model simulation with `{epidemics}`
-- Generate multiple model simulations and visualise uncertainty
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-::::::::::::::::::::::::::::::::::::: prereq
-
-## Prerequisites
-
-Learners should familiarise themselves with following concept dependencies before working through this tutorial:
-
-**Mathematical Modelling** : [Introduction to infectious disease models](https://doi.org/10.1038/s41592-020-0856-2), [state variables](../learners/reference.md#state), [model parameters](../learners/reference.md#parsode), [initial conditions](../learners/reference.md#initial), [ordinary differential equations](../learners/reference.md#ordinary).
-
-**Epidemic theory** : [Transmission](https://doi.org/10.1155/2011/267049), [Reproduction number](https://doi.org/10.3201/eid2501.171901).
-:::::::::::::::::::::::::::::::::
-
-
-
-## Introduction
-
-Mathematical models are useful tools for generating future trajectories of disease spread. In this tutorial, we will use the R package `{epidemics}` to generate disease trajectories of an influenza strain with pandemic potential. By the end of this tutorial, you will be able to generate the trajectory below showing the number of infectious individuals in different age categories over time.
-
-```{r traj, echo = FALSE, message = FALSE, fig.width = 10, eval = TRUE}
-# load contact and population data from socialmixr::polymod
-polymod <- socialmixr::polymod
-contact_data <- socialmixr::contact_matrix(
- polymod,
- countries = "United Kingdom",
- age.limits = c(0, 20, 40),
- symmetric = TRUE
-)
-
-# prepare contact matrix
-contact_matrix <- t(contact_data$matrix)
-
-# prepare the demography vector
-demography_vector <- contact_data$demography$population
-names(demography_vector) <- rownames(contact_matrix)
-
-# initial conditions: one in every 1 million is infected
-initial_i <- 1e-6
-initial_conditions_inf <- c(
- S = 1 - initial_i, E = 0, I = initial_i, R = 0, V = 0
-)
-
-initial_conditions_free <- c(
- S = 1, E = 0, I = 0, R = 0, V = 0
-)
-
-# build for all age groups
-initial_conditions <- rbind(
- initial_conditions_inf,
- initial_conditions_free,
- initial_conditions_free
-)
-rownames(initial_conditions) <- rownames(contact_matrix)
-
-# prepare the population to model as affected by the epidemic
-uk_population <- population(
- name = "UK",
- contact_matrix = contact_matrix,
- demography_vector = demography_vector,
- initial_conditions = initial_conditions
-)
-
-# run an epidemic model using `epidemic()`
-output_plot <- model_default_cpp(
- population = uk_population,
- transmissibility = 1.46 / 7.0,
- infectiousness_rate = 1.0 / 3.0,
- recovery_rate = 1.0 / 7.0,
- time_end = 600, increment = 1.0
-)
-
-filter(output_plot, compartment %in% c("exposed", "infectious")) %>%
- ggplot(
- aes(
- x = time,
- y = value,
- col = demography_group,
- linetype = compartment
- )
- ) +
- geom_line(
- linewidth = 1.2
- ) +
- scale_y_continuous(
- labels = scales::comma
- ) +
- scale_colour_brewer(
- palette = "Dark2",
- name = "Age group"
- ) +
- expand_limits(
- y = c(0, 500e3)
- ) +
- coord_cartesian(
- expand = FALSE
- ) +
- theme_bw(
- base_size = 15
- ) +
- theme(
- legend.position = "top"
- ) +
- labs(
- x = "Simulation time (days)",
- linetype = "Compartment",
- y = "Individuals"
- )
-```
-
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: instructor
-
-By the end of this tutorial, learners should be able to replicate the above image on their own computers.
-
-::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-
-## Simulating disease spread
-
-To generate predictions of infectious disease trajectories, we must first select a mathematical model to use.
-There is a library of models to choose from in `epidemics`. Models in `epidemics` are prefixed with `model` and suffixed by the name of infection (e.g. Ebola) or a different identifier (e.g. default), and whether the model has a R or [C++](../learners/reference.md#cplusplus) code base.
-
-In this tutorial, we will use the default model in `epidemics`, `model_default_cpp()` which is an age-structured SEIR model described by a system of [ordinary differential equations](../learners/reference.md#ordinary). For each age group $i$, individuals are classed as either susceptible $S$, infected but not yet infectious $E$, infectious $I$ or recovered $R$. The schematic below shows the processes which describe the flow of individuals between the disease states $S$, $E$, $I$ and $R$ and the key parameters for each process.
-
-```{r diagram, echo = FALSE, message = FALSE}
-DiagrammeR::grViz("digraph {
-
- # graph statement
- #################
- graph [layout = dot,
- rankdir = LR,
- overlap = true,
- fontsize = 10]
-
- # nodes
- #######
- node [shape = square,
- fixedsize = true
- width = 1.3]
-
- S
- E
- I
- R
-
- # edges
- #######
- S -> E [label = ' infection \n(transmissibility β)']
- E -> I [label = ' onset of infectiousness \n(infectiousness rate α)']
- I -> R [label = ' recovery \n(recovery rate γ)']
-
-}")
-```
-
-
-::::::::::::::::::::::::::::::::::::: callout
-### Model parameters : rates
-
-In ODE models, model parameters are often (but not always) specified as rates. The rate at which an event occurs is the inverse of the average time until that event. For example, in the SEIR model, the recovery rate $\gamma$ is the inverse of the average infectious period.
-
-We can use knowledge of the natural history of the disease to inform our values of rates. If the average infectious period of an infection is 8 days, then the daily recovery rate is $\gamma = 1/8 = 0.125$.
-
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-
-For each disease state ($S$, $E$, $I$ and $R$) and age group ($i$), we have an ordinary differential equation describing the rate of change with respect to time.
-
-$$
-\begin{aligned}
-\frac{dS_i}{dt} & = - \beta S_i \sum_j C_{i,j} I_j \\
-\frac{dE_i}{dt} &= \beta S_i\sum_j C_{i,j} I_j - \alpha E_i \\
-\frac{dI_i}{dt} &= \alpha E_i - \gamma I_i \\
-\frac{dR_i}{dt} &=\gamma I_i \\
-\end{aligned}
-$$
-Individuals in age group ($i$) move from the susceptible state ($S_i$) to the exposed state ($E_i$) via age group specific contact with the infectious individuals in their own and other age groups $\beta S_i \sum_j C_{i,j} I_j$. The contact matrix $C$ allows for heterogeneity in contacts between age groups. They then move to the infectious state at a rate $\alpha$ and recover at a rate $\gamma$. There is no loss of immunity (there are no flows out of the recovered state).
-
-The model parameters definitions are :
-
-- transmission rate or transmissibility $\beta$,
-- [contact matrix](../learners/reference.md#contact) $C$ containing the frequency of contacts between age groups (a square $i \times j$ matrix),
-- infectiousness rate $\alpha$ (preinfectious period ([latent period](../learners/reference.md#latent)) =$1/\alpha$),
-- recovery rate $\gamma$ (infectious period = $1/\gamma$).
-
-
-::::::::::::::::::::::::::::::::::::: callout
-### Exposed, infected, infectious
-
-Confusion sometimes arises when referring to the terms 'exposed', 'infected' and 'infectious' in mathematical modelling. Infection occurs after a person has been exposed, but in modelling terms individuals that are 'exposed' are treated as already infected.
-
-We will use the following definitions for our state variables:
-
-+ $E$ = Exposed : infected **but not yet** infectious,
-+ $I$ = Infectious: infected **and** infectious.
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-
-To generate trajectories using our model, we must prepare the following inputs :
-
-1. Contact matrix
-2. Initial conditions
-3. Population structure
-4. Model parameters
-
-### 1. Contact matrix
-
-Contact matrices can be estimated from surveys or contact data, or synthetic ones can be used. We will use the R package `{socialmixr}` to load in a contact matrix estimated from POLYMOD survey data [(Mossong et al. 2008)](https://doi.org/10.1371/journal.pmed.0050074).
-
-
-::::::::::::::::::::::::::::::::::::: challenge
-
-## Load contact and population data
-
-Using the R package `socialmixr`, run the following lines of R code to obtain the contact matrix for the United Kingdom for the year age bins:
-
-+ age between 0 and 20 years,
-+ age between 20 and 40,
-+ 40 years and over.
-
-```r
-polymod <- socialmixr::polymod
-contact_data <- socialmixr::contact_matrix(
- survey = polymod,
- countries = "United Kingdom",
- age.limits = c(0, 20, 40),
- symmetric = TRUE
-)
-# prepare contact matrix
-contact_matrix <- t(contact_data$matrix)
-contact_matrix
-```
-
-:::::::::::::::::::::::: solution
-
-## Output
-
-```{r polymod_uk, echo = FALSE, message = FALSE}
-polymod <- socialmixr::polymod
-contact_data <- socialmixr::contact_matrix(
- polymod,
- countries = "United Kingdom",
- age.limits = c(0, 20, 40),
- symmetric = TRUE
-)
-# prepare contact matrix
-contact_matrix <- t(contact_data$matrix)
-contact_matrix
-```
-
-
-:::::::::::::::::::::::::::::::::
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-The result is a square matrix with rows and columns for each age group. Contact matrices can be loaded from other sources, but they must be formatted as a matrix to be used in `epidemics`.
-
-::::::::::::::::::::::::::::::::::::: callout
-### Why would a contact matrix be non-symmetric?
-
-One of the arguments of the function `contact_matrix()` is `symmetric=TRUE`. This means that the total number of contacts of age group 1 with age group 2, should be the same as the total number of contacts of age group 2 and age group 1 (see the `socialmixr` [vignette](https://cran.r-project.org/web/packages/socialmixr/vignettes/socialmixr.html) for more detail). However, when contact matrices are estimated from surveys or other sources, the *reported* number of contacts may differ by age group resulting in a non-symmetric contact matrix [(Prem et al 2021)](https://doi.org/10.1371/journal.pcbi.1009098).
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-
-### 2. Initial conditions
-
-The initial conditions are the proportion of individuals in each disease state $S$, $E$, $I$ and $R$ for each age group at time 0. In this example, we have three age groups age between 0 and 20 years, age between 20 and 40 years and over. Let's assume that in the youngest age category, one in a million individuals are infectious, and the remaining age categories are infection free.
-
-The initial conditions in the first age category are $S(0)=1-\frac{1}{1,000,000}$, $E(0) =0$, $I(0)=\frac{1}{1,000,000}$, $R(0)=0$. This is specified as a vector as follows:
-
-```{r initial_inf}
-initial_i <- 1e-6
-initial_conditions_inf <- c(
- S = 1 - initial_i, E = 0, I = initial_i, R = 0, V = 0
-)
-```
-
-For the age categories that are free from infection, the initial conditions are $S(0)=1$, $E(0) =0$, $I(0)=0$, $R(0)=0$. We specify this as follows,
-
-```{r initial_free}
-initial_conditions_free <- c(
- S = 1, E = 0, I = 0, R = 0, V = 0
-)
-```
-
-We combine the three initial conditions vectors into one matrix,
-
-```{r initial condtions}
-# combine the initial conditions
-initial_conditions <- rbind(
- initial_conditions_inf, # age group 1
- initial_conditions_free, # age group 2
- initial_conditions_free # age group 3
-)
-
-# use contact matrix to assign age group names
-rownames(initial_conditions) <- rownames(contact_matrix)
-initial_conditions
-```
-
-
-
-
-### 3. Population structure
-The population object requires a vector containing the demographic structure of the population. The demographic vector must be a named vector containing the number of individuals in each age group of our given population. In this example, we can extract the demographic information from the `contact_data` object that we obtained using the `socialmixr` package.
-
-```{r demography}
-demography_vector <- contact_data$demography$population
-names(demography_vector) <- rownames(contact_matrix)
-demography_vector
-```
-
-To create our population object, we call the function `population()` specifying a name, the contact matrix, the demography vector and the initial conditions.
-
-```{r population}
-uk_population <- population(
- name = "UK",
- contact_matrix = contact_matrix,
- demography_vector = demography_vector,
- initial_conditions = initial_conditions
-)
-```
-
-
-### 4. Model parameters
-
-To run our model we need to specify the model parameters:
-
-- transmissibility $\beta$,
-- infectiousness rate $\alpha$ (preinfectious period=$1/\alpha$),
-- recovery rate $\gamma$ (infectious period=$1/\gamma$).
-
-In `epidemics`, we specify the model inputs as :
-
-- `transmissibility` = $R_0 \gamma$,
-- `infectiousness_rate` = $\alpha$,
-- `recovery_rate` = $\gamma$,
-
-We will simulate a strain of influenza with pandemic potential with $R_0=1.46$, a preinfectious period of 3 days and infectious period of 7 days. Therefore our inputs will be:
-
-- `transmissibility = 1.46 / 7.0`,
-- `infectiousness_rate = 1.0 / 3.0`,
-- `recovery_rate = 1.0 / 7.0`.
-
-::::::::::::::::::::::::::::::::::::: callout
-### The basic reproduction number $R_0$
-The basic reproduction number, $R_0$, for the SEIR model is:
-
-$$ R_0 = \frac{\beta}{\gamma}.$$
-
-Therefore, we can rewrite transmissibility $\beta$, as:
-
-$$ \beta = R_0 \gamma.$$
-
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-
-
-
-
-## Running the model
-
-::::::::::::::::::::::::::::::::::::: callout
-### Running (solving) the model
-
-For models that are described by ODEs, running the model actually means to solve the system of ODEs. ODEs describe the rate of change in the disease states with respect to time, to find the number of individuals in each of these states, we use numerical integration methods to solve the equations.
-
-In `epidemics`, the [ODE solver](https://www.boost.org/doc/libs/1_82_0/libs/numeric/odeint/doc/html/index.htm) uses the [Runge-Kutta method](https://en.wikipedia.org/wiki/Runge%E2%80%93Kutta_methods).
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-Now we are ready to run our model. Let's load the `epidemics` package :
-
-```{r loading}
-library(epidemics)
-```
-
-Then we specify `time_end=600` to run the model for 600 days.
-```{r run_model}
-output <- model_default_cpp(
- population = uk_population,
- transmissibility = 1.46 / 7.0,
- infectiousness_rate = 1.0 / 3.0,
- recovery_rate = 1.0 / 7.0,
- time_end = 600, increment = 1.0
-)
-head(output)
-```
-
-*Note : This model also has the functionality to include vaccination and tracks the number of vaccinated individuals through time. Even though we have not specified any vaccination, there is still a vaccinated compartment in the output (containing no individuals). We will cover the use of vaccination in future tutorials.*
-
-Our model output consists of the number of individuals in each compartment in each age group through time. We can visualise the infectious individuals only (those in the $I$ class) through time.
-
-```{r visualise, fig.width = 10}
-filter(output_plot, compartment %in% c("exposed", "infectious")) %>%
- ggplot(
- aes(
- x = time,
- y = value,
- col = demography_group,
- linetype = compartment
- )
- ) +
- geom_line(
- linewidth = 1.2
- ) +
- scale_y_continuous(
- labels = scales::comma
- ) +
- scale_colour_brewer(
- palette = "Dark2",
- name = "Age group"
- ) +
- expand_limits(
- y = c(0, 500e3)
- ) +
- coord_cartesian(
- expand = FALSE
- ) +
- theme_bw(
- base_size = 15
- ) +
- theme(
- legend.position = "top"
- ) +
- labs(
- x = "Simulation time (days)",
- linetype = "Compartment",
- y = "Individuals"
- )
-```
-
-
-::::::::::::::::::::::::::::::::::::: callout
-### Time increments
-
-Note that there is a default argument of `increment = 1`. This relates to the time step of the ODE solver. When the parameters are specified on a daily time-scale and maximum number of time steps (`time_end`) is days, the default time step of the ODE solver one day.
-
-The choice of increment will depend on the time scale of the parameters, and the rate at which events can occur. In general, the increment should smaller than the fastest event. For example, if parameters are on a monthly time scale, but some events will occur within a month, then the increment should be less than one month.
-
-::::::::::::::::::::::::::::::::::::::::::::::::
-
-## Accounting for uncertainty
-
-As the epidemic model is [deterministic](../learners/reference.md#deterministic), we have one trajectory for our given parameter values. In practice, we have uncertainty in the value of our parameters. To account for this, we must run our model for different parameter combinations.
-
-We ran our model with $R_0= 1.5$. However, we believe that $R_0$ follows a normal distribution with mean 1.5 and standard deviation 0.05. To account for uncertainty we will run the model for different values of $R_0$. The steps we will follow to do this are:
-
-1. Obtain 100 samples from the from a normal distribution
-
-```{r normal, echo = TRUE}
-R0_vec <- rnorm(100, 1.5, 0.05)
-```
-
-2. Run the model 100 times with $R_0$ equal to a different sample each time
-
-```{r samples}
-output_samples <- Map(
- R0_vec,
- seq_along(R0_vec),
- f = function(x, i) {
- # run an epidemic model using `epidemic()`
- output <- model_default_cpp(
- population = uk_population,
- transmissibility = x / 7.0,
- infectiousness_rate = 1.0 / 3.0,
- recovery_rate = 1.0 / 7.0,
- time_end = 600, increment = 1.0
- )
-
- # add replicate number and return data
- output$replicate <- x
- output
- }
-)
-
-# combine to prepare for plotting
-output_samples <- bind_rows(output_samples)
-```
-
-
-3. Calculate the mean and 95% quantiles of number of infectious individuals across each model simulation and visualise output
-
-```{r plot, fig.width = 10}
-ggplot(
- output_samples[output_samples$compartment == "infectious", ],
- aes(time, value)
-) +
- stat_summary(geom = "line", fun = mean) +
- stat_summary(
- geom = "ribbon",
- fun.min = function(z) {
- quantile(z, 0.025)
- },
- fun.max = function(z) {
- quantile(z, 0.975)
- },
- alpha = 0.3
- ) +
- facet_grid(
- cols = vars(demography_group)
- ) +
- labs(
- x = "Simulation time (days)",
- y = "Individuals"
- ) +
- theme_bw(
- base_size = 15
- )
-```
-
-
-Deciding which parameters to include uncertainty in depends on a few factors: how well informed a parameter value is e.g. consistency of estimates from the literature; how sensitive model outputs are to parameter value changes; and the purpose of the modelling task. See [McCabe et al. 2021](https://doi.org/10.1016%2Fj.epidem.2021.100520) to learn about different types of uncertainty in infectious disease modelling.
-
-## Summary
-
-In this tutorial, we have learnt how to simulate disease spread using a mathematical model. Once a model has been chosen, the parameters and other inputs must be specified in the correct way to perform model simulations. In the next tutorial, we will consider how to choose the right model for different tasks.
-
-::::::::::::::::::::::::::::::::::::: keypoints
-
-- Disease trajectories can be generated using the R package `epidemics`
-- Uncertainty should be included in model trajectories using a range of model parameter values
-
-::::::::::::::::::::::::::::::::::::::::::::::::
diff --git a/index.md b/index.md
index f81c8e37..289f4f94 100644
--- a/index.md
+++ b/index.md
@@ -2,37 +2,7 @@
site: sandpaper::sandpaper_site
---
-## Epiverse-TRACE tutorials
-
-The Epiverse-TRACE tutorials are training materials for Outbreak Analysis tasks aimed at [learners](../profiles.md) who are willing to achieve basic competence in modelling and analytics.
-
-The tutorials are built around the workflow of outbreak analysis split into three stages : early tasks, middle tasks and late tasks.
-
-![An overview of the tutorial topics](https://epiverse-trace.github.io/task_pipeline-minimal.svg)
-
-Task topics consist of one or more episodes. You can navigate to different episodes using the menu on the left hand side. Alternatively, you may find the topic you are interested in the [key points](../key-points.md) of each episode.
-
-Each episode contains:
-
-+ **Overview** : describes what questions will be answered and what are the objectives of the episode.
-+ **Prerequisites**: describes what episodes/packages need to be covered before the current episode.
-+ **Example R code** : work through the episodes on your own computer using the example R code.
-+ **Challenges** : complete challenges to test your understanding.
-+ **Explainers** : add to your understanding of mathematical and modelling concepts with the explainer boxes.
-
-Also check out the [glossary](../reference.md) for any terms you may be unfamiliar with.
-
-## Related projects
-
-+ R package vignettes : for R package `{package}` find the vignette located at `https://epiverse-trace.github.io/{package}/`. [Look at all Epiverse-TRACE packages in our developer space](https://epiverse-trace.github.io/).
-+ [How-to guides](https://epiverse-trace.github.io/howto/) : reproducible recipes with concrete steps to solve specific Outbreak Analysis questions.
-+ [The Epidemiologist R Handbook](https://www.epirhandbook.com/en/index.html) : Quick R code reference manual with task-centered examples that address common epidemiological problems.
-+ *COMING SOON* case studies : reproducible case-studies of outbreak data analysis tasks using R packages.
-
-
-
-This tutorial was built with [The Carpentries Workbench][workbench].
-
-
-[workbench]: https://carpentries.github.io/sandpaper-docs
+This is an [Epiverse-TRACE][epiversetrace] tutorial built with [The Carpentries Workbench][workbench].
+[epiversetrace]: https://epiverse-trace.github.io/
+[workbench]: https://carpentries.github.io/workbench/
diff --git a/learners/reference.md b/learners/reference.md
index a82bc12c..5d5e0d46 100644
--- a/learners/reference.md
+++ b/learners/reference.md
@@ -89,20 +89,23 @@ This can be different to the [incubation period](#incubation) as shown in Figure
## N
+
+[Natural history of disease]{#naturalhistory}
+: Refers to the development of disease from beginning to end without any treatment or intervention. In fact, given the harmfulness of an epidemic, treatment or intervention measures are inevitable. Therefore, it is difficult for the natural history of a disease to be unaffected by the various coupling factors. ([Xiang et al, 2021](https://www.sciencedirect.com/science/article/pii/S2468042721000038))
+
[Non-pharmaceutical interventions]{#NPIs}
: Non-pharmaceutical interventions (NPIs) are measures put in place to reduce transmission that do not include the administration of drugs or vaccinations. [More information on NPIs](https://www.gov.uk/government/publications/technical-report-on-the-covid-19-pandemic-in-the-uk/chapter-8-non-pharmaceutical-interventions).
## O
[Ordinary differential equations]{#ordinary}
: Ordinary differential equations (ODEs) can be used to represent the rate of change of one variable (e.g. number of infected individuals) with respect to another (e.g. time). Check out this introduction to [ODEs](https://mathinsight.org/ordinary_differential_equation_introduction). ODEs are widely used in infectious disease modelling to model the flow of individuals between different disease states.
-[Natural history of disease]{#naturalhistory}
-: Refers to the development of disease from beginning to end without any treatment or intervention. In fact, given the harmfulness of an epidemic, treatment or intervention measures are inevitable. Therefore, it is difficult for the natural history of a disease to be unaffected by the various coupling factors. ([Xiang et al, 2021](https://www.sciencedirect.com/science/article/pii/S2468042721000038))
-
-## O
[Offspring distribution]{#offspringdist}
: Distribution of the number of secondary cases caused by a particular infected individual. ([Lloyd-Smith et al., 2005](https://www.nature.com/articles/nature04153), [Endo et al., 2020](https://wellcomeopenresearch.org/articles/5-67/v3))
+[Outbreak analytics]{#outbreakanalytics}
+: A specialized field within data science that focuses on the technological and methodological aspects of the outbreak data pipeline. This includes the systematic collection, analysis, modeling, and reporting of data to inform outbreak response ([Polonsky et al., 2019](https://royalsocietypublishing.org/doi/full/10.1098/rstb.2018.0276)).
+
## P
[(Dynamical or Epidemic) Phase bias]{#phasebias}
@@ -116,6 +119,8 @@ It is a type of sampling bias. It affects backward-looking data and is related t
[Reporting delay]{#reportingdelay}
: Delay or lag between the time an event occurs (e.g. symptom onset) and the time it is reported ([Lawless, 1994](https://www.jstor.org/stable/3315820)). We can quantify it by comparing the linelist with successive versions of it or up-to-date reported aggregated case counts ([Cori et al. 2017](https://royalsocietypublishing.org/doi/10.1098/rstb.2016.0371)).
+[RDBMS]{#RDBMS}
+: Relational DataBase Management System.
## S
[State variables]{#state}
diff --git a/learners/setup.md b/learners/setup.md
index 47742e35..0b5d6067 100644
--- a/learners/setup.md
+++ b/learners/setup.md
@@ -2,80 +2,336 @@
title: Setup
---
-## Software Setup
+## Motivation
+
+**Outbreaks** appear with different diseases and in different contexts, but what all of them have in common is the key public health questions ([Cori et al. 2017](https://royalsocietypublishing.org/doi/10.1098/rstb.2016.0371#d1e605)). We can relate these key public health questions to outbreak data analysis tasks.
+
+Epiverse-TRACE aims to provide a software ecosystem for [**outbreak analytics**](reference.md#outbreakanalytics) with integrated, generalisable and scalable community-driven software. We support the development of R packages, make the existing ones interoperable for the user experience, and stimulate a community of practice.
+
+### Epiverse-TRACE tutorials
+
+The tutorials are built around an outbreak analysis pipeline split into three stages: **Early tasks**, **Middle tasks** and **Late tasks**.
+
+
+
+
+Each task has its tutorial website. Each tutorial website consists of a set of episodes.
+
+| [Early task tutorials ➠](https://epiverse-trace.github.io/tutorials-early/) | [Middle task tutorials ➠](https://epiverse-trace.github.io/tutorials-middle) | [Late task tutorials ➠](https://epiverse-trace.github.io/tutorials-late/) |
+|---|---|---|
+| Read and clean case data, and make linelist | Real-time analysis and forecasting | Scenario modelling |
+| Read, clean and validate case data, convert linelist data to incidence for visualization. | Access delay distributions and estimate transmission metrics, forecast cases, estimate severity and superspreading. | Simulate disease spread and investigate interventions. |
+
+Each episode contains:
+
++ **Overview**: describes what questions will be answered and what are the objectives of the episode.
++ **Prerequisites**: describes what episodes/packages need to be covered before the current episode.
++ **Example R code**: work through the episodes on your own computer using the example R code.
++ **Challenges**: complete challenges to test your understanding.
++ **Explainers**: add to your understanding of mathematical and modelling concepts with the explainer boxes.
+
+Also check out the [glossary](../reference.md) for any terms you may be unfamiliar with.
+
+### Epiverse-TRACE R packages
+
+Our strategy is to gradually incorporate specialised **R packages** into a traditional analysis pipeline. These packages should fill the gaps in these epidemiology-specific tasks in response to outbreaks.
-::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: instructor
+![I](episodes/fig/pkgs-hexlogos-2.png).
-Setup instructions live in this document. Please specify the tools and the data sets the learner needs to have installed. If you want to hide different setup instructions, you can use a `solution` tag.
+
+
-::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:::::::::::::::::::::::::::: prereq
-### Install R and RStudio
+This content assumes intermediate R knowledge. This tutorials are for you if:
+
+- You can read data into R, transform and reshape data, and make a wide variety of graphs
+- You are familiar with functions from `{dplyr}`, `{tidyr}`, and `{ggplot2}`
+- You can use the magrittr pipe `%>%` and/or native pipe `|>`.
+
+
+We expect learners to have some exposure to basic Statistical, Mathematical and Epidemic theory concepts, but NOT intermediate or expert familiarity with modeling.
+
+::::::::::::::::::::::::::::
+
+## Software Setup
+
+Follow these two steps:
+
+### 1. Install or upgrade R and RStudio
R and RStudio are two separate pieces of software:
* **R** is a programming language and software used to run code written in R.
-* **RStudio** is an integrated development environment (IDE) that makes using R easier. In this tutorial, we use RStudio to interact with R.
+* **RStudio** is an integrated development environment (IDE) that makes using R easier. We recommend to use RStudio to interact with R.
+
+To install R and RStudio, follow these instructions .
+
+::::::::::::::::::::::::::::: callout
+
+### Already installed?
+
+Hold on: This is a great time to make sure your R installation is current.
-If you don't already have `R` and `RStudio` installed, follow the instructions for your operating system at .
+This tutorial requires **R version 4.0.0 or later**.
-### Update R and RStudio
+:::::::::::::::::::::::::::::
-This tutorial requires R version 4.0.0 or later.
+To check if your R version is up to date:
-If you already have R and RStudio installed, first check if your R version is up to date:
+- In RStudio your R version will be printed in [the console window](https://docs.posit.co/ide/user/ide/guide/code/console.html). Or run `sessionInfo()`.
-* When you open RStudio your R version will be printed in the console on the [console window](https://docs.posit.co/ide/user/ide/guide/code/console.html). Alternatively, you can type `sessionInfo()` into the console.
+- **To update R**, download and install the latest version from the [R project website](https://cran.rstudio.com/) for your operating system.
-* If your version of R is older than the one required, download and install the latest version of R from the [R project website](https://cran.rstudio.com/) for your operating system.
+ - After installing a new version, you will have to reinstall all your packages with the new version.
-* After installing a new version of R, you will have to reinstall all your packages with the new version. For Windows, there is a package called `installr` that can help you with upgrading your R version and migrating your package library.
+ - For Windows, the `{installr}` package can upgrade your R version and migrate your package library.
-* To update RStudio to the latest version, open RStudio and click on
+- **To update RStudio**, open RStudio and click on
`Help > Check for Updates`. If a new version is available follow the
-instructions on the screen. By default, RStudio will also automatically notify you
-of new versions every once in a while.
+instructions on the screen.
::::::::::::::::::::::::::::: callout
+### Check for Updates regularly
+
While this may sound scary, it is **far more common** to run into issues due to using out-of-date versions of R or R packages. Keeping up with the latest versions of R, RStudio, and any packages you regularly use is a good practice.
:::::::::::::::::::::::::::::
-### Install required R packages
+### 2. Install the required R packages
+
-To try to install these packages, open RStudio and copy and paste the following code chunk into the [console window](https://docs.posit.co/ide/user/ide/guide/code/console.html), then press the Enter (Windows and Linux) or Return (MacOS) to execute the command.
+Open RStudio and **copy and paste** the following code chunk into the [console window](https://docs.posit.co/ide/user/ide/guide/code/console.html), then press the Enter (Windows and Linux) or Return (MacOS) to execute the command:
```r
if(!require("pak")) install.packages("pak")
new_packages <- c(
+ # for episodes on read, clean, validate and visualize linelist
+ "cleanepi",
+ "rio",
+ "here",
+ "DBI",
+ "RSQLite",
+ "dbplyr",
+ "linelist",
+ "epiverse-trace/simulist",
+ "incidence2",
+ "epiverse-trace/tracetheme",
+ "tidyverse",
+ # for episodes on access delays and quantify transmission
"EpiNow2",
"epiverse-trace/epiparameter",
+ # for episodes on forecast and severity
+ "cfr",
+ "outbreaks",
+ # for episodes on superspreading and transmission chains
+ "epicontacts",
+ "fitdistrplus",
+ "epiverse-trace/superspreading",
+ "epichains",
+ # for episodes on simulating transmission scenarios
"socialmixr",
"epiverse-trace/epidemics",
- "tidyverse"
+ "scales"
)
pak::pak(new_packages)
```
+These installation steps could ask you `? Do you want to continue (Y/n)` write `Y` and press Enter.
+
+::::::::::::::::::::::::::::: spoiler
+
+### do you get an error with EpiNow2?
+
+Windows users will need a working installation of `Rtools` in order to build the package from source. `Rtools` is not an R package, but a software you need to download and install. We suggest you to follow:
+
+
+
+1. **Verify `Rtools` installation**. You can do so by using Windows search across your system. Optionally, you can use `{devtools}` running:
+
+```r
+if(!require("devtools")) install.packages("devtools")
+devtools::find_rtools()
+```
+
+If the result is `FALSE`, then you should do step 2.
+
+2. **Install `Rtools`**. Download the `Rtools` installer from . Install with default selections.
+
+3. **Verify `Rtools` installation**. Again, we can use `{devtools}`:
+
+```r
+if(!require("devtools")) install.packages("devtools")
+devtools::find_rtools()
+```
+
+:::::::::::::::::::::::::::::
+
+::::::::::::::::::::::::::::: spoiler
+
+### do you get an error with epiverse-trace packages?
+
+For example, if you get an error message when installing `{simulist}`, try this alternative code:
+
+```r
+# for simulist
+install.packages("simulist", repos = c("https://epiverse-trace.r-universe.dev"))
+```
+
+:::::::::::::::::::::::::::::
+
+::::::::::::::::::::::::::::: spoiler
+
+### do you get an error with other package?
+
+Try using the classical code function to install one package, for example:
+
+```r
+install.packages("rio")
+```
+
+:::::::::::::::::::::::::::::
+
+::::::::::::::::::::::::::: spoiler
+
+### What to do if an Error persist?
+
+If the error message keyword include an string like `Personal access token (PAT)`, you may need to [set up your GitHub token](https://epiverse-trace.github.io/git-rstudio-basics/02-setup.html#set-up-your-github-token).
+
+First, install these R packages:
+
+```r
+if(!require("pak")) install.packages("pak")
+
+new <- c("gh",
+ "gitcreds",
+ "usethis")
+
+pak::pak(new)
+```
+
+Then, follow these three steps to [set up your GitHub token (read this step-by-step guide)](https://epiverse-trace.github.io/git-rstudio-basics/02-setup.html#set-up-your-github-token):
+
+```r
+# Generate a token
+usethis::create_github_token()
+
+# Configure your token
+gitcreds::gitcreds_set()
+
+# Get a situational report
+usethis::git_sitrep()
+```
+
+Try again installing {epiparameter}:
+
+```r
+if(!require("remotes")) install.packages("remotes")
+remotes::install_github("epiverse-trace/epiparameter")
+```
+
+If the error persist, [contact us](#your-questions)!
+
+:::::::::::::::::::::::::::
+
You should update **all of the packages** required for the tutorial, even if you installed them relatively recently. New versions bring improvements and important bug fixes.
When the installation has finished, you can try to load the packages by pasting the following code into the console:
```r
+# for episodes on read, clean, validate and visualize linelist
+library(cleanepi)
+library(rio)
+library(here)
+library(DBI)
+library(RSQLite)
+library(dbplyr)
+library(linelist)
+library(simulist)
+library(incidence2)
+library(tracetheme)
+library(tidyverse)
+# for episodes on access delays and quantify transmission
library(EpiNow2)
library(epiparameter)
+# for episodes on forecast and severity
+library(cfr)
+library(outbreaks)
+# for episodes on superspreading and transmission chains
+library(epicontacts)
+library(fitdistrplus)
+library(superspreading)
+library(epichains)
+# for episodes on simulating transmission scenarios
library(socialmixr)
library(epidemics)
-library(tidyverse)
+library(scales)
```
If you do NOT see an error like `there is no package called ‘...’` you are good to go! If you do, [contact us](#your-questions)!
+### 3. Setup an RStudio project and folder
+
+We suggest to use RStudio Projects.
+
+::::::::::::::::::::::::::::::::: checklist
+
+#### Follow these steps
+
+- **Create an RStudio Project**. If needed, follow this [how-to guide on "Hello RStudio Projects"](https://docs.posit.co/ide/user/ide/get-started/#hello-rstudio-projects) to create a New Project in a New Directory.
+- **Create** the `data/` folder inside the RStudio project or corresponding directory. Use the `data/` folder to **save** the data sets to download.
+
+The directory of an RStudio Project named, for example `training`, should look like this:
+
+```
+training/
+|__ data/
+|__ training.Rproj
+```
+
+**RStudio Projects** allows you to use _relative file_ paths with respect to the `R` Project,
+making your code more portable and less error-prone.
+Avoids using `setwd()` with _absolute paths_
+like `"C:/Users/MyName/WeirdPath/training/data/file.csv"`.
+
+:::::::::::::::::::::::::::::::::
+
+### 4. Create a GitHub Account
+
+We can use [GitHub](https://github.com) as a collaboration platform to communicate package issues and engage in [community discussions](https://github.com/orgs/epiverse-trace/discussions).
+
+::::::::::::::::::::::::::::::::: checklist
+
+#### Follow all these steps
+
+1. Go to and follow the "Sign up" link at the top-right of the window.
+2. Follow the instructions to create an account.
+3. Verify your email address with GitHub.
+
+
+:::::::::::::::::::::::::::::::::
+
+
## Data sets
### Download the data
@@ -84,7 +340,11 @@ We will download the data directly from R during the tutorial. However, if you a
The data files for the tutorial can be downloaded manually here:
--
+-
+-
+-
+-
+-
## Your Questions
diff --git a/renv/activate.R b/renv/activate.R
index cb5401f9..d13f9932 100644
--- a/renv/activate.R
+++ b/renv/activate.R
@@ -2,11 +2,13 @@
local({
# the requested version of renv
- version <- "1.0.3"
+ version <- "1.0.7"
attr(version, "sha") <- NULL
# the project directory
- project <- getwd()
+ project <- Sys.getenv("RENV_PROJECT")
+ if (!nzchar(project))
+ project <- getwd()
# use start-up diagnostics if enabled
diagnostics <- Sys.getenv("RENV_STARTUP_DIAGNOSTICS", unset = "FALSE")
@@ -31,6 +33,14 @@ local({
if (!is.null(override))
return(override)
+ # if we're being run in a context where R_LIBS is already set,
+ # don't load -- presumably we're being run as a sub-process and
+ # the parent process has already set up library paths for us
+ rcmd <- Sys.getenv("R_CMD", unset = NA)
+ rlibs <- Sys.getenv("R_LIBS", unset = NA)
+ if (!is.na(rlibs) && !is.na(rcmd))
+ return(FALSE)
+
# next, check environment variables
# TODO: prefer using the configuration one in the future
envvars <- c(
@@ -50,9 +60,22 @@ local({
})
- if (!enabled)
+ # bail if we're not enabled
+ if (!enabled) {
+
+ # if we're not enabled, we might still need to manually load
+ # the user profile here
+ profile <- Sys.getenv("R_PROFILE_USER", unset = "~/.Rprofile")
+ if (file.exists(profile)) {
+ cfg <- Sys.getenv("RENV_CONFIG_USER_PROFILE", unset = "TRUE")
+ if (tolower(cfg) %in% c("true", "t", "1"))
+ sys.source(profile, envir = globalenv())
+ }
+
return(FALSE)
+ }
+
# avoid recursion
if (identical(getOption("renv.autoloader.running"), TRUE)) {
warning("ignoring recursive attempt to run renv autoloader")
@@ -108,6 +131,21 @@ local({
}
+ heredoc <- function(text, leave = 0) {
+
+ # remove leading, trailing whitespace
+ trimmed <- gsub("^\\s*\\n|\\n\\s*$", "", text)
+
+ # split into lines
+ lines <- strsplit(trimmed, "\n", fixed = TRUE)[[1L]]
+
+ # compute common indent
+ indent <- regexpr("[^[:space:]]", lines)
+ common <- min(setdiff(indent, -1L)) - leave
+ paste(substring(lines, common), collapse = "\n")
+
+ }
+
startswith <- function(string, prefix) {
substring(string, 1, nchar(prefix)) == prefix
}
@@ -610,6 +648,9 @@ local({
# if the user has requested an automatic prefix, generate it
auto <- Sys.getenv("RENV_PATHS_PREFIX_AUTO", unset = NA)
+ if (is.na(auto) && getRversion() >= "4.4.0")
+ auto <- "TRUE"
+
if (auto %in% c("TRUE", "True", "true", "1"))
return(renv_bootstrap_platform_prefix_auto())
@@ -801,24 +842,23 @@ local({
# the loaded version of renv doesn't match the requested version;
# give the user instructions on how to proceed
- remote <- if (!is.null(description[["RemoteSha"]])) {
+ dev <- identical(description[["RemoteType"]], "github")
+ remote <- if (dev)
paste("rstudio/renv", description[["RemoteSha"]], sep = "@")
- } else {
+ else
paste("renv", description[["Version"]], sep = "@")
- }
# display both loaded version + sha if available
friendly <- renv_bootstrap_version_friendly(
version = description[["Version"]],
- sha = description[["RemoteSha"]]
+ sha = if (dev) description[["RemoteSha"]]
)
- fmt <- paste(
- "renv %1$s was loaded from project library, but this project is configured to use renv %2$s.",
- "- Use `renv::record(\"%3$s\")` to record renv %1$s in the lockfile.",
- "- Use `renv::restore(packages = \"renv\")` to install renv %2$s into the project library.",
- sep = "\n"
- )
+ fmt <- heredoc("
+ renv %1$s was loaded from project library, but this project is configured to use renv %2$s.
+ - Use `renv::record(\"%3$s\")` to record renv %1$s in the lockfile.
+ - Use `renv::restore(packages = \"renv\")` to install renv %2$s into the project library.
+ ")
catf(fmt, friendly, renv_bootstrap_version_friendly(version), remote)
FALSE
@@ -1041,7 +1081,7 @@ local({
# if jsonlite is loaded, use that instead
if ("jsonlite" %in% loadedNamespaces()) {
- json <- catch(renv_json_read_jsonlite(file, text))
+ json <- tryCatch(renv_json_read_jsonlite(file, text), error = identity)
if (!inherits(json, "error"))
return(json)
@@ -1050,7 +1090,7 @@ local({
}
# otherwise, fall back to the default JSON reader
- json <- catch(renv_json_read_default(file, text))
+ json <- tryCatch(renv_json_read_default(file, text), error = identity)
if (!inherits(json, "error"))
return(json)
@@ -1063,14 +1103,14 @@ local({
}
renv_json_read_jsonlite <- function(file = NULL, text = NULL) {
- text <- paste(text %||% read(file), collapse = "\n")
+ text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n")
jsonlite::fromJSON(txt = text, simplifyVector = FALSE)
}
renv_json_read_default <- function(file = NULL, text = NULL) {
# find strings in the JSON
- text <- paste(text %||% read(file), collapse = "\n")
+ text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n")
pattern <- '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
locs <- gregexpr(pattern, text, perl = TRUE)[[1]]
@@ -1118,14 +1158,14 @@ local({
map <- as.list(map)
# remap strings in object
- remapped <- renv_json_remap(json, map)
+ remapped <- renv_json_read_remap(json, map)
# evaluate
eval(remapped, envir = baseenv())
}
- renv_json_remap <- function(json, map) {
+ renv_json_read_remap <- function(json, map) {
# fix names
if (!is.null(names(json))) {
@@ -1152,7 +1192,7 @@ local({
# recurse
if (is.recursive(json)) {
for (i in seq_along(json)) {
- json[i] <- list(renv_json_remap(json[[i]], map))
+ json[i] <- list(renv_json_read_remap(json[[i]], map))
}
}
diff --git a/renv/profiles/lesson-requirements/renv.lock b/renv/profiles/lesson-requirements/renv.lock
index 028832b9..f47a05fb 100644
--- a/renv/profiles/lesson-requirements/renv.lock
+++ b/renv/profiles/lesson-requirements/renv.lock
@@ -1,22 +1,10 @@
{
"R": {
- "Version": "4.3.2",
+ "Version": "4.4.0",
"Repositories": [
- {
- "Name": "carpentries",
- "URL": "https://carpentries.r-universe.dev"
- },
- {
- "Name": "carpentries_archive",
- "URL": "https://carpentries.github.io/drat"
- },
{
"Name": "CRAN",
"URL": "https://cran.rstudio.com"
- },
- {
- "Name": "RSPM",
- "URL": "https://packagemanager.posit.co/cran/latest"
}
]
},
@@ -30,46 +18,18 @@
},
"DBI": {
"Package": "DBI",
- "Version": "1.2.1",
+ "Version": "1.2.3",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"methods"
],
- "Hash": "9b4993e98e0e19da84c168460c032fef"
- },
- "DiagrammeR": {
- "Package": "DiagrammeR",
- "Version": "1.0.11",
- "Source": "Repository",
- "Repository": "CRAN",
- "Requirements": [
- "R",
- "RColorBrewer",
- "cli",
- "dplyr",
- "glue",
- "htmltools",
- "htmlwidgets",
- "igraph",
- "magrittr",
- "purrr",
- "readr",
- "rlang",
- "rstudioapi",
- "scales",
- "stringr",
- "tibble",
- "tidyr",
- "viridisLite",
- "visNetwork"
- ],
- "Hash": "584c1e1cbb6f9b6c3b0f4ef0ad960966"
+ "Hash": "065ae649b05f1ff66bb0c793107508f5"
},
"EpiNow2": {
"Package": "EpiNow2",
- "Version": "1.4.0",
+ "Version": "1.6.0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -80,16 +40,16 @@
"RcppEigen",
"RcppParallel",
"StanHeaders",
+ "checkmate",
+ "cli",
"data.table",
"futile.logger",
- "future",
- "future.apply",
"ggplot2",
"lifecycle",
"lubridate",
"methods",
"patchwork",
- "progressr",
+ "posterior",
"purrr",
"rlang",
"rstan",
@@ -100,11 +60,11 @@
"truncnorm",
"utils"
],
- "Hash": "e40c0a2ebd62f69b953b65e9678b2ffe"
+ "Hash": "fbfc77cf8a7e8339f6fd3be28c4436ce"
},
"MASS": {
"Package": "MASS",
- "Version": "7.3-60.0.1",
+ "Version": "7.3-60.2",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -115,11 +75,11 @@
"stats",
"utils"
],
- "Hash": "b765b28387acc8ec9e9c1530713cb19c"
+ "Hash": "2f342c46163b0b54d7b64d1f798e2c78"
},
"Matrix": {
"Package": "Matrix",
- "Version": "1.6-5",
+ "Version": "1.7-0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -132,19 +92,14 @@
"stats",
"utils"
],
- "Hash": "8c7115cd3a0e048bda2a7cd110549f7a"
+ "Hash": "1920b2f11133b12350024297d8a4ff4a"
},
"QuickJSR": {
"Package": "QuickJSR",
- "Version": "1.1.3",
+ "Version": "1.4.0",
"Source": "Repository",
"Repository": "CRAN",
- "Requirements": [
- "R6",
- "Rcpp",
- "jsonlite"
- ],
- "Hash": "765d4f4bcec02ed0663d4de3db23f6e5"
+ "Hash": "7637667f0f9a5fee609506ef049ee202"
},
"R.methodsS3": {
"Package": "R.methodsS3",
@@ -207,18 +162,18 @@
},
"Rcpp": {
"Package": "Rcpp",
- "Version": "1.0.12",
+ "Version": "1.0.13",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"methods",
"utils"
],
- "Hash": "5ea2700d21e038ace58269ecdbeb9ec0"
+ "Hash": "f27411eb6d9c3dada5edd444b8416675"
},
"RcppEigen": {
"Package": "RcppEigen",
- "Version": "0.3.3.9.4",
+ "Version": "0.3.4.0.2",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -227,9 +182,9 @@
"stats",
"utils"
],
- "Hash": "acb0a5bf38490f26ab8661b467f4f53a"
+ "Hash": "4ac8e423216b8b70cb9653d1b3f71eb9"
},
- "RcppParallel": {
+ "RcppParallel": {
"Package": "RcppParallel",
"Version": "5.1.7",
"Source": "Repository",
@@ -241,7 +196,7 @@
},
"StanHeaders": {
"Package": "StanHeaders",
- "Version": "2.32.5",
+ "Version": "2.32.10",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -249,7 +204,19 @@
"RcppEigen",
"RcppParallel"
],
- "Hash": "b8d6850ef3e330bc108e712679e79443"
+ "Hash": "c35dc5b81d7ffb1018aa090dff364ecb"
+ },
+ "abind": {
+ "Package": "abind",
+ "Version": "1.4-8",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "R",
+ "methods",
+ "utils"
+ ],
+ "Hash": "2288423bb0f20a457800d7fc47f6aa54"
},
"askpass": {
"Package": "askpass",
@@ -263,13 +230,13 @@
},
"backports": {
"Package": "backports",
- "Version": "1.4.1",
+ "Version": "1.5.0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R"
],
- "Hash": "c39fbec8a30d23e721980b8afb31984c"
+ "Hash": "e1e1b9d75c37401117b636b7ae50827a"
},
"base64enc": {
"Package": "base64enc",
@@ -283,17 +250,17 @@
},
"bit": {
"Package": "bit",
- "Version": "4.0.5",
+ "Version": "4.5.0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R"
],
- "Hash": "d242abec29412ce988848d0294b208fd"
+ "Hash": "5dc7b2677d65d0e874fc4aaf0e879987"
},
"bit64": {
"Package": "bit64",
- "Version": "4.0.5",
+ "Version": "4.5.2",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -303,7 +270,7 @@
"stats",
"utils"
],
- "Hash": "9fe98599ca456d6552421db0d6772d8f"
+ "Hash": "e84984bf5f12a18628d9a02322128dfd"
},
"blob": {
"Package": "blob",
@@ -319,14 +286,13 @@
},
"broom": {
"Package": "broom",
- "Version": "1.0.5",
+ "Version": "1.0.6",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"backports",
"dplyr",
- "ellipsis",
"generics",
"glue",
"lifecycle",
@@ -336,17 +302,18 @@
"tibble",
"tidyr"
],
- "Hash": "fd25391c3c4f6ecf0fa95f1e6d15378c"
+ "Hash": "a4652c36d1f8abfc3ddf4774f768c934"
},
"bslib": {
"Package": "bslib",
- "Version": "0.6.1",
+ "Version": "0.7.0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"base64enc",
"cachem",
+ "fastmap",
"grDevices",
"htmltools",
"jquerylib",
@@ -357,22 +324,22 @@
"rlang",
"sass"
],
- "Hash": "c0d8599494bc7fb408cd206bbdd9cab0"
+ "Hash": "8644cc53f43828f19133548195d7e59e"
},
"cachem": {
"Package": "cachem",
- "Version": "1.0.8",
+ "Version": "1.1.0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"fastmap",
"rlang"
],
- "Hash": "c35768291560ce302c0a6589f92e837d"
+ "Hash": "cd9a672193789068eb5a2aad65a0dedf"
},
"callr": {
"Package": "callr",
- "Version": "3.7.3",
+ "Version": "3.7.6",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -381,7 +348,7 @@
"processx",
"utils"
],
- "Hash": "9b2191ede20fa29828139b9900922e51"
+ "Hash": "d7e13f49c19103ece9e58ad2d83a7354"
},
"cellranger": {
"Package": "cellranger",
@@ -397,7 +364,7 @@
},
"checkmate": {
"Package": "checkmate",
- "Version": "2.3.1",
+ "Version": "2.3.2",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -405,18 +372,18 @@
"backports",
"utils"
],
- "Hash": "c01cab1cb0f9125211a6fc99d540e315"
+ "Hash": "0e14e01ce07e7c88fd25de6d4260d26b"
},
"cli": {
"Package": "cli",
- "Version": "3.6.2",
+ "Version": "3.6.3",
"Source": "Repository",
- "Repository": "RSPM",
+ "Repository": "CRAN",
"Requirements": [
"R",
"utils"
],
- "Hash": "1216ac65ac55ec0058a6f75d7ca0fd52"
+ "Hash": "b21916dd77a27642b447374a5d30ecf3"
},
"clipr": {
"Package": "clipr",
@@ -428,19 +395,9 @@
],
"Hash": "3f038e5ac7f41d4ac41ce658c85e3042"
},
- "codetools": {
- "Package": "codetools",
- "Version": "0.2-19",
- "Source": "Repository",
- "Repository": "CRAN",
- "Requirements": [
- "R"
- ],
- "Hash": "c089a619a7fae175d149d89164f8c7d8"
- },
"colorspace": {
"Package": "colorspace",
- "Version": "2.1-0",
+ "Version": "2.1-1",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -450,7 +407,7 @@
"methods",
"stats"
],
- "Hash": "f20c47fd52fae58b4e377c37bb8c335b"
+ "Hash": "d954cb1c57e8d8b756165d7ba18aa55a"
},
"conflicted": {
"Package": "conflicted",
@@ -467,27 +424,27 @@
},
"countrycode": {
"Package": "countrycode",
- "Version": "1.5.0",
+ "Version": "1.6.0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R"
],
- "Hash": "bbc5ab5258e5ddf38f2cd2c5a7afa860"
+ "Hash": "08b7058813f13c7a1bb294fea9045e3a"
},
"cpp11": {
"Package": "cpp11",
- "Version": "0.4.7",
+ "Version": "0.5.0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R"
],
- "Hash": "5a295d7d963cc5035284dcdbaf334f4e"
+ "Hash": "91570bba75d0c9d3f1040c835cee8fba"
},
"crayon": {
"Package": "crayon",
- "Version": "1.5.2",
+ "Version": "1.5.3",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -495,32 +452,32 @@
"methods",
"utils"
],
- "Hash": "e8a1e41acf02548751f45c718d55aa6a"
+ "Hash": "859d96e65ef198fd43e82b9628d593ef"
},
"curl": {
"Package": "curl",
- "Version": "5.2.0",
+ "Version": "5.2.1",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R"
],
- "Hash": "ce88d13c0b10fe88a37d9c59dba2d7f9"
+ "Hash": "411ca2c03b1ce5f548345d2fc2685f7a"
},
"data.table": {
"Package": "data.table",
- "Version": "1.15.0",
+ "Version": "1.16.2",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"methods"
],
- "Hash": "cfbbb4aed6e78cd45f17123a9ec9981a"
+ "Hash": "2e00b378fc3be69c865120d9f313039a"
},
"dbplyr": {
"Package": "dbplyr",
- "Version": "2.4.0",
+ "Version": "2.5.0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -544,21 +501,7 @@
"vctrs",
"withr"
],
- "Hash": "59351f28a81f0742720b85363c4fdd61"
- },
- "deSolve": {
- "Package": "deSolve",
- "Version": "1.40",
- "Source": "Repository",
- "Repository": "CRAN",
- "Requirements": [
- "R",
- "grDevices",
- "graphics",
- "methods",
- "stats"
- ],
- "Hash": "0a861334beb4eb8ca0d24a27b28b6679"
+ "Hash": "39b2e002522bfd258039ee4e889e0fd1"
},
"desc": {
"Package": "desc",
@@ -575,14 +518,14 @@
},
"digest": {
"Package": "digest",
- "Version": "0.6.34",
+ "Version": "0.6.35",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"utils"
],
- "Hash": "7ede2ee9ea8d3edbf1ca84c1e333ad1a"
+ "Hash": "698ece7ba5a4fa4559e3d537e7ec3d31"
},
"distcrete": {
"Package": "distcrete",
@@ -593,23 +536,20 @@
},
"distributional": {
"Package": "distributional",
- "Version": "0.3.2",
+ "Version": "0.5.0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
- "digest",
- "farver",
"generics",
- "ggplot2",
"lifecycle",
"numDeriv",
+ "pillar",
"rlang",
- "scales",
"stats",
"utils",
"vctrs"
],
- "Hash": "0a94c3c917918a1c90f4609171ff41b6"
+ "Hash": "76e94de462aa18ea966a38956ecf4497"
},
"dotCall64": {
"Package": "dotCall64",
@@ -663,71 +603,42 @@
],
"Hash": "54ed3ea01b11e81a86544faaecfef8e2"
},
- "ellipsis": {
- "Package": "ellipsis",
- "Version": "0.3.2",
- "Source": "Repository",
- "Repository": "RSPM",
- "Requirements": [
- "R",
- "rlang"
- ],
- "Hash": "bb0eec2fe32e88d9e2836c2f73ea2077"
- },
- "epidemics": {
- "Package": "epidemics",
- "Version": "0.0.0.9000",
- "Source": "GitHub",
- "RemoteType": "github",
- "RemoteUsername": "epiverse-trace",
- "RemoteRepo": "epidemics",
- "RemoteRef": "main",
- "RemoteSha": "f7e33b594768fb1fdac3fb97f9c075c7f9e9ce76",
- "RemoteHost": "api.github.com",
- "Requirements": [
- "BH",
- "Rcpp",
- "RcppEigen",
- "checkmate",
- "cli",
- "data.table",
- "deSolve",
- "glue",
- "stats",
- "utils"
- ],
- "Hash": "3799aa7424ed199ea2f83a439655f1b1"
- },
"epiparameter": {
"Package": "epiparameter",
- "Version": "0.0.0.9000",
+ "Version": "0.2.0.9000",
"Source": "GitHub",
"RemoteType": "github",
- "RemoteUsername": "epiverse-trace",
+ "RemoteHost": "api.github.com",
"RemoteRepo": "epiparameter",
+ "RemoteUsername": "epiverse-trace",
+ "RemotePkgRef": "epiverse-trace/epiparameter",
"RemoteRef": "HEAD",
- "RemoteSha": "7c5a0fb9c732fbfe45177ef055f66e75063e460a",
- "RemoteHost": "api.github.com",
+ "RemoteSha": "54b7bf17cb5ce042801e5e3aeed8e8de7a11d5d3",
"Requirements": [
"R",
"checkmate",
+ "cli",
"distcrete",
"distributional",
+ "graphics",
+ "lifecycle",
+ "pillar",
+ "rlang",
"stats",
"utils"
],
- "Hash": "024a8c8a100fcd73dcf92522d7ef2e35"
+ "Hash": "6a21a52ab0e43556e354beeee47c3c1c"
},
"evaluate": {
"Package": "evaluate",
- "Version": "0.23",
+ "Version": "0.24.0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"methods"
],
- "Hash": "daf4a1246be12c1fa8c7705a0935c1a0"
+ "Hash": "a1066cbc05caee9a4bf6d90f194ff4da"
},
"fansi": {
"Package": "fansi",
@@ -743,17 +654,17 @@
},
"farver": {
"Package": "farver",
- "Version": "2.1.1",
+ "Version": "2.1.2",
"Source": "Repository",
"Repository": "CRAN",
- "Hash": "8106d78941f34855c440ddb946b8f7a5"
+ "Hash": "680887028577f3fa2a81e410ed0d6e42"
},
"fastmap": {
"Package": "fastmap",
- "Version": "1.1.1",
+ "Version": "1.2.0",
"Source": "Repository",
"Repository": "CRAN",
- "Hash": "f7736a18de97dea803bde0a2daaafb27"
+ "Hash": "aa5e1cd11c2d15497494c5292d7ffcc8"
},
"fields": {
"Package": "fields",
@@ -809,14 +720,14 @@
},
"fs": {
"Package": "fs",
- "Version": "1.6.3",
+ "Version": "1.6.4",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"methods"
],
- "Hash": "47b5f30c720c23999b913a1a635cf0bb"
+ "Hash": "15aeb8c27f5ea5161f9f6a641fafd93a"
},
"futile.logger": {
"Package": "futile.logger",
@@ -841,35 +752,6 @@
],
"Hash": "0d9bf02413ddc2bbe8da9ce369dcdd2b"
},
- "future": {
- "Package": "future",
- "Version": "1.33.1",
- "Source": "Repository",
- "Repository": "CRAN",
- "Requirements": [
- "digest",
- "globals",
- "listenv",
- "parallel",
- "parallelly",
- "utils"
- ],
- "Hash": "e57e292737f7a4efa9d8a91c5908222c"
- },
- "future.apply": {
- "Package": "future.apply",
- "Version": "1.11.1",
- "Source": "Repository",
- "Repository": "CRAN",
- "Requirements": [
- "R",
- "future",
- "globals",
- "parallel",
- "utils"
- ],
- "Hash": "455e00c16ec193c8edcf1b2b522b3288"
- },
"gargle": {
"Package": "gargle",
"Version": "1.5.2",
@@ -905,7 +787,7 @@
},
"ggplot2": {
"Package": "ggplot2",
- "Version": "3.4.4",
+ "Version": "3.5.1",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -926,29 +808,18 @@
"vctrs",
"withr"
],
- "Hash": "313d31eff2274ecf4c1d3581db7241f9"
- },
- "globals": {
- "Package": "globals",
- "Version": "0.16.2",
- "Source": "Repository",
- "Repository": "CRAN",
- "Requirements": [
- "R",
- "codetools"
- ],
- "Hash": "baa9585ab4ce47a9f4618e671778cc6f"
+ "Hash": "44c6a2f8202d5b7e878ea274b1092426"
},
"glue": {
"Package": "glue",
- "Version": "1.7.0",
+ "Version": "1.8.0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"methods"
],
- "Hash": "e0b3a53876554bd45879e596cdb10a52"
+ "Hash": "5899f1eaa825580172bb56c08266f37c"
},
"googledrive": {
"Package": "googledrive",
@@ -1003,13 +874,6 @@
],
"Hash": "d6db1667059d027da730decdc214b959"
},
- "grates": {
- "Package": "grates",
- "Version": "1.1.0",
- "Source": "Repository",
- "Repository": "CRAN",
- "Hash": "c937fa4cc110a4aabae986a6393dfb15"
- },
"gridExtra": {
"Package": "gridExtra",
"Version": "2.3",
@@ -1026,7 +890,7 @@
},
"gtable": {
"Package": "gtable",
- "Version": "0.3.4",
+ "Version": "0.3.5",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -1037,7 +901,7 @@
"lifecycle",
"rlang"
],
- "Hash": "b29cf3031f49b04ab9c852c912547eef"
+ "Hash": "e18861963cbc65a27736e02b3cd3c4a0"
},
"haven": {
"Package": "haven",
@@ -1062,14 +926,14 @@
},
"highr": {
"Package": "highr",
- "Version": "0.10",
+ "Version": "0.11",
"Source": "Repository",
- "Repository": "RSPM",
+ "Repository": "CRAN",
"Requirements": [
"R",
"xfun"
],
- "Hash": "06230136b2d2b9ba5805e1963fa6e890"
+ "Hash": "d65ba49117ca223614f71b60d85b8ab7"
},
"hms": {
"Package": "hms",
@@ -1087,35 +951,19 @@
},
"htmltools": {
"Package": "htmltools",
- "Version": "0.5.7",
+ "Version": "0.5.8.1",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"base64enc",
"digest",
- "ellipsis",
"fastmap",
"grDevices",
"rlang",
"utils"
],
- "Hash": "2d7b3857980e0e0d0a1fd6f11928ab0f"
- },
- "htmlwidgets": {
- "Package": "htmlwidgets",
- "Version": "1.6.4",
- "Source": "Repository",
- "Repository": "CRAN",
- "Requirements": [
- "grDevices",
- "htmltools",
- "jsonlite",
- "knitr",
- "rmarkdown",
- "yaml"
- ],
- "Hash": "04291cc45198225444a397606810ac37"
+ "Hash": "81d371a9cc60640e74e4ab6ac46dcedc"
},
"httr": {
"Package": "httr",
@@ -1143,43 +991,6 @@
],
"Hash": "99df65cfef20e525ed38c3d2577f7190"
},
- "igraph": {
- "Package": "igraph",
- "Version": "2.0.1.1",
- "Source": "Repository",
- "Repository": "CRAN",
- "Requirements": [
- "Matrix",
- "R",
- "cli",
- "cpp11",
- "grDevices",
- "graphics",
- "lifecycle",
- "magrittr",
- "methods",
- "pkgconfig",
- "rlang",
- "stats",
- "utils"
- ],
- "Hash": "fb2999614d40fe7fd61cf569b66a2dbc"
- },
- "incidence2": {
- "Package": "incidence2",
- "Version": "2.2.3",
- "Source": "Repository",
- "Repository": "CRAN",
- "Requirements": [
- "R",
- "data.table",
- "grDevices",
- "grates",
- "pillar",
- "utils"
- ],
- "Hash": "0e1c66f6d72eacacbd8fe6ba1ed85cc9"
- },
"inline": {
"Package": "inline",
"Version": "0.3.19",
@@ -1223,7 +1034,7 @@
},
"knitr": {
"Package": "knitr",
- "Version": "1.45",
+ "Version": "1.48",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -1235,7 +1046,7 @@
"xfun",
"yaml"
],
- "Hash": "1ec462871063897135c1bcbe0fc8f07d"
+ "Hash": "acf380f300c721da9fde7df115a5f86f"
},
"labeling": {
"Package": "labeling",
@@ -1261,7 +1072,7 @@
},
"lattice": {
"Package": "lattice",
- "Version": "0.22-5",
+ "Version": "0.22-6",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -1272,7 +1083,7 @@
"stats",
"utils"
],
- "Hash": "7c5e89f04e72d6611c77451f6331a091"
+ "Hash": "cc5ac1ba4c238c7ca9fa6a87ca11a7e2"
},
"lifecycle": {
"Package": "lifecycle",
@@ -1287,19 +1098,9 @@
],
"Hash": "b8552d117e1b808b09a832f589b79035"
},
- "listenv": {
- "Package": "listenv",
- "Version": "0.9.1",
- "Source": "Repository",
- "Repository": "CRAN",
- "Requirements": [
- "R"
- ],
- "Hash": "e2fca3e12e4db979dccc6e519b10a7ee"
- },
"loo": {
"Package": "loo",
- "Version": "2.6.0",
+ "Version": "2.8.0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -1307,9 +1108,10 @@
"checkmate",
"matrixStats",
"parallel",
+ "posterior",
"stats"
],
- "Hash": "e5c8f41731502a0e98f353da23f7ca30"
+ "Hash": "b0fe731e5bd801dda962ac5057a548f6"
},
"lubridate": {
"Package": "lubridate",
@@ -1348,13 +1150,13 @@
},
"matrixStats": {
"Package": "matrixStats",
- "Version": "1.2.0",
+ "Version": "1.4.1",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R"
],
- "Hash": "33a3ca9e732b57244d14f5d732ffc9eb"
+ "Hash": "8885ffb1f46e820dede6b2ca9442abca"
},
"memoise": {
"Package": "memoise",
@@ -1414,14 +1216,14 @@
},
"munsell": {
"Package": "munsell",
- "Version": "0.5.0",
+ "Version": "0.5.1",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"colorspace",
"methods"
],
- "Hash": "6dfe8bf774944bd5595785e3229d8771"
+ "Hash": "4fd8900853b746af55b81fda99da7695"
},
"nlme": {
"Package": "nlme",
@@ -1463,33 +1265,34 @@
},
"openssl": {
"Package": "openssl",
- "Version": "2.1.1",
+ "Version": "2.2.0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"askpass"
],
- "Hash": "2a0dc8c6adfb6f032e4d4af82d258ab5"
+ "Hash": "2bcca3848e4734eb3b16103bc9aa4b8e"
},
- "parallelly": {
- "Package": "parallelly",
- "Version": "1.36.0",
+ "pak": {
+ "Package": "pak",
+ "Version": "0.7.2",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
- "parallel",
+ "R",
"tools",
"utils"
],
- "Hash": "bca377e1c87ec89ebed77bba00635b2e"
+ "Hash": "93288e19455e09f590b56db4d50248fe"
},
"patchwork": {
"Package": "patchwork",
- "Version": "1.2.0",
+ "Version": "1.3.0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"cli",
+ "farver",
"ggplot2",
"grDevices",
"graphics",
@@ -1499,7 +1302,7 @@
"stats",
"utils"
],
- "Hash": "9c8ab14c00ac07e9e04d1664c0b74486"
+ "Hash": "e23fb9ecb1258207bcb763d78d513439"
},
"pillar": {
"Package": "pillar",
@@ -1520,7 +1323,7 @@
},
"pkgbuild": {
"Package": "pkgbuild",
- "Version": "1.4.3",
+ "Version": "1.4.4",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -1531,7 +1334,7 @@
"desc",
"processx"
],
- "Hash": "c0143443203205e6a2760ce553dafc24"
+ "Hash": "a29e8e134a460a01e0ca67a4763c595b"
},
"pkgconfig": {
"Package": "pkgconfig",
@@ -1554,6 +1357,28 @@
],
"Hash": "6b8177fd19982f0020743fadbfdbd933"
},
+ "posterior": {
+ "Package": "posterior",
+ "Version": "1.6.0",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "R",
+ "abind",
+ "checkmate",
+ "distributional",
+ "matrixStats",
+ "methods",
+ "parallel",
+ "pillar",
+ "rlang",
+ "stats",
+ "tensorA",
+ "tibble",
+ "vctrs"
+ ],
+ "Hash": "fc1213566f2ed9f0b15bef656ed1000b"
+ },
"prettyunits": {
"Package": "prettyunits",
"Version": "1.2.0",
@@ -1566,16 +1391,16 @@
},
"processx": {
"Package": "processx",
- "Version": "3.8.3",
+ "Version": "3.8.4",
"Source": "Repository",
- "Repository": "RSPM",
+ "Repository": "CRAN",
"Requirements": [
"R",
"R6",
"ps",
"utils"
],
- "Hash": "82d48b1aec56084d9438dbf98087a7e9"
+ "Hash": "0c90a7d71988856bad2a2a45dd871bb9"
},
"progress": {
"Package": "progress",
@@ -1591,28 +1416,16 @@
],
"Hash": "f4625e061cb2865f111b47ff163a5ca6"
},
- "progressr": {
- "Package": "progressr",
- "Version": "0.14.0",
- "Source": "Repository",
- "Repository": "CRAN",
- "Requirements": [
- "R",
- "digest",
- "utils"
- ],
- "Hash": "ac50c4ffa8f6a46580dd4d7813add3c4"
- },
"ps": {
"Package": "ps",
- "Version": "1.7.6",
+ "Version": "1.8.0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"utils"
],
- "Hash": "dd2b9319ee0656c8acf45c7f40c59de7"
+ "Hash": "4b9c8485b0c7eecdf0a9ba5132a45576"
},
"purrr": {
"Package": "purrr",
@@ -1631,14 +1444,14 @@
},
"ragg": {
"Package": "ragg",
- "Version": "1.2.7",
+ "Version": "1.3.2",
"Source": "Repository",
- "Repository": "RSPM",
+ "Repository": "CRAN",
"Requirements": [
"systemfonts",
"textshaping"
],
- "Hash": "90a1b8b7e518d7f90480d56453b4d062"
+ "Hash": "e3087db406e079a8a2fd87f413918ed3"
},
"rappdirs": {
"Package": "rappdirs",
@@ -1705,9 +1518,19 @@
],
"Hash": "76c9e04c712a05848ae7a23d2f170a40"
},
+ "renv": {
+ "Package": "renv",
+ "Version": "1.0.7",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "utils"
+ ],
+ "Hash": "397b7b2a265bc5a7a06852524dabae20"
+ },
"reprex": {
"Package": "reprex",
- "Version": "2.1.0",
+ "Version": "2.1.1",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -1725,22 +1548,22 @@
"utils",
"withr"
],
- "Hash": "1425f91b4d5d9a8f25352c44a3d914ed"
+ "Hash": "97b1d5361a24d9fb588db7afe3e5bcbf"
},
"rlang": {
"Package": "rlang",
- "Version": "1.1.3",
+ "Version": "1.1.4",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"utils"
],
- "Hash": "42548638fae05fd9a9b5f3f437fbbbe2"
+ "Hash": "3eec01f8b1dee337674b2e34ab1f9bc1"
},
"rmarkdown": {
"Package": "rmarkdown",
- "Version": "2.25",
+ "Version": "2.28",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -1753,18 +1576,17 @@
"jsonlite",
"knitr",
"methods",
- "stringr",
"tinytex",
"tools",
"utils",
"xfun",
"yaml"
],
- "Hash": "d65e35823c817f09f4de424fcdfa812a"
+ "Hash": "062470668513dcda416927085ee9bdc7"
},
"rstan": {
"Package": "rstan",
- "Version": "2.32.5",
+ "Version": "2.32.6",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -1783,7 +1605,7 @@
"pkgbuild",
"stats4"
],
- "Hash": "378a10b6373822761ec78021c105b059"
+ "Hash": "8a5b5978f888a3477c116e0395d006f8"
},
"rstantools": {
"Package": "rstantools",
@@ -1801,14 +1623,14 @@
},
"rstudioapi": {
"Package": "rstudioapi",
- "Version": "0.15.0",
+ "Version": "0.16.0",
"Source": "Repository",
"Repository": "CRAN",
- "Hash": "5564500e25cffad9e22244ced1379887"
+ "Hash": "96710351d642b70e8f02ddeb237c46a7"
},
"runner": {
"Package": "runner",
- "Version": "0.4.3",
+ "Version": "0.4.4",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -1817,11 +1639,11 @@
"methods",
"parallel"
],
- "Hash": "468ad9a689459cd083a686232eb3ea31"
+ "Hash": "28a8c14ad9f77d5b275938c65128c7e7"
},
"rvest": {
"Package": "rvest",
- "Version": "1.0.3",
+ "Version": "1.0.4",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -1834,14 +1656,13 @@
"rlang",
"selectr",
"tibble",
- "withr",
"xml2"
],
- "Hash": "a4a5ac819a467808c60e36e92ddf195e"
+ "Hash": "0bcf0c6f274e90ea314b812a6d19a519"
},
"sass": {
"Package": "sass",
- "Version": "0.4.8",
+ "Version": "0.4.9",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -1851,7 +1672,7 @@
"rappdirs",
"rlang"
],
- "Hash": "168f9353c76d4c4b0a0bbf72e2c2d035"
+ "Hash": "d53dbfddf695303ea4ad66f86e99b95d"
},
"scales": {
"Package": "scales",
@@ -1888,7 +1709,7 @@
},
"socialmixr": {
"Package": "socialmixr",
- "Version": "0.3.1",
+ "Version": "0.3.2",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -1900,12 +1721,13 @@
"grDevices",
"httr",
"jsonlite",
+ "lifecycle",
"lubridate",
"oai",
"wpp2017",
"xml2"
],
- "Hash": "216ff8ff8fd4793dc7e80d69fa955671"
+ "Hash": "45662d7e3ca41647455b89c74eb28abf"
},
"spam": {
"Package": "spam",
@@ -1923,16 +1745,16 @@
},
"stringi": {
"Package": "stringi",
- "Version": "1.8.3",
+ "Version": "1.8.4",
"Source": "Repository",
- "Repository": "RSPM",
+ "Repository": "CRAN",
"Requirements": [
"R",
"stats",
"tools",
"utils"
],
- "Hash": "058aebddea264f4c99401515182e656a"
+ "Hash": "39e1144fd75428983dc3f63aa53dfa91"
},
"stringr": {
"Package": "stringr",
@@ -1960,26 +1782,39 @@
},
"systemfonts": {
"Package": "systemfonts",
- "Version": "1.0.5",
+ "Version": "1.1.0",
"Source": "Repository",
- "Repository": "RSPM",
+ "Repository": "CRAN",
"Requirements": [
"R",
- "cpp11"
+ "cpp11",
+ "lifecycle"
],
- "Hash": "15b594369e70b975ba9f064295983499"
+ "Hash": "213b6b8ed5afbf934843e6c3b090d418"
+ },
+ "tensorA": {
+ "Package": "tensorA",
+ "Version": "0.36.2.1",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "R",
+ "stats"
+ ],
+ "Hash": "0d587599172f2ffda2c09cb6b854e0e5"
},
"textshaping": {
"Package": "textshaping",
- "Version": "0.3.7",
+ "Version": "0.4.0",
"Source": "Repository",
- "Repository": "RSPM",
+ "Repository": "CRAN",
"Requirements": [
"R",
"cpp11",
+ "lifecycle",
"systemfonts"
],
- "Hash": "997aac9ad649e0ef3b97f96cddd5622b"
+ "Hash": "5142f8bc78ed3d819d26461b641627ce"
},
"tibble": {
"Package": "tibble",
@@ -2025,7 +1860,7 @@
},
"tidyselect": {
"Package": "tidyselect",
- "Version": "1.2.0",
+ "Version": "1.2.1",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -2037,7 +1872,7 @@
"vctrs",
"withr"
],
- "Hash": "79540e5fcd9e0435af547d885f184fd5"
+ "Hash": "829f27b9c4919c16b593794a6344d6c0"
},
"tidyverse": {
"Package": "tidyverse",
@@ -2092,13 +1927,13 @@
},
"tinytex": {
"Package": "tinytex",
- "Version": "0.49",
+ "Version": "0.52",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"xfun"
],
- "Hash": "5ac22900ae0f386e54f1c307eca7d843"
+ "Hash": "cfbad971a71f0e27cec22e544a08bc3b"
},
"truncnorm": {
"Package": "truncnorm",
@@ -2165,24 +2000,6 @@
],
"Hash": "c826c7c4241b6fc89ff55aaea3fa7491"
},
- "visNetwork": {
- "Package": "visNetwork",
- "Version": "2.1.2",
- "Source": "Repository",
- "Repository": "CRAN",
- "Requirements": [
- "R",
- "grDevices",
- "htmltools",
- "htmlwidgets",
- "jsonlite",
- "magrittr",
- "methods",
- "stats",
- "utils"
- ],
- "Hash": "3e48b097e8d9a91ecced2ed4817a678d"
- },
"vroom": {
"Package": "vroom",
"Version": "1.6.5",
@@ -2209,22 +2026,9 @@
],
"Hash": "390f9315bc0025be03012054103d227c"
},
- "webshot": {
- "Package": "webshot",
- "Version": "0.5.5",
- "Source": "Repository",
- "Repository": "CRAN",
- "Requirements": [
- "R",
- "callr",
- "jsonlite",
- "magrittr"
- ],
- "Hash": "16858ee1aba97f902d24049d4a44ef16"
- },
"withr": {
"Package": "withr",
- "Version": "3.0.0",
+ "Version": "3.0.1",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -2232,7 +2036,7 @@
"grDevices",
"graphics"
],
- "Hash": "d31b6c62c10dcf11ec530ca6b0dd5d35"
+ "Hash": "07909200e8bbe90426fbfeb73e1e27aa"
},
"wpp2017": {
"Package": "wpp2017",
@@ -2247,14 +2051,15 @@
},
"xfun": {
"Package": "xfun",
- "Version": "0.41",
+ "Version": "0.46",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
+ "grDevices",
"stats",
"tools"
],
- "Hash": "460a5e0fe46a80ef87424ad216028014"
+ "Hash": "00ce32f398db0415dde61abfef11300c"
},
"xml2": {
"Package": "xml2",