Peak estimation

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.align = "center",
  fig.width = 7,
  fig.height = 5
)
library(outbreaks)
library(incidence2)
library(i2extras) 

Bootstrapping and finding peaks

We provide functions to return the peak of the incidence data (grouped or ungrouped), bootstrap from the incidence data, and estimate confidence intervals around a peak.

bootstrap()

dat <- fluH7N9_china_2013
x <- incidence(dat, date_index = "date_of_onset", groups = "gender")
bootstrap(x)

find_peak()

dat <- fluH7N9_china_2013
x <- incidence(dat, date_index = "date_of_onset", groups = "gender")

# peaks across each group
find_peak(x)

# peak without groupings
find_peak(regroup(x))

estimate_peak()

Note that the bootstrapping approach used for estimating the peak time makes the following assumptions:

dat <- fluH7N9_china_2013
x <- incidence(dat, date_index = "date_of_onset", groups = "province")

# regrouping for overall peak (we suspend progress bar for markdown)
estimate_peak(regroup(x), progress = FALSE)

# across provinces
estimate_peak(x, progress = FALSE)


Try the i2extras package in your browser

Any scripts or data that you put into this service are public.

i2extras documentation built on March 31, 2023, 5:23 p.m.