find_peak: Find the peak date of an incidence curve

Description Usage Arguments Value Author(s) See Also Examples

View source: R/find_peak.R

Description

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

Usage

1

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 [email protected], Zhian N. Kamvar [email protected]

See Also

estimate_peak() for bootstrap estimates of the peak time

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
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 documentation built on Aug. 25, 2018, 1:03 a.m.