Learn R Programming

tabula (version 3.1.1)

bootstrap: Bootstrap Estimation

Description

Samples randomly from the elements of object with replacement.

Usage

# S4 method for DiversityIndex
bootstrap(object, n = 1000, f = NULL)

Value

If f is NULL (the default), bootstrap() returns a named numeric

vector with the following elements:

original

The observed value of do applied to object.

mean

The bootstrap estimate of mean of do.

bias

The bootstrap estimate of bias of do.

error

he bootstrap estimate of standard error of do.

If f is a function, bootstrap() returns the result of f applied to the n values of do.

Arguments

object

An R object (typically a DiversityIndex object).

n

A non-negative integer giving the number of bootstrap replications.

f

A function that takes a single numeric vector (the result of do) as argument.

Author

N. Frerebeau

See Also

Other resampling methods: jackknife(), resample()

Examples

Run this code
## Data from Conkey 1980, Kintigh 1989
data("cantabria")

## Shannon diversity index
(h <- heterogeneity(cantabria, method = "shannon"))

## Bootstrap resampling
bootstrap(h, f = NULL)

bootstrap(h, f = summary)

quant <- function(x) quantile(x, probs = c(0.25, 0.50))
bootstrap(h, f = quant)

Run the code above in your browser using DataLab