Skip to contents

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 of do) 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 to object.

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(), resample()

Author

N. Frerebeau

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.280402  0.0112025976 0.08079012
#> Cueto de la Mina 2.955298 2.975088  0.0197905305 0.14799321
#> El Juyo          2.491683 2.540509  0.0488266469 0.19898130
#> El Cierro        2.485604 2.486137  0.0005333296 0.21893775
#> La Paloma        2.329187 2.316002 -0.0131842316 0.25809208

bootstrap(h, f = summary)
#>                      Min.  1st Qu.   Median     Mean  3rd Qu.     Max.
#> Altamira         2.979042 3.228799 3.283048 3.278504 3.330980 3.513022
#> Cueto de la Mina 2.302014 2.866352 2.975547 2.969013 3.078826 3.351206
#> El Juyo          1.483755 2.410534 2.541252 2.526640 2.646816 3.189454
#> El Cierro        1.709473 2.358854 2.505909 2.492024 2.639654 3.010729
#> La Paloma        0.000000 2.163956 2.332882 2.312304 2.488794 2.914345

quant <- function(x) quantile(x, probs = c(0.25, 0.50))
bootstrap(h, f = quant)
#>                       25%      50%
#> Altamira         3.222216 3.274933
#> Cueto de la Mina 2.887177 2.983977
#> El Juyo          2.400082 2.532789
#> El Cierro        2.357496 2.505136
#> La Paloma        2.165553 2.343891

## 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         2.985149 3.229306 3.285509 3.282846 3.338739 3.532789
#> Cueto de la Mina 2.464220 2.880741 2.981933 2.975875 3.070218 3.384048
#> El Juyo          1.740512 2.398534 2.521858 2.516742 2.646314 3.080476
#> El Cierro        1.589385 2.363075 2.510529 2.493531 2.639931 3.177633
#> La Paloma        1.039721 2.166085 2.351805 2.320512 2.510008 2.892961