This function can be used to estimate the peak of an epidemic curve stored as incidence2::incidence object, using bootstrapped samples of the available data. See bootstrap() for more information on the resampling.

estimate_peak(x, n = 100, alpha = 0.05, progress = TRUE)

## Arguments

x An incidence2::incidence object. The number of bootstrap datasets to be generated; defaults to 100. The type 1 error chosen for the confidence interval; defaults to 0.05. Should a progress bar be displayed (default = TRUE)

## Value

A tibble with the the following columns:

• observed_date: the date of peak incidence of the original dataset.

• observed_count: the peak incidence of the original dataset.

• estimated: the median peak time of the bootstrap datasets.

• lower_ci/upper_ci: the confidence interval based on bootstrap datasets.

• peaks: a nested tibble containing the the peak times of the bootstrapped datasets.

## Details

Input dates are resampled with replacement to form bootstrapped datasets; the peak is reported for each, resulting in a distribution of peak times. When there are ties for peak incidence, only the first date is reported.

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

• the total number of event is known (no uncertainty on total incidence)

• dates with no events (zero incidence) will never be in bootstrapped datasets

• the reporting is assumed to be constant over time, i.e. every case is equally likely to be reported

bootstrap() for the bootstrapping underlying this approach and find_peak() to find the peak in a single incidence2::incidence object.

## Author

Thibaut Jombart and Tim Taylor, with inputs on caveats from Michael Höhle.

## Examples

if (requireNamespace("outbreaks", quietly = TRUE)) { # load data and create incidence data(fluH7N9_china_2013, package = "outbreaks") i <- incidence2::incidence(fluH7N9_china_2013, date_index = date_of_onset) # find 95% CI for peak time using bootstrap peak_data <- estimate_peak(i) peak_data summary(peak_data\$peaks) }
#> Estimating peaks from bootstrap samples:
#> | | | 0% | |= | 1% | |= | 2% | |== | 3% | |=== | 4% | |==== | 5% | |==== | 6% | |===== | 7% | |====== | 8% | |====== | 9% | |======= | 10% | |======== | 11% | |======== | 12% | |========= | 13% | |========== | 14% | |========== | 15% | |=========== | 16% | |============ | 17% | |============= | 18% | |============= | 19% | |============== | 20% | |=============== | 21% | |=============== | 22% | |================ | 23% | |================= | 24% | |================== | 25% | |================== | 26% | |=================== | 27% | |==================== | 28% | |==================== | 29% | |===================== | 30% | |====================== | 31% | |====================== | 32% | |======================= | 33% | |======================== | 34% | |======================== | 35% | |========================= | 36% | |========================== | 37% | |=========================== | 38% | |=========================== | 39% | |============================ | 40% | |============================= | 41% | |============================= | 42% | |============================== | 43% | |=============================== | 44% | |================================ | 45% | |================================ | 46% | |================================= | 47% | |================================== | 48% | |================================== | 49% | |=================================== | 50% | |==================================== | 51% | |==================================== | 52% | |===================================== | 53% | |====================================== | 54% | |====================================== | 55% | |======================================= | 56% | |======================================== | 57% | |========================================= | 58% | |========================================= | 59% | |========================================== | 60% | |=========================================== | 61% | |=========================================== | 62% | |============================================ | 63% | |============================================= | 64% | |============================================== | 65% | |============================================== | 66% | |=============================================== | 67% | |================================================ | 68% | |================================================ | 69% | |================================================= | 70% | |================================================== | 71% | |================================================== | 72% | |=================================================== | 73% | |==================================================== | 74% | |==================================================== | 75% | |===================================================== | 76% | |====================================================== | 77% | |======================================================= | 78% | |======================================================= | 79% | |======================================================== | 80% | |========================================================= | 81% | |========================================================= | 82% | |========================================================== | 83% | |=========================================================== | 84% | |============================================================ | 85% | |============================================================ | 86% | |============================================================= | 87% | |============================================================== | 88% | |============================================================== | 89% | |=============================================================== | 90% | |================================================================ | 91% | |================================================================ | 92% | |================================================================= | 93% | |================================================================== | 94% | |================================================================== | 95% | |=================================================================== | 96% | |==================================================================== | 97% | |===================================================================== | 98% | |===================================================================== | 99% | |======================================================================| 100% #>
#> Warning: Unknown or uninitialised column: peaks.
#> Length Class Mode #> 0 NULL NULL