Skip to contents

Reproduces boot::boot(..., sim = "ordinary", stype = "i"). The statistic is called as statistic(data, indices) with indices an integer resample of rows; under a common seed the replicate matrix t matches boot::boot to the RNG stream.

Usage

morie_boot(data, statistic, R, strata = NULL, ...)

Arguments

data

A vector or data.frame (rows are the sampling units).

statistic

Function (data, indices) -> numeric.

R

Number of bootstrap replicates.

strata

Optional grouping vector for stratified resampling.

...

Passed on to statistic.

Value

An object of class morie_boot with t0 (observed), t (R x k replicates), data, strata and the resample index matrix.

References

Davison, A. C., & Hinkley, D. V. (1997). Bootstrap Methods and their Application. Cambridge.

Examples

set.seed(1)
b <- morie_boot(mtcars$mpg, function(d, i) mean(d[i]), R = 200)
morie_boot_ci(b, type = "perc")
#> $perc
#> [1] 18.28555 22.27424
#>