Skip to contents

A sampling distribution of rep replicates is generated for the specified estimator with replacement with a bootstrap sample size of n.

Usage

bootstrap(sample, rep, n = "auto", estimator = mean, seed = NULL)

Arguments

sample

A numeric vector to bootstrap

rep

A numeric vector for number of replicates

n

A numeric or character vector for the size of bootstrap samples

estimator

A function that is one of mean, median, var, sd

seed

A numeric vector as random seed. Can be NULL

Value

A numeric vector for bootstrap distribution

Examples

bootstrap(c(1, 2, 3), 3, 3)
#> [1] 2.000000 1.666667 2.333333
bootstrap(c(1, 2, 3), 3, 3, estimator = var, seed = 1)
#> [1] 1.3333333 1.0000000 0.3333333