Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update model function names #55

Merged
merged 13 commits into from
Nov 9, 2023
2 changes: 1 addition & 1 deletion episodes/compare-interventions.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions episodes/model-choices.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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.
amanda-minter marked this conversation as resolved.
Show resolved Hide resolved
avallecam marked this conversation as resolved.
Show resolved Hide resolved

::::::::::::::::::::::::::::::::::::: checklist
### Check model equations
Expand All @@ -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()`
amanda-minter marked this conversation as resolved.
Show resolved Hide resolved

::::::::::::::::: hint

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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()`
amanda-minter marked this conversation as resolved.
Show resolved Hide resolved

A stochastic SEIHFR (Susceptible, Exposed, Infectious, Hospitalised, Funeral, Removed) model that was developed specifically for infection with Ebola.

Expand Down
10 changes: 5 additions & 5 deletions episodes/modelling-interventions.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down Expand Up @@ -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
Expand All @@ -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),
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions episodes/simulating-transmission.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down