Open TimTaylor opened 4 years ago
library(incidence2) library(incidence2plus) library(tidyr) data(ebola_sim_clean, package = "outbreaks") dat <- ebola_sim_clean$linelist inci <- incidence( dat, date_index = date_of_onset, interval = "week", last_date = "2014-10-05", groups = gender ) #> 3522 observations outside of [2014-04-07, 2014-10-05] were removed.
inci %>% fit(model = "poisson") #> # A tibble: 2 x 6 #> gender model fitted r `r-lower` `r-upper` #> <fct> <list> <list> <dbl> <dbl> <dbl> #> 1 f <glm> <tibble [26 × 6]> 0.0249 0.0233 0.0265 #> 2 m <glm> <tibble [26 × 6]> 0.0250 0.0234 0.0267
inci %>% fit(model = "poisson") %>% add_doubling() #> # A tibble: 2 x 9 #> gender model fitted r `r-lower` `r-upper` doubling `doubling-lower` #> <fct> <lis> <list> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 f <glm> <tibb… 0.0249 0.0233 0.0265 27.9 29.8 #> 2 m <glm> <tibb… 0.0250 0.0234 0.0267 27.7 29.7 #> # … with 1 more variable: `doubling-upper` <dbl>
inci %>% fit(model = "poisson") %>% plot(color = "white", angle = 45, n_breaks = 4)
Created on 2020-09-03 by the reprex package (v0.3.0)
Very cool!
Created on 2020-09-03 by the reprex package (v0.3.0)