Skip to contents

Generate jackknife estimations of an MCD.

Usage

# S4 method for class 'MeanDate'
jackknife(object, f = NULL, calendar = get_calendar())

Arguments

object

A MeanDate object (typically returned by mcd()).

f

A function that takes a single numeric vector (the result of the resampling procedure) as argument.

calendar

An aion::TimeScale object specifying the target calendar (see aion::calendar()).

Value

If f is NULL, jackknife() returns a data.frame with the following elements (else, returns the result of f applied to the n resampled values) :

original

The observed value.

mean

The jackknife estimate of mean.

bias

The jackknife estimate of bias.

error

The jackknife estimate of standard erro.

See also

Author

N. Frerebeau

Examples

## Data from Peeples and Schachner 2012
data("zuni", package = "folio")

## Set the start and end dates for each ceramic type
dates <- list(
  LINO = c(600, 875), KIAT = c(850, 950), RED = c(900, 1050),
  GALL = c(1025, 1125), ESC = c(1050, 1150), PUBW = c(1050, 1150),
  RES = c(1000, 1200), TULA = c(1175, 1300), PINE = c(1275, 1350),
  PUBR = c(1000, 1200), WING = c(1100, 1200), WIPO = c(1125, 1225),
  SJ = c(1200, 1300), LSJ = c(1250, 1300), SPR = c(1250, 1300),
  PINER = c(1275, 1325), HESH = c(1275, 1450), KWAK = c(1275, 1450)
)

## Calculate date midpoints
mid <- vapply(X = dates, FUN = mean, FUN.VALUE = numeric(1))

## Calculate MCD
(mc_dates <- mcd(zuni[100:125, ], dates = mid))
#> 26 x 18 x 1 time series observed between 757.291 CE and 1259.38 CE

## Get MCD in years CE
time(mc_dates, calendar = CE())
#>  [1]  757.2912  796.6659  797.4991  952.5855  996.2952 1016.0738 1027.5011
#>  [8] 1059.5249 1073.6597 1075.5213 1089.5820 1092.8564 1100.0000 1127.7799
#> [15] 1137.1101 1200.0017 1204.3868 1207.1436 1219.4454 1227.3745 1235.4176
#> [22] 1237.5000 1238.8896 1253.1241 1256.2502 1259.3757

## Bootstrap resampling
boot <- bootstrap(mc_dates, n = 30)
#> Warning: Extreme order statistics used as endpoints.
#> Warning: Extreme order statistics used as endpoints.
#> Warning: Extreme order statistics used as endpoints.
#> Warning: Extreme order statistics used as endpoints.
#> Warning: Extreme order statistics used as endpoints.
#> Warning: Extreme order statistics used as endpoints.
#> Warning: Extreme order statistics used as endpoints.
#> Warning: Extreme order statistics used as endpoints.
#> Warning: Extreme order statistics used as endpoints.
#> Warning: Extreme order statistics used as endpoints.
#> Warning: Extreme order statistics used as endpoints.
#> Warning: Extreme order statistics used as endpoints.
#> Warning: Extreme order statistics used as endpoints.
#> Warning: Extreme order statistics used as endpoints.
#> Warning: Extreme order statistics used as endpoints.
#> Warning: Extreme order statistics used as endpoints.
#> Warning: Extreme order statistics used as endpoints.
#> Warning: Extreme order statistics used as endpoints.
#> Warning: Extreme order statistics used as endpoints.
#> Warning: Extreme order statistics used as endpoints.
#> Warning: Extreme order statistics used as endpoints.
#> Warning: Extreme order statistics used as endpoints.
#> Warning: Extreme order statistics used as endpoints.
#> Warning: Extreme order statistics used as endpoints.
#> Warning: Extreme order statistics used as endpoints.
#> Warning: Extreme order statistics used as endpoints.
head(boot)
#>         original      mean      bias    error    lower     upper
#> LZ0789  757.2917  753.9931 -3.298611 13.33587 727.6042  777.0833
#> LZ0783  796.6667  793.8889 -2.777778 29.43785 724.1667  855.8333
#> LZ0782  797.5000  795.9118 -1.588235 10.04839 774.7059  818.0882
#> LZ0778  952.5862  944.6983 -7.887931 39.95552 856.4655 1041.3793
#> LZ0777  996.2963 1002.0525  5.756173 22.96437 933.7963 1028.0093
#> LZ0776 1016.0714 1021.8452  5.773810 45.89424 926.7857 1141.9643

## Jackknife resampling
jack <- jackknife(mc_dates)
head(jack)
#>         original      mean       bias    error
#> LZ0789  757.2917  768.2870 186.921296 207.5535
#> LZ0783  796.6667  806.9974 175.621693 228.0861
#> LZ0782  797.5000  804.1715 113.415558 169.0563
#> LZ0778  952.5862  954.5205  32.882529 138.6064
#> LZ0777  996.2963  996.6640   6.251785 111.0144
#> LZ0776 1016.0714 1017.1652  18.594831  72.6602

## Plot
plot(mc_dates, decreasing = FALSE)
## Add bootstrap confidence intervals
segments(x0 = boot$lower, y0 = seq_len(nrow(boot)),
         x1 = boot$upper, y1 = seq_len(nrow(boot)))