Jackknife Estimation
Value
If f
is NULL
(the default), jackknife()
returns a named numeric
vector with the following elements:
original
The observed value of
do
applied toobject
.mean
The jackknife estimate of mean of
do
.bias
The jackknife estimate of bias of
do
.error
he jackknife estimate of standard error of
do
.
If f
is a function
, jackknife()
returns the result of f
applied to
the leave-one-out values of do
.
See also
Other resampling methods:
bootstrap()
Examples
x <- rnorm(20)
## Bootstrap
bootstrap(x, do = mean, n = 100)
#> original mean bias error
#> 0.16598229 0.16920507 0.00322278 0.21290410
## 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.04353926 0.31796223
## Get the n bootstrap values
bootstrap(x, n = 100, do = mean, f = function(x) { x })
#> [1] -0.134917467 0.253760075 -0.064675771 -0.140809858 0.455947373
#> [6] 0.213983815 0.196210451 0.099908964 -0.296733887 -0.119850799
#> [11] 0.118366473 -0.284519619 -0.146630253 0.118460533 0.076898099
#> [16] 0.539367493 0.218444817 0.213597934 -0.042169090 0.360466541
#> [21] -0.124255012 -0.132997955 0.151614276 0.228940981 0.003373803
#> [26] 0.092416532 0.206588480 0.306116562 0.120925361 0.120793195
#> [31] 0.184290522 0.053559998 0.476776902 -0.246857199 0.118787874
#> [36] 0.018281825 0.009212510 0.230146604 0.208306334 0.126052441
#> [41] 0.365973626 0.298099535 -0.010088778 0.036630307 -0.022314473
#> [46] 0.419389900 0.265151228 -0.088192478 0.095860729 0.160796198
#> [51] -0.012741747 -0.068974846 -0.104448217 0.258792012 0.140757269
#> [56] 0.393412777 0.084320022 0.182078560 0.135929209 0.557696283
#> [61] 0.224675605 -0.199221549 0.023791573 0.337681331 0.351483128
#> [66] 0.212835512 0.136610134 0.298267439 0.346560244 0.180953742
#> [71] 0.354643769 -0.061265730 -0.086797454 0.083831877 0.098110049
#> [76] -0.064267806 0.290736918 0.360256437 -0.054748577 -0.102948876
#> [81] 0.014794758 0.143079499 -0.010388815 0.233308891 0.022045599
#> [86] 0.017547565 0.117126863 0.061413693 0.404698885 -0.153191689
#> [91] 0.242601159 0.280123509 -0.067535924 -0.060736928 0.012698300
#> [96] 0.184779716 0.016434007 -0.313326247 -0.015372042 0.236452785
## Jackknife
jackknife(x, do = mean) # Sample mean
#> original mean bias error
#> 0.1659823 0.1659823 0.0000000 0.2126934
## Get the leave-one-out values instead of summary
jackknife(x, do = mean, f = function(x) { x })
#> [1] 0.19818477 0.20310250 0.20462032 0.12276561 0.28212782 0.18031634
#> [7] 0.08386451 0.15273009 0.19030649 0.12084963 0.18365068 0.22070922
#> [13] 0.16211979 0.17601232 0.12953007 0.10611419 0.19517462 0.17605627
#> [19] 0.16183668 0.06957391