-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.qmd
79 lines (56 loc) · 2.09 KB
/
index.qmd
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
---
title: "MPX Tracker for North Carolina"
execute:
warning: false
echo : false
error: false
---
Cases updated daily by NCDHHS Monday through Friday.
```{r}
#| echo: false
library(data.table)
library(ggplot2)
dat <- fread(here::here("data", "mpx.csv"))
dat$clean_date <- with(dat, as.Date(stringr::str_extract(ping_time, "\\d{4}-\\d{2}-\\d{2}")))
dat_rolling <- copy(dat)[,list(clean_date, cases)]
dat_rolling <- padr::pad(dat_rolling)
dat_rolling[, cases := cases[1], by = cumsum(!is.na(cases))]
dat_rolling[,incidence := cases - shift(cases,1)]
dat_rolling[,rolling_incidence := frollmean(incidence, 7)]
dat[,DOW := lubridate::wday(clean_date)]
dat <- dat[(clean_date< "2022-09-10" | DOW == 6)]
dat$date_n <- as.numeric(dat$clean_date)
last_available <- format(max(dat$clean_date), "%d %B, %Y")
fit <- glm(cases ~ date_n, data = tail(dat, 28), family = quasipoisson())
med_est <- -log(1/2)/coef(fit)[2]
med_se <- -log(1/2)/ confint(fit,parm = "date_n")
doubling_phrase <- sprintf("%s (95%% CI, %s-%s)",
round(med_est,1), round(med_se[2],1),
round(med_se[1],1))
```
These data are current as of `r last_available`.
Current case incidence suggests a doubling time of `r doubling_phrase` days.
```{r}
ggplot(dat, aes(x = clean_date, cases))+
geom_point()+
theme_bw()+
scale_y_continuous(limits = c(0,NA), name = "Cumulative Confirmed MPX Cases")+
scale_x_date(name = "Date")+
labs(
title = "Confirmed Monkeypox (MPX) Cases in North Carolina",
caption = "Updated Monday - Friday\nData: NCDHHS"
)
```
```{r}
ggplot(dat_rolling, aes(x = clean_date, rolling_incidence))+
geom_line()+
theme_bw()+
scale_y_continuous(limits = c(0,NA), name = "7 Day Rolling Average Incidence Confirmed MPX Cases")+
scale_x_date(name = "Date")+
labs(
title = "Confirmed Monkeypox (MPX) Cases in North Carolina",
caption = "Updated Monday - Friday\nData: NCDHHS"
)
```
## Data Source
These data are pulled each weekday from the [North Carolina Department of Health's Monkeypox webpage](https://epi.dph.ncdhhs.gov/cd/diseases/monkeypox.html).