Skip to content

Commit 404cfc0

Browse files
committed
complete change from onset to infection
1 parent 0e0d584 commit 404cfc0

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

episodes/disease-burden.Rmd

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ ggplot(data = density_df, aes(x = days, y = density_admission)) +
157157
geom_line(linewidth = 1.2) +
158158
theme_bw() +
159159
labs(
160-
x = "onset to admission (days)",
160+
x = "infection to admission (days)",
161161
y = "pdf"
162162
)
163163
@@ -218,7 +218,7 @@ ihr <- 0.1 # infection-hospitalisation ratio
218218
hosp <- new_cases$new_infections * ihr
219219
```
220220

221-
#### 2. Calculate the estimated number of new hospitalisations using the onset to admission distribution
221+
#### 2. Calculate the estimated number of new hospitalisations using the infection to admission distribution
222222

223223
To estimate the number of new hospitalisations we use a method called convolution.
224224

@@ -231,16 +231,16 @@ If we want to know how people are admitted to hospital on day $t$, then we need
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 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).
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 infection 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

236236
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
240-
tail_value_admission <- quantile(onset_to_admission, 0.999)
240+
tail_value_admission <- quantile(infection_to_admission, 0.999)
241241
242242
hospitalisations <- convolve(hosp,
243-
rev(density(onset_to_admission,
243+
rev(density(infection_to_admission,
244244
0:tail_value_admission)),
245245
type = "open")[seq_along(hosp)]
246246
```

0 commit comments

Comments
 (0)