simulateCalendarDates: Converts calendar dates to 14C dates

View source: R/functions.R

simulateCalendarDatesR Documentation

Converts calendar dates to 14C dates

Description

Randomly samples calendar dates from a model, including dates slightly outside the model date range to avoid edge effects

Usage

simulateCalendarDates(model, n)

Arguments

model

A data frame including columns 'year' and 'pdf'

n

The number of dates to sample.

Details

Samples n random calendar dates from a model pdf. This model must be defined in terms of a PDF vector and the corresponding calendar years. This can be provided at any preferred temporal resolution. For example, an exponential model can be provided with the PDF in annual intervals, whilst CPL model needs only the hinge points. convertPars will convert parameters into the required model format.

Value

Returns a vector of calendar dates

Examples

	# under a uniform model
	model <- convertPars(pars=NA, years=5000:6000,type='uniform')
	sims <- simulateCalendarDates(model, 1000)
	range(sims)
	
	# simulate under an exponential model
	model <- convertPars(pars=0.001, years=5000:6000,type='exp')
	sims <- simulateCalendarDates(model, 1000)
	range(sims)
	
	# under a CPL model
	model <- convertPars(pars=runif(5), years=5000:6000,type='CPL')
	sims <- simulateCalendarDates(model, 1000)
	range(sims)
	

UCL/ADMUR documentation built on Sept. 14, 2023, 11:41 a.m.