Skip to content

Commit 6381308

Browse files
amanda-minteradamkucharski
authored andcommitted
Apply suggestions from code review
Co-authored-by: Adam Kucharski <adam.kucharski@lshtm.ac.uk>
1 parent ce1c4f3 commit 6381308

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

episodes/disease-burden.Rmd

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ exercises: 10 # exercise time in minutes
66

77
:::::::::::::::::::::::::::::::::::::: questions
88

9-
- How can we model disease burden?
9+
- How can we model disease burden and healthcare demand?
1010

1111
::::::::::::::::::::::::::::::::::::::::::::::::
1212

1313
::::::::::::::::::::::::::::::::::::: objectives
1414

1515
- Understand when mathematical models of transmission can be separated from models of burden
16-
- Generate disease burden using a burden model
16+
- Generate estimates of disease burden and healthcare demand using a burden model
1717

1818
::::::::::::::::::::::::::::::::::::::::::::::::
1919

@@ -28,9 +28,9 @@ exercises: 10 # exercise time in minutes
2828

2929
In previous tutorials we have used mathematical models to generate trajectories of infections, but we may also be interested in measures of disease. That could be measures of health in the population such as mild versus severe infections, or measures important to contingency planning of services being overwhelmed such as hospitalisations.
3030

31-
In the case of hospitalisations, mathematical models comprised of ODEs may include a compartment for individuals in hospital (see for example the [Vacamole model](../episodes/compare-interventions.md#vacamole-model)). For diseases like Ebola, hospitalised cases contribute to new infections and therefore it is necessary to keep track of hospitalised individuals so their contribution to infection can be modelled. When hospitalised cases contribute little to transmission we can separate out models of transmission from models of burden.
31+
In the case of hospitalisations, mathematical models comprised of ODEs may include a compartment for individuals in hospital (see for example the [Vacamole model](../episodes/compare-interventions.md#vacamole-model)). For diseases like Ebola, hospitalised cases contribute to new infections and therefore it is necessary to keep track of hospitalised individuals so their contribution to infection can be modelled. When hospitalised cases contribute little to transmission (i.e. if most transmission happens early in the infection and severe illness typically occurs later on) we can separate out models of transmission from models of burden. In other wrods, we can first run an epidemic model to simulate infections, then use these values to simulate disease burden as a follow-on analysis.
3232

33-
In this tutorial we will translate new infections generated from a transmission model to hospitalisations over time. We will use the in `{epidemics}` package to simulate disease trajectories, access to social contact data with `{socialmixr}` and `{tidyverse}` for data manipulation and plotting.
33+
In this tutorial we will translate new infections generated from a transmission model to hospital admissions and number of hospitalised cases over time. We will use the in `{epidemics}` package to simulate disease trajectories, access to social contact data with `{socialmixr}` and `{tidyverse}` for data manipulation and plotting.
3434

3535
```{r, warning = FALSE, message = FALSE}
3636
library(epiparameter)
@@ -51,7 +51,7 @@ associated with the lessons. They appear in the "Instructor View".
5151

5252
## A burden model
5353

54-
We will extend the influenza example in the tutorial [Simulating transmission](../episodes/simulating-transmission.md) to calculate hospitalisations over time. In this example our **transmission model** is an SEIR model comprised of ODEs. Our **burden model** will convert new infections to hospitalisations over time using processes using convolutions.
54+
We will extend the influenza example in the tutorial [Simulating transmission](../episodes/simulating-transmission.md) to calculate hospitalisations over time. In this example our **transmission model** is an SEIR model comprised of ODEs. Our **burden model** will convert new infections to hospitalisations over time by summing up all the new hospitalisations we expect to occur on each day according to the delay from infection to hospitalisation. We can do this summation using a calculation known as a convolution.
5555

5656
We will first obtain the new infections through time from our influenza example (see tutorial on [Simulating transmission](../episodes/simulating-transmission.md) for code to generate `output_plot`) using `new_infections()` in `{epidemics}`
5757

@@ -126,17 +126,17 @@ head(new_cases)
126126

127127
To convert the new infections to hospitalisations we need to parameter distributions to describe the following processes :
128128

129-
+ the time from onset of infection to admission to hospital,
129+
+ the time from infection to admission to hospital,
130130

131131
+ the time from admission to discharge from hospital.
132132

133133
We will use the function `epiparameter()` from `{epiparameter}` package to define and store parameter distributions for these processes.
134134

135135
```{r, message = FALSE}
136136
# define delay parameters
137-
onset_to_admission <- epiparameter(
137+
infection_to_admission <- epiparameter(
138138
disease = "COVID-19",
139-
epi_name = "onset to admission",
139+
epi_name = "infection to admission",
140140
prob_distribution = create_prob_distribution(
141141
prob_distribution = "gamma",
142142
prob_distribution_params = c(shape = 5, scale = 4),
@@ -150,7 +150,7 @@ To visualise this distribution we can create a density plot :
150150
```{r}
151151
x_range <- seq(0, 60, by = 0.1)
152152
density_df <- data.frame(days = x_range,
153-
density_admission = density(onset_to_admission,
153+
density_admission = density(infection_to_admission,
154154
x_range))
155155
156156
ggplot(data = density_df, aes(x = days, y = density_admission)) +
@@ -204,10 +204,10 @@ ggplot(data = density_df, aes(x = days, y = density_discharge)) +
204204

205205
To convert the new infections to number in hospital over time we will do the following:
206206

207-
1. Calculate the expected numbers of new hospitalisations using the infection hospitalisation ratio (IHR)
208-
2. Calculate the estimated number of new hospitalisations using the onset to admission distribution
209-
3. Calculate the estimated number of discharges
210-
4. Calculate the number in hospital as the difference between the cumulative sumo of hospitalisation and the cumulative sum of discharges
207+
1. Calculate the expected numbers of new infections that will be hospitalised using the infection hospitalisation ratio (IHR)
208+
2. Calculate the estimated number of new hospitalisations at each point in time using the infection to admission distribution
209+
3. Calculate the estimated number of discharge at each point in time using the admission to discharge distribution
210+
4. Calculate the number in hospital at each point in time as the difference between the cumulative sum of hospital admissions and the cumulative sum of discharges so far.
211211

212212

213213
#### 1. Calculate the expected numbers of new hospitalisations using the infection hospitalisation ratio (IHR)
@@ -225,15 +225,15 @@ To estimate the number of new hospitalisations we use a method called convolutio
225225
::::::::::::::::::::::::::::::::::::: callout
226226
### What is convolution?
227227

228-
Briefly, convolution is a mathematical process which combines two variables by seeing how much they overlap each other (see this [Wolfram article](https://mathworld.wolfram.com/Convolution.html) for some mathematical detail). There are different methods to perform convolution, the built in R function `convolve()` uses the Fast Fourier Transform.
228+
If we want to know how people are admitted to hospital on day $t$, then we need to add up the number of people admitted on day $t$ but infected on day $t-1$, day $t-2$, day $t-3$ etc. We therefore need to sum over the distribution of delays from infection to admission. If $f_j$ is the probability an infected individual who will be hospitalised will be admitted to hospital $j$ days later, and $I_{t-j}$ is the number of individuals infected on day $t-j$, then the total admissions on day $t$ is equal to $sum_j I_{t-j} f_j$. This type of rolling calculation is known as a convolution (see this [Wolfram article](https://mathworld.wolfram.com/Convolution.html) for some mathematical detail). There are different methods to calculate convolutions, but we will use the built in R function `convolve()`to perform the summation efficiently from the number of infections and the delay distribution.
229229

230230
::::::::::::::::::::::::::::::::::::::::::::::::
231231

232232
The function `convolve()` requires inputs of two vectors which will be convolved and `type`. Here we will specify `type = "open"`, this fills the vectors with 0s to ensure they are the same length.
233233

234-
The inputs to be convolved are the expected number of hospitalisations (`hosp`) and the density values of the density distribution of onset to admission times. We will calculate the density for the minimum possible value (0 days) up to the tail of the distribution (here defined as the 99.9th quantile).
234+
The inputs to be convolved are the expected number of infections that will end up hospitalised (`hosp`) and the density values of the distribution of onset to admission times. We will calculate the density for the minimum possible value (0 days) up to the tail of the distribution (here defined as the 99.9th quantile, i.e. it is very unlikely any cases will be hospitalised after a delay this long).
235235

236-
Convolution requires one of the inputs to be reversed, in our case we will reverse the density distribution of onset to admission times.
236+
Convolution requires one of the inputs to be reversed, in our case we will reverse the density distribution of infection to admission times. This is because if people infected earlier in time get admitted today, it means they've had a longer delay from infection to admission than someone infected more recently. In effect the infection to admission delay tells us how far we have to 'rewind' time to find previously new infections that are now showing up as hospital admissions.
237237

238238
```{r}
239239
# define tail of the delay distribution
@@ -295,7 +295,7 @@ ggplot(data = hosp_df_long) +
295295

296296
## Summary
297297

298-
In this tutorial we estimated the number of people in hospital based on daily new infections from a transmission model. Other measures of disease burden can be calculated using outputs of transmission models, such as Disability-Adjusted Life-Years (DALYs). Calculating measures of burden from transmission models is one way we can utilise mathematical modelling in health economic analyses.
298+
In this tutorial we estimated the number of people in hospital based on daily new infections from a transmission model. Other measures of disease burden can be calculated using outputs of transmission models, such as Disability-Adjusted Life-Years (DALYs). Calculating measures of burden from transmission models is one way we can utilise mathematical modelling in health economic analyses. As a follow-up, you might also be interested in [this how to guide](https://epiverse-trace.github.io/howto/analyses/reconstruct_transmission/estimate_infections.html), which shows how we can take reported hospitalisations or deaths over time and 'de-convolve' them to get an estimate of the original infection events.
299299

300300
::::::::::::::::::::::::::::::::::::: keypoints
301301

0 commit comments

Comments
 (0)