| bootstrap {arkhe} | R Documentation |
Bootstrap Estimation
Description
Samples randomly from the elements of object with replacement.
Usage
bootstrap(object, ...)
## S4 method for signature 'numeric'
bootstrap(object, do, n, ..., f = NULL)
Arguments
object |
A |
... |
Extra arguments to be passed to |
do |
A |
n |
A non-negative |
f |
A |
Value
If f is NULL (the default), bootstrap() returns a named numeric
vector with the following elements:
originalThe observed value of
doapplied toobject.meanThe bootstrap estimate of mean of
do.biasThe bootstrap estimate of bias of
do.errorhe 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.
Author(s)
N. Frerebeau
See Also
Other resampling methods:
jackknife()
Examples
x <- rnorm(20)
## Bootstrap
bootstrap(x, do = mean, n = 100)
## Estimate the 25th and 95th percentiles
quant <- function(x) { quantile(x, probs = c(0.25, 0.75)) }
bootstrap(x, n = 100, do = mean, f = quant)
## Get the n bootstrap values
bootstrap(x, n = 100, do = mean, f = function(x) { x })
## Jackknife
jackknife(x, do = mean) # Sample mean
## Get the leave-one-out values instead of summary
jackknife(x, do = mean, f = function(x) { x })
[Package arkhe version 1.7.0 Index]