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 late tasks from feedback #85

Merged
merged 47 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
c996ee7
Extend challenge in 'Choosing an appropriate model'
amanda-minter Nov 9, 2023
f6a9b22
Edit to accounting for uncertainty example
amanda-minter Nov 9, 2023
214cdb4
Add detail to Ebola case study challenge
amanda-minter Nov 13, 2023
1743b9e
update glossary entries
amanda-minter Nov 20, 2023
ae255b8
Add callout on ODE solver
amanda-minter Nov 21, 2023
47459f5
clarify purpose of concept dependencies
amanda-minter Nov 21, 2023
1c5c3a1
Updates from review
amanda-minter Nov 21, 2023
c0bc550
Remove infection object
amanda-minter Nov 21, 2023
29a1ee2
Update simulating-transmission.Rmd
amanda-minter Nov 22, 2023
fdde615
Update model-choices.Rmd
amanda-minter Nov 22, 2023
299839d
Add exercise to `compare_interventions.Rmd`
amanda-minter Nov 23, 2023
4ee6232
update modelling interventions after review
amanda-minter Nov 27, 2023
4687cd0
Update renv.lock
amanda-minter Nov 27, 2023
d02fe46
update plots
amanda-minter Dec 11, 2023
5b179ee
make uncertainty plots consistent across episodes
amanda-minter Dec 11, 2023
8710704
fix broken link
amanda-minter Dec 11, 2023
db46af2
making plots consistent across tutorials
amanda-minter Dec 11, 2023
77a8e93
update summary and key points
amanda-minter Dec 11, 2023
e733715
update plots and add challenge
amanda-minter Dec 11, 2023
28ee601
update introduction
amanda-minter Dec 12, 2023
97b4e87
move contact matrix callout
amanda-minter Dec 12, 2023
5c9480e
add callout on intervention types
amanda-minter Dec 12, 2023
84c2f34
update introduction and reorder text in other sections
amanda-minter Dec 12, 2023
809388f
update PI section
amanda-minter Dec 12, 2023
e57dd29
style code
amanda-minter Dec 12, 2023
495c831
spell check
amanda-minter Dec 12, 2023
01bd1e6
Update compare-interventions.Rmd
amanda-minter Dec 12, 2023
2c59eeb
Apply suggestions from code review
amanda-minter Dec 18, 2023
0528234
Update episodes/modelling-interventions.Rmd
amanda-minter Dec 18, 2023
7ad8389
add dropdown menus to make section more interactive
amanda-minter Dec 18, 2023
eac8a90
add reminder about transmissibility calculation
amanda-minter Dec 19, 2023
55920c7
link to latent period
amanda-minter Dec 19, 2023
f435c1a
update model terms
amanda-minter Dec 19, 2023
2dfaf79
add note on flow diagram
amanda-minter Dec 19, 2023
877aa7a
add callout on model rates
amanda-minter Dec 19, 2023
4420515
Update episodes/simulating-transmission.Rmd
amanda-minter Dec 19, 2023
1ca6148
Update episodes/simulating-transmission.Rmd
amanda-minter Dec 19, 2023
f397811
Update episodes/simulating-transmission.Rmd
amanda-minter Dec 19, 2023
699e179
Update episodes/simulating-transmission.Rmd
amanda-minter Dec 19, 2023
d095420
Update episodes/simulating-transmission.Rmd
amanda-minter Dec 19, 2023
ef0b11f
update tutorial objectives
amanda-minter Dec 19, 2023
9c386ce
Merge branch 'main' into update-late-tasks
amanda-minter Dec 19, 2023
bb95beb
distinguish parameter definitions from process descriptions in flow d…
amanda-minter Dec 21, 2023
c17cfb6
Update model-choices.Rmd
amanda-minter Dec 21, 2023
547490c
remove pak call from set up
amanda-minter Dec 21, 2023
6ee137f
Merge branch 'main' into update-late-tasks
amanda-minter Dec 21, 2023
49dc2a8
Update renv.lock
amanda-minter Dec 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 132 additions & 17 deletions episodes/compare-interventions.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ library(epidemics)

::::::::::::::::::::::::::::::::::::: objectives

- Understand how to compare intervention scenarios
- Compare intervention scenarios

::::::::::::::::::::::::::::::::::::::::::::::::

Expand All @@ -28,7 +28,7 @@ library(epidemics)
## Prerequisites
+ Complete tutorials [Simulating transmission](../episodes/simulating-transmission.md) and [Modelling interventions](../episodes/modelling-interventions.md)

This tutorial has the following concept dependencies:
Learners should familiarise themselves with following concept dependencies before working through this tutorial:

**Outbreak response** : [Intervention types](https://www.cdc.gov/nonpharmaceutical-interventions/).
:::::::::::::::::::::::::::::::::
Expand All @@ -53,7 +53,7 @@ In this tutorial we introduce the concept of the counter factual and how to comp

## 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). The model consists of 11 compartments, individuals are classed as one of the following:
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$),
Expand Down Expand Up @@ -119,42 +119,157 @@ DiagrammeR::grViz("digraph{
}")
```

See `?epidemics::model_vacamole_cpp` for detail on how to run the model.

## Comparing scenarios
::::::::::::::::::::::::::::::::::::: challenge

*Coming soon*
## Running a counterfactual scenario using the Vacamole model

## Challenge
1. Run the model with the default parameter values for the UK population assuming that :

*Coming soon*
+ 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)
```
::::::::::::::::::::::

<!-- ::::::::::::::::::::::::::::::::::::: challenge -->
::::::::::::::::: hint

<!-- ## The effect of vaccination on COVID-19 hospitalisations -->
### 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:


<!-- ::::::::::::::::: hint -->
```{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
)
```

<!-- ### HINT -->


<!-- :::::::::::::::::::::: -->
:::::::::::::::::::::::::::


<!-- ::::::::::::::::: solution -->
::::::::::::::::::::::::::::::::::::::::::::::::

<!-- ### SOLUTION -->


## Comparing scenarios

*Coming soon*


<!-- ::::::::::::::::::::::::::: -->

## Challenge : Ebola outbreak analysis

*Coming soon*

<!-- :::::::::::::::::::::::::::::::::::::::::::::::: -->



Expand Down
Loading
Loading