Samples randomly from the elements of `object`

with replacement.

## Value

If `f`

is not `NULL`

, `bootstrap()`

returns the result of `f`

applied to
the `n`

values of `do`

.

If `f`

is `NULL`

, `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`

.

## See also

Other resampling methods:
`jackknife()`

## Examples

```
x <- rnorm(20)
## Bootstrap
bootstrap(x, do = mean, n = 100)
#> original mean bias error
#> 0.16747745 0.20692843 0.03945098 0.14527604
## 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)
#> 25% 75%
#> 0.08637007 0.27812118
## Jackknife
jackknife(x, do = mean) # Sample mean
#> original mean bias error
#> 0.1674775 0.1674775 0.0000000 0.1582453
```