Learn R Programming

ADMUR (version 1.0.3)

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.

Value

Returns a vector of calendar dates

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.

Examples

Run this code
# NOT RUN {
	# 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)
	
# }

Run the code above in your browser using DataLab