Skip to content

Commit 397f9c5

Browse files
committed
update README and add real-time report
1 parent eab6736 commit 397f9c5

File tree

3 files changed

+595
-34
lines changed

3 files changed

+595
-34
lines changed

README.md

Lines changed: 53 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,59 @@
11
# Estimating epidemiological quantities from prevalence and antibody estimates in the ONS Community Infection Survey
22

3-
We use a semi-mechanistic method to estimating incidence from Office for National Statistics (ONS) prevalence and antibody positivity estimates at the national, and subnational levels, as well as across age groups.
3+
In this work, we use a semi-mechanistic method to estimating epidemiological quantities such as infection incidence, infection growth rates, reproduction numbers and immunological parameters from Office for National Statistics (ONS) prevalence and antibody positivity estimates at the national, and subnational levels, as well as across age groups.
4+
Our approach assumes that unobserved infections can be represented using an initial intercept and a Gaussian process with a logit link function.
5+
To estimate population prevalence we convolve the PCR detection curve estimated in [Hellewell _et al._, _BMC Medicine_, 2021](https://doi.org/10.1186/s12916-021-01982-x), with uncertainty assumed to be normal and independent for each day since infection
46

5-
# Citation
6-
7-
# Summary
8-
9-
## Method
10-
11-
Our approach assumes that unobserved infections can be represented using an initial intercept and a Gaussian process with a logit link function. We use a Matern 3/2 kernal and an approximate Hilbert space Gaussian process formulation to reduce the computational cost. To estimate population prevalence we convolve the PCR detection curve estimated in Hellewell _et al._, _BMC Medicine_, 2021, with uncertainty assumed to be normal and independent for each day since infection, with our estimated infection curve. To map this to estimated prevalence from the ONS we assume a normal observation model with the standard error made up of the ONS estimated standard error and a shared standard error term estimated in the model.
12-
13-
We model antibody postitivity by fitting an initial proportion of the population that have infection derived antibodies. We then fit a daily model that assumes that some fraction of new infections that are not already antibody postive (here we assume equivalent infection risk for individuals who are antibody positive and negative) become so and that a proportion of those current antibody postive become antibody negative. We include vaccination similarly and assume that some fraction of those vaccination become antibody positive and that this positivity wanes with a daily rate (independent from the waning rate of those antibody positive from infection). This estimate of population level antibody positivity is then averaged across the time windows of the available antibody positivity estimates with again a normal observation model being assumed with the standard error made up of the ONS estimated standard error and a shared standard error term estimated in the model.
7+
We model antibody postitivity by fitting an initial proportion of the population that have infection derived antibodies.
8+
We then fit a daily model that assumes that some fraction of new infections that are not already antibody postive become so and that a proportion of those current antibody postive become antibody negative.
9+
We include vaccination similarly and assume that some fraction of those vaccination become antibody positive and that this positivity wanes with a daily rate (independent from the waning rate of those antibody positive from infection).
10+
This estimate of population level antibody positivity is then averaged across the time windows of the available antibody positivity estimates with again a normal observation model being assumed with the standard error made up of the ONS estimated standard error and a shared standard error term estimated in the model.
1411

15-
This model can be described mathematically as follows:
12+
The model is implemented in `stan` using `cmdstanr`.
1613

14+
# Citation
1715

18-
## Implementation
19-
20-
The model is implemented in `stan` using `cmdstanr` with the maximum treedepth increased to 12 from the default of 10.
21-
22-
## Limitations
23-
24-
- Assumes that the probability of detection follows the Hellewell et al estimates and that testing of survey participants is happening each day, which is unlikely, but for which there is little public information.
16+
S. Abbott, S. Funk. _Estimating epidemiological quantities from repeated cross-sectional prevalence measurements_ (2022). https://github.com/epiforecasts/inc2prev
2517

26-
- Assumes that uncertainty in the Hellewell et al estimates is independent normal which is known not to be the case. This limitation is imposed by not implementing the parameteric Hellewell et al model though this could in principle be done. However, this would again assume some level of independence in parameters and so still not return the posterior distribution found by Hellewell at al.
18+
**Draft paper in progress: [as html](https://epiforecasts.io/inc2prev/paper), [or pdf](https://epiforecasts.io/inc2prev/paper.pdf)**
2719

28-
- Assumes that infections can be well modelled by a Gaussian process with a Matern 3/2 kernal. This may not be the case for a range of reasons such as variation over time is non-stationary, and variation is piecewise constant.
20+
# Real-time estimates
2921

30-
- Real-time estimates may be unreliable as a zero mean Guassian process has been used. Alternative approaches exist to account for this but each of these imposes a parameteric assumption. Further work is needed on this area.
22+
The latest estimates are available in a [real-time report](https://epiforecasts.io/inc2prev/report).
3123

32-
- Assumes that antibody waning, from both infection and vaccination, wanes with an exponential rate.
24+
The code in this repository can be used to [reproduce the results](https://github.com/epiforecasts/inc2prev/blob/master/scripts/estimate.R),
25+
and [create the figures](https://github.com/epiforecasts/inc2prev/blob/master/scripts/plot_estimates.R)
26+
Estimates are also available as [data tables](https://github.com/epiforecasts/inc2prev/blob/master/outputs/) (labelled estimates_{level}.csv).
3327

34-
# Estimates from England
28+
# Example estimates from England
3529

3630
We ONS estimates for prevalence and antibody positivity in England to estimate infections and transmission parameters. The code to reproduce these results can be found [here](https://github.com/epiforecasts/inc2prev/blob/master/scripts/simple-example.R)
3731

38-
![](figures/readme/prev.png)
32+
![](figures/example/prev.png)
3933

4034
*Figure 1: ONS prevalence estimates compared to model estimates of ONS prevalence combined with model estimates of population prevalence.*
4135

42-
![](figures/readme/ab.png)
36+
![](figures/example/ab.png)
4337

44-
*Figure 1: ONS antibody positivity estimates compared to model estimates of ONS antibody positivity combined with model estimates of population antibody positivity.*
38+
*Figure 2: ONS antibody positivity estimates compared to model estimates of ONS antibody positivity combined with model estimates of population antibody positivity.*
4539

46-
![](figures/readme/infections.png)
40+
![](figures/example/infections.png)
4741

48-
*Figure 2: Model infection estimates*
42+
*Figure 3: Daily infection incidence estimates*
4943

50-
![](figures/readme/growth.png)
44+
![](figures/example/growth.png)
5145

52-
*Figure 3: Model infection growth rate estimates*
46+
*Figure 4: Infection growth rate estimates*
5347

54-
![](figures/readme/Rt.png)
48+
![](figures/example/Rt.png)
5549

56-
*Figure 4: Model effective reproduction rate rate estimates*
50+
*Figure 5: Effective reproduction rate rate estimates*
5751

5852
## Fit diagnostics
5953

60-
![](figures/readme/pairs.png)
54+
![](figures/example/pairs.png)
6155

62-
*Figure 5: Pairs plot of a sample of parameter posteriors*
56+
*Figure 6: Pairs plot of a sample of parameter posteriors*
6357

6458
# Documentation
6559

@@ -74,6 +68,31 @@ Folder | Purpose
7468
[`stan`](stan/) | The backend stan model code and support functions.
7569
[`.devcontainer`](.devcontainer/) | Contains the projects `Dockerfile` and setup instructions for using the code with `vscode`.
7670

71+
## Obtaining data
72+
73+
The data used in this repository can be obtained using the scripts in
74+
`data-raw/`. In particular, PCR positivity data by nation, region, age and
75+
variant can be downloaded using
76+
77+
```{sh}
78+
Rscript data-raw/update-cis.R
79+
```
80+
81+
and antibody data can be downloaded using
82+
83+
```{sh}
84+
Rscript data-raw/update-ab.R
85+
```
86+
87+
## Reproducing the estimates
88+
89+
Estimates provided here can be generated using the `scripts/estimate.R` script.
90+
The estimates shown in the plots above were generated using
91+
92+
```{sh}
93+
Rscript scripts/estimate.R -d 1
94+
```
95+
7796
## Dependencies
7897

7998
All dependencies can be installed using the following,

docs/report.Rmd

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
title: "Real-time epidemiological estimates from ONS Community Infection Survey data"
3+
author: Sam Abbott, Sebastian Funk
4+
date: "`r format(Sys.Date(), format = '%B %d, %Y')`"
5+
output: html_document
6+
---
7+
8+
```{r setup, echo = FALSE, include = FALSE}
9+
library(cowplot)
10+
library(here)
11+
12+
estimates <- c(national = "National",
13+
regional = "Regional",
14+
age_school = "Age")
15+
16+
quantities <- c(est_prev = "PCR positivity prevalence",
17+
infections = "Daily infection incidence",
18+
r = "Growth rate",
19+
Rt = "Reproduction number")
20+
21+
time_horizon <- c(est_prev = "1year",
22+
infections = "1year",
23+
r = "3months",
24+
Rt = "3months")
25+
```
26+
27+
Estimates were derived from the modelled daily and weekly data published weekly as part of the Covid-19 Community Infection Survey by the Office of National Statistics. Prevalence and incidence estimates are shown for the last year, and reproduction number for the past three months. Code to reproduce the results and links to data tables with estimates are available at https://github.com/epiforecasts/inc2prev
28+
29+
```{r, results = 'asis'}
30+
for (level in names(estimates)) {
31+
cat("\n\n#", estimates[[level]], "estimates", "{.tabset}", "\n")
32+
for (quantity in names(quantities)) {
33+
cat("\n\n##", quantities[[quantity]], "\n")
34+
file_name <-
35+
paste0(level, "_", quantity, "_", time_horizon[[quantity]], ".svg")
36+
p <- ggdraw() + draw_image(here::here("figures", "additional", file_name))
37+
print(p)
38+
}
39+
}
40+
```
41+
42+
# License
43+
44+
This project uses data from the Office for National Statistics Community Infection Survey, which is licensed under the [Open Government License v3.0](https://www.ons.gov.uk/peoplepopulationandcommunity/healthandsocialcare/conditionsanddiseases/datasets/coronaviruscovid19infectionsurveydata).
45+
46+

docs/report.html

Lines changed: 496 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)