Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

simulateCalendarDates

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=NULL, 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)

ADMUR

Ancient Demographic Modelling Using Radiocarbon

v1.0.3
GPL-3
Authors
Adrian Timpson [aut, cre] (<https://orcid.org/0000-0003-0292-8729>)
Initial release
2021-03-19

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.