Generates bootstrap estimations of an MCD.
Usage
# S4 method for class 'MeanDate'
bootstrap(object, n = 1000, f = NULL, calendar = get_calendar())
Arguments
- object
- n
A non-negative
integer
specifying the number of bootstrap replications.- 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 (seeaion::calendar()
).
Value
If f
is NULL
, bootstrap()
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 bootstrap estimate of mean.
- bias
The bootstrap estimate of bias.
- error
The boostrap estimate of standard error.
See also
Other resampling methods:
bootstrap.EventDate
,
jackknife.EventDate
,
jackknife.MeanDate
,
simulate.MeanDate()
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
## Plot
plot(mc_dates)
## Bootstrap resampling
boot <- bootstrap(mc_dates, n = 30)
head(boot)
#> original mean bias error
#> LZ0789 757.2917 NaN NaN NA
#> LZ0783 796.6667 871.5393 74.872615 131.18539
#> LZ0782 797.5000 853.3771 55.877123 90.10455
#> LZ0778 952.5862 982.2641 29.677845 97.47512
#> LZ0777 996.2963 1001.4051 5.108790 93.74198
#> LZ0776 1016.0714 1010.6228 -5.448629 86.83343
## 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
## Simulation
sim <- simulate(mc_dates, nsim = 30)
plot(sim, interval = "range", pch = 16)