simulate_event_counts: Simulate event counts.

View source: R/simulate_event_counts.R

simulate_event_countsR Documentation

Simulate event counts.

Description

Simulate event counts.

Usage

simulate_event_counts(
  process,
  times,
  nevents,
  nsamples,
  interval = NULL,
  binning_resolution = -1,
  BP = T,
  c14 = T,
  chronun_matrix = NULL,
  new_times = NULL,
  bigmatrix = NULL,
  bigfileprefix = "count_ensemble",
  parallel = T
)

Arguments

process

A vector describing the background event-count process (i.e., conditional mean of count-based random variable). This will be passed to R's 'sample()' function as the 'prob' parameter.

times

A vector of event times to sample from.

nevents

Integer number of events with uncertain event-times.

nsamples

Integer number of sample sequences to draw.

binning_resolution

Resolution of the desired time intervals (time bins). It should be negative if using the BP timescale (i.e, if BP = T).

BP

Logical (default T). Assume a Before Present timescale?

c14

Logical (default T). Are the events dated with radiocarbon? If so, the R package 'IntCal' will be used to simulate c14 dates from the 'true' samples of the 'times' vector and then calibrate those dates.

chronun_matrix

A matrix containing discrete estimates describing chronological uncertainty. Each column should contain density estimates for a single event and the rows should each refer to discrete times. If c14 = F, then this matrix must be included.

new_times

A vector of times corresponding to the rows in the chronun matrix.

bigmatrix

A character vector containing a path pointing to folder for storing the bigmemory matrix descriptor file and matrix. Default is NULL, in which case it is assumed that a bigmatrix is not being used.

bigfileprefix

A character vector that will be used as a prefix for naming the bigmemory matrix descriptor file and matrix (*_desc and *_mat will be appended). Default is "count_ensemble"—not used if bigmatrix=NULL.

parallel

Logical (default = T). Use parallel (multiple processors) to speed up computation?

Value

A list with 1) a matrix containing probable event count sequences or a file path pointing to a file-backed bigmatrix (an event count ensemble); 2) a dataframe containing the true (chronological-error-free) event-count sample; 3) a vector of time-stamps corresponding to the rows in the event count ensemble matrix; and 4) a vector of simulated uncalibrated radiocarbon dates (NULL if c14 == FALSE).


wccarleton/chronup documentation built on March 29, 2023, 1:24 a.m.