Skip to contents

Simulates MCD from a multinomial distribution.

Usage

# S4 method for class 'MeanDate'
simulate(object, nsim = 1000, seed = NULL, ...)

Arguments

object

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

nsim

A non-negative integer specifying the number of simulations.

seed

An object specifying if and how the random number generator should be initialized (see stats::simulate()).

...

Currently not used.

Value

A SimulationMeanDate object.

Details

For each assemblage, a large number of new bootstrap replicates is created, with the same sample size, by resampling the original assemblage with replacement. MCDs are calculated for each replicates.

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

## Plot
plot(mc_dates)


## Bootstrap resampling
boot <- bootstrap(mc_dates, n = 30)
head(boot)
#>         original      mean     bias     error
#> LZ0789  757.2917  769.8849 12.59326  70.42264
#> LZ0783  796.6667  839.3107 42.64399 122.87193
#> LZ0782  797.5000       NaN      NaN        NA
#> LZ0778  952.5862  984.3342 31.74801 120.11099
#> LZ0777  996.2963 1020.3336 24.03729  81.34437
#> LZ0776 1016.0714 1039.5134 23.44199  65.77519

## 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)