Learn R Programming

⚠️There's a newer version (1.1.0) of this package.Take me there.

carbondate

An R package to analyse, and summarise, multiple radiocarbon (14C) determinations. The package provides two linked (but distinct) Bayesian approaches that can both be used to obtain rigorous and robust alternatives to summed probability distributions (SPDs):

  • Bayesian Non-Parametric Density Estimation (Modelling the joint, summary, calendar distribution as an unknown mixture of calendar age clusters)
  • Variable-Rate Poisson Process Estimation (Modelling changes in the occurrence rate of the 14C samples over calendar time)

Both methods are implemented using Markov Chain Monte Carlo (MCMC). The package is based partly on the original functions available here which were used for “Non-parametric calibration of multiple related radiocarbon determinations and their calendar age summarisation” (Heaton 2022).

Installation

The easiest way to install the latest release is via CRAN, by typing the following into your R console:

install.packages("carbondate")

You can alternatively install the development version of carbondate from GitHub with:

devtools::install_github("TJHeaton/carbondate")

Once you have installed the library with either of the above methods, you need to load it using:

library(carbondate)

Data

There are a few example datasets of radiocarbon determinations (e.g., two_normals, kerr, pp_uniform_phase, buchanan, alces, equus, human, …) provided, which can be used to try out the calibration functions. two_normals is a small simulated dataset for which the underlying calendar ages were drawn from a known mixture of two normals. It is included simply to give a quick-to-run example for the Bayesian Non-Parametric Density calibration functions. pp_uniform_phase is another small simulated dataset, for which the underlying calendar ages were drawn uniformly at random from a short calendar interval (equivalent to a single uniform phase). This is included to give a quick-to-run example for the Poisson Process modelling functions. The remaining datasets are from real-life data. The Northern Hemisphere IntCal calibration curves and Southern Hemisphere SHCal calibration curves are also provided.

Bayesian Non-Parametric Calibration: Quick-Start Example

The below example implements the Bayesian non-parametric calibration and summarisation approach on the simulated two_normal data using the IntCal20 curve via two (slightly) different MCMC methods.

polya_urn_output <- PolyaUrnBivarDirichlet(
  rc_determinations = two_normals$c14_age,
  rc_sigmas = two_normals$c14_sig,
  calibration_curve=intcal20)

walker_output <- WalkerBivarDirichlet(
  rc_determinations = two_normals$c14_age,
  rc_sigmas = two_normals$c14_sig,
  calibration_curve=intcal20)

Once the calibration has been run, the resultant estimate for the joint (summary) calendar age density can be plotted.

PlotPredictiveCalendarAgeDensity(
  output_data = list(polya_urn_output, walker_output),
  show_SPD = TRUE)

The summary estimates generated by the Bayesian non-parametric approach (shown in purple and green) are called predictive densities. They aim to predict the calendar age of a future (new) sample based upon the set of 14C samples that you have summarised.

Poisson Process Modelling: Quick-Start Example

The below example implements the Poisson process modelling approach using the simulated pp_uniform_phase data and the IntCal20 curve.

pp_output <- PPcalibrate(
  rc_determinations = pp_uniform_phase$c14_age,
  rc_sigmas = pp_uniform_phase$c14_sig,
  calibration_curve=intcal20)

Once the calibration has been run, the posterior estimate for the occurrence rate of the samples can be plotted.

PlotPosteriorMeanRate(output_data = pp_output)

This estimated rate, and changes within it, can be interpreted equivalently to methods of calendar age summarisation.

Copy Link

Version

Install

install.packages('carbondate')

Monthly Downloads

376

Version

1.0.1

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Timothy J Heaton

Last Published

January 31st, 2024

Functions in carbondate (1.0.1)

WalkerBivarDirichlet

Calibrate and Summarise Multiple Radiocarbon Samples via a Bayesian Non-Parametric DPMM (with Walker Updating)
PlotPredictiveCalendarAgeDensity

Plot Predictive Estimate of Shared Calendar Age Density from Bayesian Non-Parametric DPMM Output
PlotPosteriorHeights

Plot Heights of Segments in Rate of Sample Occurrence for Poisson Process Model
PlotNumberOfClusters

Plot Number of Calendar Age Clusters Estimated in Bayesian Non-Parametric DPMM Output
PlotGelmanRubinDiagnosticSingleChain

Plot Histogram of the Gelman-Rubin Convergence Diagnostic for a Single MCMC Chain
PolyaUrnBivarDirichlet

Calibrate and Summarise Multiple Radiocarbon Samples via a Bayesian Non-Parametric DPMM (with Polya Urn Updating)
PlotNumberOfInternalChanges

Plot Number of Changepoints in Rate of Sample Occurrence for Poisson Process Model
PlotPosteriorMeanRate

Plot Posterior Mean Rate of Sample Occurrence for Poisson Process Model
PlotPosteriorChangePoints

Plot Calendar Ages of Changes in Rate of Sample Occurrence for Poisson Process Model
intcal13

IntCal13 calibration curve
alces

Example real-life data - Alces in Yukon and Alaska
cervus

Example real-life data - Cervus in Yukon and Alaska
equus

Example real-life data - Equus in Yukon and Alaska
buchanan

Example real-life data - Palaeo-Indian demography
human

Example real-life data - Humans in Yukon and Alaska
mammuthus

Example real-life data - Mammuthus in Yukon and Alaska
intcal09

IntCal09 calibration curve
intcal04

IntCal04 calibration curve
intcal20

IntCal20 calibration curve
intcal98

IntCal98 calibration curve
shcal20

SHCal20 calibration curve
two_normals

Example artificial data - Mixture of Normal Phases
pp_uniform_phase

Example artificial data - Uniform Phase
shcal13

SHCal13 calibration curve
shcal04

SHCal04 calibration curve
armit

Example real-life data - Population Decline in Iron Age Ireland
bison

Example real-life data - Bison in Yukon and Alaska
kerr

Example real-life data - Irish Rath
PPcalibrate

Model Occurrence of Multiple Radiocarbon Samples as a Variable-Rate Poisson Process
CalibrateSingleDetermination

Calibrate a Single Radiocarbon Determination
GenerateOxcalCode

Outputs code suitable for running in OxCal from a series of radiocarbon determinations
FindPosteriorMeanRate

Find Posterior Mean Rate of Sample Occurrence for Poisson Process Model
PlotCalendarAgeDensityIndividualSample

Plot Posterior Calendar Age Estimate for an Individual Determination after Joint Calibration
PlotConvergenceData

Plot KL Divergence of Predictive Density to Assess Convergence of Bayesian Non-Parametric DPMM Sampler
PlotGelmanRubinDiagnosticMultiChain

Plot Histogram of the Gelman-Rubin Convergence Diagnostic for Multiple Independent MCMC Chains
InterpolateCalibrationCurve

Interpolate a calibration curve at a set of calendar ages
FindPredictiveCalendarAgeDensity

Find Predictive Estimate of Shared Calendar Age Density from Bayesian Non-Parametric DPMM Output
FindSummedProbabilityDistribution

Find the summed probability distribution (SPD) for a set of radiocarbon observations