Learn R Programming

RVAideMemoire (version 0.9-45-2)

bootstrap: Bootstrap

Description

Simplified version of the boot function.

Usage

bootstrap(x, fun, nrep = 1000, conf.level = 0.95, ...)

Arguments

x
numeric vector.
fun
function to be used for computation (function(x,i) ...(x[i])).
nrep
number of replicates.
conf.level
confidence level for confidence interval.
...
additional arguments to boot. See help of this function.

Value

  • methodthe character string "Bootstrap"
  • data.namea character string giving the name of the data.
  • estimatethe estimated original value
  • conf.levelconfidence level for confidence interval.
  • repnumber of replicates.
  • conf.intlimits of the confidence interval.

Details

See help of the boot function for more explanations.

See Also

boot

Examples

Run this code
# Confidence interval of a mean
samp <- sample(1:50,10,replace=TRUE)
bootstrap(samp,function(x,i) mean(x[i]))

# Confidence interval of the standard error of the mean
bootstrap(samp,function(x,i) sd(x[i])/sqrt(length(x[i])))

Run the code above in your browser using DataLab