Function to be used for checking the data formats in BchronCalibrate and Bchronology. Mostly to be used internally to avoid Bchron running into problems with bad data specifications, but might also be useful for

BchronCheck(
  ages,
  ageSds,
  positions = NULL,
  pathToCalCurves = NULL,
  calCurves = NULL,
  positionThicknesses = NULL,
  ids = NULL,
  outlierProbs = NULL,
  predictPositions = NULL,
  artificialThickness = NULL,
  allowOutside = NULL,
  iterations = NULL,
  thetaStart = NULL,
  burn = NULL,
  thin = NULL,
  extractDate = NULL,
  maxExtrap = NULL,
  thetaMhSd = NULL,
  muMhSd = NULL,
  psiMhSd = NULL,
  ageScaleVal = NULL,
  positionEps = NULL,
  positionNormalise = NULL,
  eps = NULL,
  dfs = NULL,
  type = c("BchronCalibrate", "Bchronology")
)

Arguments

ages

A vector of ages provided in years before 1950.

ageSds

A vector of 1-sigma values for the ages given above

positions

Position values (e.g. depths) for each age. In the case of layers of non-zero thickness, this should be the middle value of the slice

pathToCalCurves

File path to where the calibration curves are located. Defaults to the system directory where the 3 standard calibration curves are stored.

calCurves

A vector of values containing either intcal20, shcal20, marine20, or normal (older calibration curves are supposed such as intcal13). Should be the same length the number of ages supplied. Non-standard calibration curves can be used provided they are supplied in the same format as those previously mentioned and are placed in the same directory. Normal indicates a normally-distributed (non-14C) age.

positionThicknesses

Thickness values for each of the positions. The thickness value should be the full thickness value of the slice. By default set to zero.

ids

ID names for each age

outlierProbs

A vector of prior outlier probabilities, one for each age. Defaults to 0.01

predictPositions

A vector of positions (e.g. depths) at which predicted age values are required. Defaults to a sequence of length 100 from the top position to the bottom position

artificialThickness

Amount to add to the thickness values in the case of equal positions with no positionThicknesses. Bchron may fail if positionThicknesses are zero and some positions are repeated. This value is added on to the zero thicknesses (only in the case of repeated positions) to stop this failure.

allowOutside

Whether to allow calibrations to run outside the range of the calibration curve. By default this is turned off as calibrations outside of the range of the calibration curve can cause severe issues with probability ranges of calibrated dates

iterations

The number of iterations to run the procedure for

thetaStart

A set of starting values for the calendar ages estimated by Bchron. If NULL uses a function to estimate the ages. These should be in the same units as the posterior ages required. See example below for usage.

burn

The number of starting iterations to discard

thin

The step size for every iteration to keep beyond the burn-in

extractDate

The top age of the core. Used for extrapolation purposes so that no extrapolated ages go beyond the top age of the core. Defaults to the current year

maxExtrap

The maximum number of extrapolations to perform before giving up and setting the predicted ages to NA. Useful for when large amounts of extrapolation are required, i.e. some of the predictPositions are a long way from the dated positions

thetaMhSd

The Metropolis-Hastings standard deviation for the age parameters

muMhSd

The Metropolis-Hastings standard deviation for the Compound Poisson-Gamma mean

psiMhSd

The Metropolis-Hastings standard deviation for the Compound Poisson-Gamma scale

ageScaleVal

A scale value for the ages. Bchronology works best when the ages are scaled to be approximately between 0 and 100. The default value is thus 1000 for ages given in years.

positionEps

A small value used to check whether simulated positions are far enough apart to avoid numerical underflow errors. If errors occur in model runs (e.g. missing value where TRUE/FALSE needed increase this value)

positionNormalise

Whether to normalise the position values. Bchronology works best when the positions are normalised to be between 0 and 1 The default value is TRUE

eps

Cut-off point for density calculation. A value of eps>0 removes ages from the output which have negligible probability density

dfs

Degrees-of-freedom values for the t-distribution associated with the calibration calculation. A large value indicates Gaussian distributions assumed for the 14C ages

type

Whether this function has been called to check parameters for calibration purposes (BchronCalibrate) or chronology purposes (Bchronology)

Value

This function returns nothing other than a message.

Examples

data(Glendalough)

# Check the Glendalough data are in the right format
with(
  Glendalough,
  BchronCheck(ages,
    ageSds,
    position,
    pathToCalCurves = system.file("data", package = "Bchron"),
    calCurves,
    type = "BchronCalibrate"
  )
)