Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

find_peak

Find the peak date of an incidence curve


Description

This function can be used to find the peak of an epidemic curve stored as an incidence object.

Usage

find_peak(x, pool = TRUE)

Arguments

x

An incidence object.

pool

If TRUE (default), any groups will be pooled before finding a peak. If FALSE, separate peaks will be found for each group.

Value

The date of the (first) highest incidence in the data.

Author(s)

Thibaut Jombart thibautjombart@gmail.com, Zhian N. Kamvar zkamvar@gmail.com

See Also

estimate_peak() for bootstrap estimates of the peak time

Examples

if (require(outbreaks) && require(ggplot2)) { withAutoprint({
  i <- incidence(fluH7N9_china_2013$date_of_onset)
  i
  plot(i)

  ## one simple bootstrap
  x <- bootstrap(i)
  x
  plot(x)

  ## find 95% CI for peak time using bootstrap
  find_peak(i)


  ## show confidence interval
  plot(i) + geom_vline(xintercept = find_peak(i), col = "red", lty = 2)

})}

incidence

Compute, Handle, Plot and Model Incidence of Dated Events

v1.7.3
MIT + file LICENSE
Authors
Thibaut Jombart [aut], Zhian N. Kamvar [aut] (<https://orcid.org/0000-0003-1458-7108>), Rich FitzJohn [aut], Tim Taylor [cre] (<https://orcid.org/0000-0002-8587-7113>), Jun Cai [ctb] (<https://orcid.org/0000-0001-9495-1226>), Sangeeta Bhatia [ctb], Jakob Schumacher [ctb], Juliet R.C. Pulliam [ctb] (<https://orcid.org/0000-0003-3314-8223>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.