Jackknife Estimation
Usage
# S4 method for DiversityIndex
jackknife(object, f = NULL)
Arguments
- object
An R object (typically a DiversityIndex object).
- f
A
function
that takes a single numeric vector (the leave-one-out values ofdo
) as argument.
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_diversity
,
resample()
Examples
## Data from Conkey 1980, Kintigh 1989
data("cantabria")
## Shannon diversity index
(h <- heterogeneity(cantabria, method = "shannon"))
#> [1] 3.269200 2.955298 2.491683 2.485604 2.329187
## Bootstrap resampling
bootstrap(h, f = NULL)
#> original mean bias error
#> Altamira 3.269200 3.278206 0.009006676 0.08307194
#> Cueto de la Mina 2.955298 2.972727 0.017429550 0.15398977
#> El Juyo 2.491683 2.512902 0.021218780 0.20477828
#> El Cierro 2.485604 2.489387 0.003782870 0.21801177
#> La Paloma 2.329187 2.304147 -0.025039501 0.26161788
bootstrap(h, f = summary)
#> Min. 1st Qu. Median Mean 3rd Qu. Max.
#> Altamira 3.025561 3.223493 3.274640 3.274596 3.331732 3.510869
#> Cueto de la Mina 2.510647 2.879026 2.986806 2.977599 3.078147 3.392700
#> El Juyo 1.867719 2.400420 2.540724 2.524350 2.667965 3.082037
#> El Cierro 1.671531 2.369194 2.515860 2.495118 2.651108 3.035360
#> La Paloma 1.213008 2.163956 2.343947 2.316331 2.499333 3.061994
quant <- function(x) quantile(x, probs = c(0.25, 0.50))
bootstrap(h, f = quant)
#> 25% 50%
#> Altamira 3.229519 3.285076
#> Cueto de la Mina 2.878630 2.980912
#> El Juyo 2.396635 2.532030
#> El Cierro 2.366988 2.504375
#> La Paloma 2.145842 2.329187
## Jackknife resampling
jackknife(h)
#> original mean bias error
#> Altamira 3.269200 3.246457 -0.9779158 0.08145529
#> Cueto de la Mina 2.955298 2.932856 -0.9649994 0.15907033
#> El Juyo 2.491683 2.469588 -0.9500688 0.19670002
#> El Cierro 2.485604 2.462723 -0.9838709 0.22195573
#> La Paloma 2.329187 2.305876 -1.0023704 0.25266291
bootstrap(h, f = summary)
#> Min. 1st Qu. Median Mean 3rd Qu. Max.
#> Altamira 3.045532 3.229899 3.283922 3.281962 3.334989 3.514534
#> Cueto de la Mina 2.301774 2.872228 2.977945 2.968116 3.075886 3.332967
#> El Juyo 1.695724 2.396411 2.537224 2.526913 2.674774 3.222411
#> El Cierro 1.723392 2.333030 2.496161 2.472532 2.637416 2.985356
#> La Paloma 1.277034 2.163956 2.338372 2.313336 2.491497 2.959830