bootstrap: bootstrap

Description Usage Arguments Value Examples

View source: R/bootstrap.R

Description

Apply fun to the data n times. The data is randomly sampled each time. This yields both more robust results and approximate confidence intervals for the results. Due to the random sampling, the results of this function are stochastic. Set the seed with set.seed(n) for reproducible results.

Usage

1
bootstrap(pred, actual, fun, draws = 100, parallel = FALSE, ...)

Arguments

pred

A vector of predictions

actual

A vector of actual values

fun

The function to apply

draws

Number of times to randomly sample the data for bootstrapping. Larger numbers yield better results, but also increase runtime.

parallel

Bool. Run in parallel?

...

Arguments passed to fun

Value

A list containing the results of each iteration

Examples

1
2
3
pred <- sample(seq(0,1,0.001), size = 150, replace = TRUE)
actual <- sample(c(0,1), size = 150, replace = TRUE)
bootstrap(pred,actual,roc)

Peder2911/evallib documentation built on Dec. 18, 2019, 2:41 a.m.