bootstrap: Bootstrap incidence time series

View source: R/bootstrap.R

bootstrapR Documentation

Bootstrap incidence time series

Description

This function can be used to bootstrap ⁠[incidence2]⁠ objects. Bootstrapping is done by sampling with replacement the original input dates.

Usage

bootstrap(x, randomise_groups = FALSE)

Arguments

x

An ⁠[incidence2]⁠ object.

randomise_groups

⁠[bool]⁠

Should groups be randomised as well in the resampling procedure; respective group sizes will be preserved, but this can be used to remove any group-specific temporal dynamics.

If FALSE (default), data are resampled within groups.

Details

As original data are not stored in incidence2::incidence objects, the bootstrapping is achieved by multinomial sampling of date bins weighted by their relative incidence.

Value

An ⁠[incidence2]⁠ object.

Author(s)

Thibaut Jombart, Tim Taylor

Examples

if (requireNamespace("outbreaks", quietly = TRUE)) {
    data(fluH7N9_china_2013, package = "outbreaks")
    i <- incidence(
        fluH7N9_china_2013,
        date_index = "date_of_onset",
        groups = "gender"
   )
   bootstrap(i)
}


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