Skip to content

Commit 1cd340c

Browse files
amanda-minteravallecam
authored andcommitted
add call out and more detail on convolution
1 parent 34215e6 commit 1cd340c

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

episodes/disease-burden.Rmd

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,20 @@ hosp <- new_cases$new_infections * ihr
220220

221221
#### 2. Calculate the estimated number of new hospitalisations using the onset to admission distribution
222222

223-
We convolve the expected number of hospitalisations (hosp) with the distribution of onset to admission times to obtain the estimated number of new hospitalisations
223+
To estimate the number of new hospitalisations we use a method called convolution.
224224

225+
::::::::::::::::::::::::::::::::::::: callout
226+
### What is convolution?
225227

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.
229+
230+
::::::::::::::::::::::::::::::::::::::::::::::::
231+
232+
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.
233+
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).
235+
236+
Convolution requires one of the inputs to be reversed, in our case we will reverse the density distribution of onset to admission times.
226237

227238
```{r}
228239
# define tail of the delay distribution
@@ -237,7 +248,7 @@ hospitalisations <- convolve(hosp,
237248

238249
#### 3. Calculate the estimated number of discharges
239250

240-
Using the same approach as above, we convolve the hospitalisations with the distribution of admission to discharge times to obtain the estimated number of new discharges
251+
Using the same approach as above, we convolve the hospitalisations with the distribution of admission to discharge times to obtain the estimated number of new discharges.
241252

242253

243254
```{r}

0 commit comments

Comments
 (0)