From 25860d3c7fb56310ad169b718cd5008920d2cf5f Mon Sep 17 00:00:00 2001 From: Amanda Minter Date: Tue, 7 Nov 2023 09:04:28 +0000 Subject: [PATCH] Update model function names Function names in `{epidemics}` are now `model_X()` --- episodes/compare-interventions.Rmd | 2 +- episodes/model-choices.Rmd | 10 +++++----- episodes/modelling-interventions.Rmd | 10 +++++----- episodes/simulating-transmission.Rmd | 8 ++++---- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/episodes/compare-interventions.Rmd b/episodes/compare-interventions.Rmd index fcd6ec97..6972551f 100644 --- a/episodes/compare-interventions.Rmd +++ b/episodes/compare-interventions.Rmd @@ -121,7 +121,7 @@ DiagrammeR::grViz("digraph{ }") ``` -See `?epidemics::epidemic_vacamole` for detail on how to run the model. +See `?epidemics::model_vacamole_cpp` for detail on how to run the model. ## Comparing scenarios diff --git a/episodes/model-choices.Rmd b/episodes/model-choices.Rmd index 85c8e0ac..282a2cbe 100644 --- a/episodes/model-choices.Rmd +++ b/episodes/model-choices.Rmd @@ -67,7 +67,7 @@ Finally, interventions such as vaccination may be of interest. A model may or ma ### Available models 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::epidemic_ebola`. Remember to use the 'Check model equation' questions to help your understanding of an existing model. +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_cpp`. Remember to use the 'Check model equation' questions to help your understanding of an existing model. ::::::::::::::::::::::::::::::::::::: checklist ### Check model equations @@ -90,9 +90,9 @@ You have been asked to explore the variation in numbers of infected individuals Which of the following models would be an appropriate choice for this task: -+ `epidemic_default` ++ `model_default_cpp()` -+ `epidemic_ebola` ++ `model_ebola_cpp()` ::::::::::::::::: hint @@ -123,7 +123,7 @@ Consider the following questions: + What is the outcome of interest? **Number of infections** + Will any interventions be modelled? **No** -#### `epidemic_default` +#### `model_default_cpp()` A deterministic SEIR model with age specific direct transmission. @@ -157,7 +157,7 @@ DiagrammeR::grViz("digraph { 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. -#### `epidemic_ebola` +#### `model_ebola_cpp()` A stochastic SEIHFR (Susceptible, Exposed, Infectious, Hospitalised, Funeral, Removed) model that was developed specifically for infection with Ebola. diff --git a/episodes/modelling-interventions.Rmd b/episodes/modelling-interventions.Rmd index 61052f23..f2a89a3e 100644 --- a/episodes/modelling-interventions.Rmd +++ b/episodes/modelling-interventions.Rmd @@ -103,7 +103,7 @@ covid <- infection( We want to investigate 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. -Using an SEIR model (`epidemic_default()` in the R package `{epidemics}`) we set $R_0 = 2.7$, 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. +Using an SEIR model (`model_default_cpp()` in the R package `{epidemics}`) we set $R_0 = 2.7$, 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. We will 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). @@ -151,7 +151,7 @@ close_schools <- intervention( ``` ```{r baseline, echo = FALSE} -output <- epidemic_default_cpp( +output <- model_default_cpp( population = uk_population, infection = covid, time_end = 300, increment = 1.0 @@ -162,7 +162,7 @@ output <- epidemic_default_cpp( To run the model with an intervention we set ` intervention = list(contacts = close_schools)` as follows: ```{r school} -output_school <- epidemic_default_cpp( +output_school <- model_default_cpp( population = uk_population, infection = covid, intervention = list(contacts = close_schools), @@ -244,7 +244,7 @@ mask_mandate <- intervention( To implement this intervention on the parameter $\beta$, we specify `intervention = list(beta = mask_mandate)`. ```{r output_masks} -output_masks <- epidemic_default_cpp( +output_masks <- model_default_cpp( population = uk_population, infection = covid, intervention = list(beta = mask_mandate), @@ -370,7 +370,7 @@ vaccinate <- vaccination( We pass our vaccination object using `vaccination = vaccinate`: ```{r output_vaccinate} -output_vaccinate <- epidemic_default_cpp( +output_vaccinate <- model_default_cpp( population = uk_population, infection = covid, vaccination = vaccinate, diff --git a/episodes/simulating-transmission.Rmd b/episodes/simulating-transmission.Rmd index c7453874..05262740 100644 --- a/episodes/simulating-transmission.Rmd +++ b/episodes/simulating-transmission.Rmd @@ -106,7 +106,7 @@ influenza <- infection( ) # run an epidemic model using `epidemic()` -output <- epidemic_default_cpp( +output <- model_default_cpp( population = uk_population, infection = influenza, time_end = 600, increment = 1.0 @@ -156,7 +156,7 @@ pak::pak("epiverse-trace/epidemics") ## Model structures 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 are prefixed with epidemic and suffixed by the infection name. In this tutorial, we will use the default epidemic model, `epidemic_default()` which is described in the next section. +There is a library of models to choose from in `epidemics`. Models 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++ code base. In this tutorial, we will use the default epidemic model, `model_default_cpp()` which is described in the next section. ::::::::::::::::::::::::::::::::::::: callout @@ -418,7 +418,7 @@ uk_population <- population( No we are ready to run our model. We will specify `time_end=600` to run the model for 600 days. ```{r run_model} -output <- epidemic_default_cpp( +output <- model_default_cpp( population = uk_population, infection = influenza, time_end = 600 @@ -492,7 +492,7 @@ output_samples <- Map( ) # run an epidemic model using `epidemic()` - output <- epidemic_default_cpp( + output <- model_default_cpp( population = uk_population, infection = influenza, time_end = 600, increment = 1.0