-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
95 lines (70 loc) · 2.67 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# CovidGer
<!-- badges: start -->
<!-- badges: end -->
The goal of CovidGer is to provide relatively easy access to the data used in "Inference under superspreading" by Patrick Schmidt.
The repository contains additional code on the generation of the data files in the data-raw folder.
## Installation
You can install the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("Schmidtpk/CovidGer")
```
## Case data by the rki
This is a basic example which shows you how to use the case data by the rki. See `?rki_new` for the data source.
The following example aggregates German wide cases and deaths by symptom onset.
```{r example, message=FALSE}
library(CovidGer)
library(dplyr)
library(tidyr)
library(ggplot2)
df<-rki_new %>%
dplyr::filter(!is.na(Refdatum))%>%
group_by(Refdatum,age)%>%
summarise(
positive= sum(AnzahlFall[Neuer.Fall%in%c(0,1)]),
deaths = sum(AnzahlTodesfall[Neuer.Todesfall%in%c(0,1)])
) %>%
rename(
date=Refdatum,
)%>%pivot_longer(c(positive,deaths))
ggplot(df,aes(x=date,y=value))+
geom_point()+
geom_line()+
facet_grid(name~age,scale="free_y")+
xlab("date of symptom onset")
```
## Delay from Symptom onset to reporting to health departement
The following code computes the delay from symptom onset to reporting. Symptom onset is given in `Refdatum` and reporting date in `Meldedatum`.
```{r, message=FALSE}
rki_new %>%
dplyr::filter(Refdatum>=as.Date("2020-03-01"),
Refdatum<as.Date("2020-09-01"))%>%
mutate(
delay = as.numeric(Meldedatum-Refdatum),
delay = if_else(delay>14,14,delay),
delay = if_else(delay<(-7),-7,delay)) %>%
group_by(Refdatum)%>%
summarise(
delaym = mean(delay,na.rm=TRUE),
delay1 = quantile(delay,na.rm=TRUE,probs = .1),
delay9 = quantile(delay,na.rm=TRUE,probs = .9))%>%
rename(date = Refdatum)%>%
ggplot(aes(x=date,y=delaym))+
geom_ribbon(aes(ymin=delay1,ymax=delay9),alpha=.2)+
geom_line()
```
### Other data
The Package also contains data on population statistics (Regionaldatenbank) in `regionaldatenbank`, on location specific weather from the German Weather Services (DWD) in `weather_dwd`, and on policy interventions in `interventions.list` and `interventions`.
The intervention data was generated in a spreadsheet, which is directly accessible [here](https://docs.google.com/spreadsheets/d/1cmGBMUhBt5y6jwiqaF7lh7VQNMN6D5FCoIltlOzhMfI/edit#gid=0).