.old <- data.table::setDTthreads(2)
if (requireNamespace("outbreaks", quietly = TRUE) && requireNamespace("ggplot2", quietly = TRUE)) {
data(ebola_sim_clean, package = "outbreaks")
x <- subset(ebola_sim_clean$linelist, !is.na(hospital))
dat <- incidence_(x, date_of_onset, hospital, interval = "isoweek")
mutate(dat, ave = data.table::frollmean(count, n = 3L, align = "right")) |>
plot(border_colour = "white", angle = 45) +
ggplot2::geom_line(ggplot2::aes(x = date_index, y = ave))
nest(dat)
summarise(dat, model = list(glm(count ~ date_index, family = "poisson")))
}
data.table::setDTthreads(.old)
Run the code above in your browser using DataLab