Fits a non-parametric chronology model to age/position data according to the Compound Poisson-Gamma model defined by Haslett and Parnell (2008) <DOI:10.1111/j.1467-9876.2008.00623.x>. This version uses a slightly modified Markov chain Monte Carlo fitting algorithm which aims to converge quicker and requires fewer iterations. It also a slightly modified procedure for identifying outliers

Bchronology(
  ages,
  ageSds,
  positions,
  positionThicknesses = rep(0, length(ages)),
  calCurves = rep("intcal20", length(ages)),
  ids = NULL,
  outlierProbs = rep(0.01, length(ages)),
  predictPositions = seq(min(positions), max(positions), length = 100),
  pathToCalCurves = system.file("data", package = "Bchron"),
  artificialThickness = 0.01,
  allowOutside = FALSE,
  iterations = 10000,
  burn = 2000,
  thin = 8,
  extractDate = 1950 - as.numeric(format(Sys.time(), "%Y")),
  maxExtrap = 1000,
  thetaStart = NULL,
  thetaMhSd = 0.5,
  muMhSd = 0.1,
  psiMhSd = 0.1,
  ageScaleVal = 1000,
  positionEps = 1e-05,
  positionNormalise = TRUE
)

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

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.

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.

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

pathToCalCurves

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

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

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

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.

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

Value

A list of class BchronologyRun which include elements:

theta

The posterior estimated values of the ages

phi

The posterior estimated outlier values (1=outlier, 2=not outlier). The means of this parameter give the posterior estimated outlier probabilities

mu

The posterior values of the Compound Poisson-Gamma mean

psi

The posterior values of the Compound Poisson-Gamma scale

thetaPredict

The posterior estimated ages for each of the values in predictPosition

predictPositions

The positions at which estimated ages were required

calAges

The calibrated ages as output from BchronCalibrate

inputVals

All of the input values to the Bchronology run

Details

The Bchronology function fits a compound Poisson-Gamma distribution to the increments between the dated levels. This involves a stochastic linear interpolation step where the age gaps are Gamma distributed, and the position gaps are Exponential. Radiocarbon and non-radiocarbon dates (including outliers) are updated within the function also by MCMC.

References

Haslett, J., and Parnell, A. C. (2008). A simple monotone process with application to radiocarbon-dated depth chronologies. Journal of the Royal Statistical Society, Series C, 57, 399-418. DOI:10.1111/j.1467-9876.2008.00623.x Parnell, A. C., Haslett, J., Allen, J. R. M., Buck, C. E., and Huntley, B. (2008). A flexible approach to assessing synchroneity of past events using Bayesian reconstructions of sedimentation history. Quaternary Science Reviews, 27(19-20), 1872-1885. DOI:10.1016/j.quascirev.2008.07.009

Examples

# \donttest{
# Data from Glendalough
data(Glendalough)

# Run in Bchronology - all but first age uses intcal20
GlenOut <- with(
  Glendalough,
  Bchronology(
    ages = ages,
    ageSds = ageSds,
    calCurves = calCurves,
    positions = position,
    positionThicknesses = thickness,
    ids = id,
    predictPositions = seq(0, 1500, by = 10)
  )
)
#> Running Bchronology...
#> 
  |                                                                  
  |                                                            |   0%
  |                                                                  
  |                                                            |   1%
  |                                                                  
  |=                                                           |   1%
  |                                                                  
  |=                                                           |   2%
  |                                                                  
  |==                                                          |   3%
  |                                                                  
  |==                                                          |   4%
  |                                                                  
  |===                                                         |   4%
  |                                                                  
  |===                                                         |   5%
  |                                                                  
  |===                                                         |   6%
  |                                                                  
  |====                                                        |   6%
  |                                                                  
  |====                                                        |   7%
  |                                                                  
  |=====                                                       |   8%
  |                                                                  
  |=====                                                       |   9%
  |                                                                  
  |======                                                      |   9%
  |                                                                  
  |======                                                      |  10%
  |                                                                  
  |======                                                      |  11%
  |                                                                  
  |=======                                                     |  11%
  |                                                                  
  |=======                                                     |  12%
  |                                                                  
  |========                                                    |  13%
  |                                                                  
  |========                                                    |  14%
  |                                                                  
  |=========                                                   |  14%
  |                                                                  
  |=========                                                   |  15%
  |                                                                  
  |=========                                                   |  16%
  |                                                                  
  |==========                                                  |  16%
  |                                                                  
  |==========                                                  |  17%
  |                                                                  
  |===========                                                 |  18%
  |                                                                  
  |===========                                                 |  19%
  |                                                                  
  |============                                                |  19%
  |                                                                  
  |============                                                |  20%
  |                                                                  
  |============                                                |  21%
  |                                                                  
  |=============                                               |  21%
  |                                                                  
  |=============                                               |  22%
  |                                                                  
  |==============                                              |  23%
  |                                                                  
  |==============                                              |  24%
  |                                                                  
  |===============                                             |  24%
  |                                                                  
  |===============                                             |  25%
  |                                                                  
  |===============                                             |  26%
  |                                                                  
  |================                                            |  26%
  |                                                                  
  |================                                            |  27%
  |                                                                  
  |=================                                           |  28%
  |                                                                  
  |=================                                           |  29%
  |                                                                  
  |==================                                          |  29%
  |                                                                  
  |==================                                          |  30%
  |                                                                  
  |==================                                          |  31%
  |                                                                  
  |===================                                         |  31%
  |                                                                  
  |===================                                         |  32%
  |                                                                  
  |====================                                        |  33%
  |                                                                  
  |====================                                        |  34%
  |                                                                  
  |=====================                                       |  34%
  |                                                                  
  |=====================                                       |  35%
  |                                                                  
  |=====================                                       |  36%
  |                                                                  
  |======================                                      |  36%
  |                                                                  
  |======================                                      |  37%
  |                                                                  
  |=======================                                     |  38%
  |                                                                  
  |=======================                                     |  39%
  |                                                                  
  |========================                                    |  39%
  |                                                                  
  |========================                                    |  40%
  |                                                                  
  |========================                                    |  41%
  |                                                                  
  |=========================                                   |  41%
  |                                                                  
  |=========================                                   |  42%
  |                                                                  
  |==========================                                  |  43%
  |                                                                  
  |==========================                                  |  44%
  |                                                                  
  |===========================                                 |  44%
  |                                                                  
  |===========================                                 |  45%
  |                                                                  
  |===========================                                 |  46%
  |                                                                  
  |============================                                |  46%
  |                                                                  
  |============================                                |  47%
  |                                                                  
  |=============================                               |  48%
  |                                                                  
  |=============================                               |  49%
  |                                                                  
  |==============================                              |  49%
  |                                                                  
  |==============================                              |  50%
  |                                                                  
  |==============================                              |  51%
  |                                                                  
  |===============================                             |  51%
  |                                                                  
  |===============================                             |  52%
  |                                                                  
  |================================                            |  53%
  |                                                                  
  |================================                            |  54%
  |                                                                  
  |=================================                           |  54%
  |                                                                  
  |=================================                           |  55%
  |                                                                  
  |=================================                           |  56%
  |                                                                  
  |==================================                          |  56%
  |                                                                  
  |==================================                          |  57%
  |                                                                  
  |===================================                         |  58%
  |                                                                  
  |===================================                         |  59%
  |                                                                  
  |====================================                        |  59%
  |                                                                  
  |====================================                        |  60%
  |                                                                  
  |====================================                        |  61%
  |                                                                  
  |=====================================                       |  61%
  |                                                                  
  |=====================================                       |  62%
  |                                                                  
  |======================================                      |  63%
  |                                                                  
  |======================================                      |  64%
  |                                                                  
  |=======================================                     |  64%
  |                                                                  
  |=======================================                     |  65%
  |                                                                  
  |=======================================                     |  66%
  |                                                                  
  |========================================                    |  66%
  |                                                                  
  |========================================                    |  67%
  |                                                                  
  |=========================================                   |  68%
  |                                                                  
  |=========================================                   |  69%
  |                                                                  
  |==========================================                  |  69%
  |                                                                  
  |==========================================                  |  70%
  |                                                                  
  |==========================================                  |  71%
  |                                                                  
  |===========================================                 |  71%
  |                                                                  
  |===========================================                 |  72%
  |                                                                  
  |============================================                |  73%
  |                                                                  
  |============================================                |  74%
  |                                                                  
  |=============================================               |  74%
  |                                                                  
  |=============================================               |  75%
  |                                                                  
  |=============================================               |  76%
  |                                                                  
  |==============================================              |  76%
  |                                                                  
  |==============================================              |  77%
  |                                                                  
  |===============================================             |  78%
  |                                                                  
  |===============================================             |  79%
  |                                                                  
  |================================================            |  79%
  |                                                                  
  |================================================            |  80%
  |                                                                  
  |================================================            |  81%
  |                                                                  
  |=================================================           |  81%
  |                                                                  
  |=================================================           |  82%
  |                                                                  
  |==================================================          |  83%
  |                                                                  
  |==================================================          |  84%
  |                                                                  
  |===================================================         |  84%
  |                                                                  
  |===================================================         |  85%
  |                                                                  
  |===================================================         |  86%
  |                                                                  
  |====================================================        |  86%
  |                                                                  
  |====================================================        |  87%
  |                                                                  
  |=====================================================       |  88%
  |                                                                  
  |=====================================================       |  89%
  |                                                                  
  |======================================================      |  89%
  |                                                                  
  |======================================================      |  90%
  |                                                                  
  |======================================================      |  91%
  |                                                                  
  |=======================================================     |  91%
  |                                                                  
  |=======================================================     |  92%
  |                                                                  
  |========================================================    |  93%
  |                                                                  
  |========================================================    |  94%
  |                                                                  
  |=========================================================   |  94%
  |                                                                  
  |=========================================================   |  95%
  |                                                                  
  |=========================================================   |  96%
  |                                                                  
  |==========================================================  |  96%
  |                                                                  
  |==========================================================  |  97%
  |                                                                  
  |=========================================================== |  98%
  |                                                                  
  |=========================================================== |  99%
  |                                                                  
  |============================================================|  99%
  |                                                                  
  |============================================================| 100%
#> Run completed!

# Summarise it a few different ways
summary(GlenOut) # Default is for quantiles of ages at predictPosition values
#> Quantiles of predicted ages by depth: 
#>  Depth      2.5%      25%     50%      75%     97.5%
#>      0    -1.000    -1.00     0.0     1.00     2.000
#>     10    11.000    35.75    55.0   118.00   516.500
#>     20    23.975    71.00   110.0   210.50   803.025
#>     30    35.000   109.00   165.0   292.25   921.025
#>     40    47.000   146.75   220.0   377.25  1087.350
#>     50    60.975   184.00   274.5   443.25  1163.175
#>     60    72.975   223.75   329.0   513.50  1233.350
#>     70    86.000   267.75   385.0   574.00  1285.725
#>     80   101.975   314.00   439.0   628.25  1338.875
#>     90   116.950   356.75   493.0   682.75  1431.025
#>    100   133.850   397.00   546.0   743.00  1465.050
#>    110   158.975   437.75   600.0   802.25  1503.200
#>    120   174.000   488.75   653.0   865.50  1595.175
#>    130   187.000   536.75   705.0   924.50  1643.075
#>    140   202.975   582.00   761.5   985.25  1663.850
#>    150   223.850   618.25   817.0  1041.25  1738.400
#>    160   237.850   657.75   871.0  1104.25  1786.000
#>    170   254.950   698.75   921.0  1162.25  1822.025
#>    180   274.975   743.75   975.0  1212.00  1847.600
#>    190   287.975   786.75  1030.0  1257.50  1876.525
#>    200   312.875   836.00  1085.0  1321.25  1911.075
#>    210   350.600   882.50  1138.0  1361.00  1973.025
#>    220   371.900   941.50  1183.0  1417.50  1991.200
#>    230   414.725   993.00  1238.0  1464.00  2008.000
#>    240   442.775  1055.75  1298.5  1511.00  2031.100
#>    250   492.800  1124.50  1347.5  1551.50  2064.050
#>    260   541.750  1171.00  1403.5  1604.25  2099.075
#>    270   586.650  1218.00  1453.0  1655.25  2135.025
#>    280   634.400  1269.75  1508.5  1698.25  2153.175
#>    290   668.975  1320.75  1563.5  1745.25  2181.025
#>    300   718.575  1372.50  1610.5  1792.75  2193.050
#>    310   747.000  1415.75  1665.5  1836.00  2210.050
#>    320   786.900  1485.00  1717.0  1877.25  2228.000
#>    330   848.750  1547.50  1765.5  1934.25  2239.075
#>    340   931.000  1603.00  1821.5  1971.00  2270.100
#>    350  1002.950  1669.75  1879.0  2016.00  2304.600
#>    360  1104.650  1729.75  1932.5  2056.25  2341.000
#>    370  1168.950  1798.00  1982.5  2102.50  2355.100
#>    380  1212.000  1857.75  2029.0  2144.00  2378.150
#>    390  1331.775  1935.00  2084.5  2187.25  2418.125
#>    400  1437.000  2010.00  2135.0  2233.00  2452.150
#>    410  1568.925  2089.00  2191.0  2278.00  2534.100
#>    420  1860.900  2166.50  2264.0  2325.50  2610.100
#>    430  2180.975  2311.50  2389.0  2494.50  3159.450
#>    440  2239.950  2396.00  2513.5  2725.25  4052.550
#>    450  2293.950  2480.00  2625.5  2940.50  4609.200
#>    460  2340.000  2560.00  2731.5  3125.25  4837.525
#>    470  2377.000  2639.00  2846.5  3316.00  5084.775
#>    480  2414.950  2720.75  2955.0  3454.25  5324.350
#>    490  2451.925  2803.50  3071.5  3575.00  5428.175
#>    500  2480.950  2891.75  3160.5  3706.00  5726.825
#>    510  2512.900  2971.75  3286.5  3868.50  5844.525
#>    520  2551.550  3047.75  3389.0  4001.50  6030.450
#>    530  2592.925  3123.75  3499.0  4126.25  6228.475
#>    540  2634.975  3212.00  3600.5  4237.25  6464.725
#>    550  2671.850  3283.50  3707.0  4391.50  6626.125
#>    560  2705.875  3367.00  3813.0  4525.50  6759.475
#>    570  2754.950  3461.00  3923.5  4642.25  6927.750
#>    580  2797.900  3536.25  4033.0  4787.25  7017.575
#>    590  2835.850  3636.50  4128.0  4899.00  7085.750
#>    600  2867.775  3705.00  4227.0  4995.25  7222.475
#>    610  2904.975  3804.00  4331.5  5093.25  7309.250
#>    620  2943.000  3913.00  4442.5  5216.00  7454.050
#>    630  2996.800  4026.00  4547.5  5317.50  7484.750
#>    640  3067.975  4106.50  4655.0  5416.75  7514.175
#>    650  3108.925  4181.75  4762.5  5521.50  7734.925
#>    660  3173.400  4284.00  4876.5  5649.75  7870.125
#>    670  3209.525  4374.00  4979.0  5785.25  7931.150
#>    680  3279.325  4472.50  5083.0  5906.75  7994.125
#>    690  3320.850  4555.00  5179.5  6011.75  8063.600
#>    700  3370.850  4644.25  5285.5  6089.75  8209.025
#>    710  3433.850  4740.50  5393.5  6208.25  8235.925
#>    720  3500.625  4827.75  5501.0  6300.75  8426.300
#>    730  3547.500  4932.25  5600.0  6364.00  8456.650
#>    740  3580.425  5030.25  5707.0  6484.75  8523.700
#>    750  3641.050  5119.75  5810.0  6607.00  8565.275
#>    760  3666.300  5213.75  5922.5  6714.25  8602.100
#>    770  3729.025  5286.25  6026.5  6814.25  8633.325
#>    780  3812.525  5369.50  6129.0  6929.25  8769.250
#>    790  3863.850  5472.00  6230.0  7057.00  8795.875
#>    800  3944.875  5565.50  6335.0  7136.25  8868.325
#>    810  3993.875  5665.50  6435.5  7233.50  8905.250
#>    820  4037.850  5754.00  6548.0  7325.25  8949.175
#>    830  4074.650  5880.00  6667.0  7428.75  9058.275
#>    840  4117.975  5995.50  6774.5  7518.75  9147.125
#>    850  4174.800  6096.50  6883.0  7624.00  9187.300
#>    860  4248.650  6214.00  6990.0  7718.25  9225.150
#>    870  4321.750  6320.75  7102.5  7804.00  9263.025
#>    880  4375.000  6452.75  7210.0  7895.25  9312.000
#>    890  4439.950  6558.75  7317.0  8000.00  9348.100
#>    900  4486.950  6652.25  7427.0  8075.25  9386.650
#>    910  4568.100  6758.75  7535.0  8184.25  9469.750
#>    920  4680.650  6878.75  7643.5  8273.50  9534.125
#>    930  4760.375  6989.00  7751.0  8357.00  9563.200
#>    940  4863.850  7098.50  7864.0  8446.00  9592.325
#>    950  4972.950  7210.25  7971.0  8542.75  9624.325
#>    960  5068.225  7345.75  8078.0  8634.00  9662.150
#>    970  5130.725  7453.25  8190.0  8730.75  9701.050
#>    980  5174.925  7585.75  8296.5  8817.25  9741.800
#>    990  5283.450  7702.75  8407.5  8898.25  9807.100
#>   1000  5336.400  7829.75  8514.0  8995.00  9841.125
#>   1010  5389.425  7977.25  8619.5  9092.75  9880.275
#>   1020  5570.800  8107.75  8719.0  9179.25  9913.075
#>   1030  5646.900  8218.75  8826.0  9233.25  9954.125
#>   1040  5775.050  8323.50  8928.0  9329.25  9984.175
#>   1050  5956.225  8458.50  9040.0  9408.75 10016.000
#>   1060  6087.400  8590.75  9140.0  9492.25 10048.175
#>   1070  6217.225  8721.75  9248.0  9570.00 10074.200
#>   1080  6419.750  8836.75  9356.5  9651.50 10124.050
#>   1090  6636.650  8964.00  9462.5  9733.50 10155.150
#>   1100  6820.550  9100.75  9563.5  9813.00 10186.150
#>   1110  7053.875  9253.25  9668.0  9891.25 10217.025
#>   1120  7400.275  9407.75  9778.5  9974.25 10259.075
#>   1130  7815.350  9564.25  9887.0 10063.25 10296.050
#>   1140  8161.575  9744.00 10001.0 10141.25 10330.050
#>   1150  8652.900  9935.75 10113.0 10214.00 10374.125
#>   1160  9227.700 10142.50 10231.5 10296.00 10430.025
#>   1170 10306.000 10376.00 10426.0 10494.25 10758.025
#>   1180 10460.775 10607.00 10656.5 10714.00 11014.150
#>   1190 10570.925 10843.75 10890.5 10936.00 11111.050
#>   1200 10801.925 11085.75 11128.0 11162.00 11250.075
#>   1210 11146.975 11250.00 11283.0 11345.25 11656.150
#>   1220 11213.975 11323.75 11371.5 11470.00 11963.325
#>   1230 11240.975 11393.75 11459.5 11595.00 12146.150
#>   1240 11271.975 11462.50 11549.0 11697.00 12220.200
#>   1250 11301.975 11524.50 11638.0 11793.25 12338.225
#>   1260 11327.925 11601.75 11726.0 11881.00 12424.200
#>   1270 11353.800 11675.75 11816.0 11976.25 12491.175
#>   1280 11371.950 11760.00 11904.0 12068.00 12556.150
#>   1290 11414.825 11849.75 11991.5 12146.50 12611.125
#>   1300 11448.975 11936.75 12083.0 12220.00 12662.000
#>   1310 11482.000 12029.50 12175.5 12306.50 12692.025
#>   1320 11545.725 12117.75 12264.0 12389.25 12714.350
#>   1330 11646.000 12218.00 12354.0 12463.25 12756.150
#>   1340 11703.000 12316.75 12443.0 12548.25 12793.050
#>   1350 11817.950 12414.50 12531.0 12623.25 12829.025
#>   1360 11945.650 12530.75 12622.0 12698.00 12873.050
#>   1370 12157.875 12643.75 12709.0 12773.50 12924.100
#>   1380 12441.525 12757.75 12806.0 12860.25 13000.050
#>   1390 12829.975 12887.00 12933.0 12996.00 13177.150
#>   1400 12899.000 12998.00 13044.0 13109.00 13295.075
#>   1410 12957.975 13110.00 13158.0 13211.00 13351.025
#>   1420 12998.950 13215.75 13265.0 13311.25 13413.025
#>   1430 13186.000 13324.00 13372.0 13416.00 13523.025
#>   1440 13348.975 13433.00 13491.5 13603.00 14259.400
#>   1450 13371.950 13483.50 13580.0 13780.50 14706.350
#>   1460 13388.000 13517.50 13656.0 13937.00 15123.125
#>   1470 13399.950 13557.75 13739.5 14083.25 15303.925
#>   1480 13407.950 13598.00 13826.5 14239.25 15495.000
#>   1490 13417.900 13647.00 13907.0 14348.00 15753.325
#>   1500 13423.000 13689.75 13989.0 14458.25 16011.125
summary(GlenOut, type = "convergence") # Check model convergence
#> Convergence check (watch for too many small p-values): 
#>             p-value
#> RateVar     0.00300
#> Beta-100899 0.01327
#> Outlier 5   0.02243
#> RateMean    0.03645
#> Outlier 2   0.04093
#> Outlier 4   0.04602
#> Beta-100900 0.06419
#> Outlier 1   0.07844
#> Beta-122061 0.09278
#> Outlier 3   0.10291
#> Beta-100901 0.11095
#> Top-1       0.22592
#> Beta-100897 0.34461
#> Outlier 6   0.35838
summary(GlenOut, type = "outliers") # Look at outlier probabilities
#> Posterior outlier probability by date: 
#>         Date OutlierProb
#>        Top-1       0.005
#>  Beta-122061       0.008
#>  Beta-100901       0.005
#>  Beta-100900       0.013
#>  Beta-100899       0.008
#>  Beta-100897       0.005

# Predict for some new positions
predictAges <- predict(GlenOut,
  newPositions = c(150, 725, 1500),
  newPositionThicknesses = c(5, 0, 20)
)
#> 
  |                                                                  
  |                                                            |   0%
  |                                                                  
  |                                                            |   1%
  |                                                                  
  |=                                                           |   1%
  |                                                                  
  |=                                                           |   2%
  |                                                                  
  |==                                                          |   3%
  |                                                                  
  |==                                                          |   4%
  |                                                                  
  |===                                                         |   4%
  |                                                                  
  |===                                                         |   5%
  |                                                                  
  |===                                                         |   6%
  |                                                                  
  |====                                                        |   6%
  |                                                                  
  |====                                                        |   7%
  |                                                                  
  |=====                                                       |   8%
  |                                                                  
  |=====                                                       |   9%
  |                                                                  
  |======                                                      |   9%
  |                                                                  
  |======                                                      |  10%
  |                                                                  
  |======                                                      |  11%
  |                                                                  
  |=======                                                     |  11%
  |                                                                  
  |=======                                                     |  12%
  |                                                                  
  |========                                                    |  13%
  |                                                                  
  |========                                                    |  14%
  |                                                                  
  |=========                                                   |  14%
  |                                                                  
  |=========                                                   |  15%
  |                                                                  
  |=========                                                   |  16%
  |                                                                  
  |==========                                                  |  16%
  |                                                                  
  |==========                                                  |  17%
  |                                                                  
  |===========                                                 |  18%
  |                                                                  
  |===========                                                 |  19%
  |                                                                  
  |============                                                |  19%
  |                                                                  
  |============                                                |  20%
  |                                                                  
  |============                                                |  21%
  |                                                                  
  |=============                                               |  21%
  |                                                                  
  |=============                                               |  22%
  |                                                                  
  |==============                                              |  23%
  |                                                                  
  |==============                                              |  24%
  |                                                                  
  |===============                                             |  24%
  |                                                                  
  |===============                                             |  25%
  |                                                                  
  |===============                                             |  26%
  |                                                                  
  |================                                            |  26%
  |                                                                  
  |================                                            |  27%
  |                                                                  
  |=================                                           |  28%
  |                                                                  
  |=================                                           |  29%
  |                                                                  
  |==================                                          |  29%
  |                                                                  
  |==================                                          |  30%
  |                                                                  
  |==================                                          |  31%
  |                                                                  
  |===================                                         |  31%
  |                                                                  
  |===================                                         |  32%
  |                                                                  
  |====================                                        |  33%
  |                                                                  
  |====================                                        |  34%
  |                                                                  
  |=====================                                       |  34%
  |                                                                  
  |=====================                                       |  35%
  |                                                                  
  |=====================                                       |  36%
  |                                                                  
  |======================                                      |  36%
  |                                                                  
  |======================                                      |  37%
  |                                                                  
  |=======================                                     |  38%
  |                                                                  
  |=======================                                     |  39%
  |                                                                  
  |========================                                    |  39%
  |                                                                  
  |========================                                    |  40%
  |                                                                  
  |========================                                    |  41%
  |                                                                  
  |=========================                                   |  41%
  |                                                                  
  |=========================                                   |  42%
  |                                                                  
  |==========================                                  |  43%
  |                                                                  
  |==========================                                  |  44%
  |                                                                  
  |===========================                                 |  44%
  |                                                                  
  |===========================                                 |  45%
  |                                                                  
  |===========================                                 |  46%
  |                                                                  
  |============================                                |  46%
  |                                                                  
  |============================                                |  47%
  |                                                                  
  |=============================                               |  48%
  |                                                                  
  |=============================                               |  49%
  |                                                                  
  |==============================                              |  49%
  |                                                                  
  |==============================                              |  50%
  |                                                                  
  |==============================                              |  51%
  |                                                                  
  |===============================                             |  51%
  |                                                                  
  |===============================                             |  52%
  |                                                                  
  |================================                            |  53%
  |                                                                  
  |================================                            |  54%
  |                                                                  
  |=================================                           |  54%
  |                                                                  
  |=================================                           |  55%
  |                                                                  
  |=================================                           |  56%
  |                                                                  
  |==================================                          |  56%
  |                                                                  
  |==================================                          |  57%
  |                                                                  
  |===================================                         |  58%
  |                                                                  
  |===================================                         |  59%
  |                                                                  
  |====================================                        |  59%
  |                                                                  
  |====================================                        |  60%
  |                                                                  
  |====================================                        |  61%
  |                                                                  
  |=====================================                       |  61%
  |                                                                  
  |=====================================                       |  62%
  |                                                                  
  |======================================                      |  63%
  |                                                                  
  |======================================                      |  64%
  |                                                                  
  |=======================================                     |  64%
  |                                                                  
  |=======================================                     |  65%
  |                                                                  
  |=======================================                     |  66%
  |                                                                  
  |========================================                    |  66%
  |                                                                  
  |========================================                    |  67%
  |                                                                  
  |=========================================                   |  68%
  |                                                                  
  |=========================================                   |  69%
  |                                                                  
  |==========================================                  |  69%
  |                                                                  
  |==========================================                  |  70%
  |                                                                  
  |==========================================                  |  71%
  |                                                                  
  |===========================================                 |  71%
  |                                                                  
  |===========================================                 |  72%
  |                                                                  
  |============================================                |  73%
  |                                                                  
  |============================================                |  74%
  |                                                                  
  |=============================================               |  74%
  |                                                                  
  |=============================================               |  75%
  |                                                                  
  |=============================================               |  76%
  |                                                                  
  |==============================================              |  76%
  |                                                                  
  |==============================================              |  77%
  |                                                                  
  |===============================================             |  78%
  |                                                                  
  |===============================================             |  79%
  |                                                                  
  |================================================            |  79%
  |                                                                  
  |================================================            |  80%
  |                                                                  
  |================================================            |  81%
  |                                                                  
  |=================================================           |  81%
  |                                                                  
  |=================================================           |  82%
  |                                                                  
  |==================================================          |  83%
  |                                                                  
  |==================================================          |  84%
  |                                                                  
  |===================================================         |  84%
  |                                                                  
  |===================================================         |  85%
  |                                                                  
  |===================================================         |  86%
  |                                                                  
  |====================================================        |  86%
  |                                                                  
  |====================================================        |  87%
  |                                                                  
  |=====================================================       |  88%
  |                                                                  
  |=====================================================       |  89%
  |                                                                  
  |======================================================      |  89%
  |                                                                  
  |======================================================      |  90%
  |                                                                  
  |======================================================      |  91%
  |                                                                  
  |=======================================================     |  91%
  |                                                                  
  |=======================================================     |  92%
  |                                                                  
  |========================================================    |  93%
  |                                                                  
  |========================================================    |  94%
  |                                                                  
  |=========================================================   |  94%
  |                                                                  
  |=========================================================   |  95%
  |                                                                  
  |=========================================================   |  96%
  |                                                                  
  |==========================================================  |  96%
  |                                                                  
  |==========================================================  |  97%
  |                                                                  
  |=========================================================== |  98%
  |                                                                  
  |=========================================================== |  99%
  |                                                                  
  |============================================================|  99%
  |                                                                  
  |============================================================| 100%

# Plot the output
plot(GlenOut) +
  ggplot2::labs(
    title = "Glendalough",
    xlab = "Age (cal years BP)",
    ylab = "Depth (cm)"
  )


# If you need to specify your own starting values
startingAges <- c(0, 2000, 10000, 11000, 13000, 13500)
GlenOut <- with(
  Glendalough,
  Bchronology(
    ages = ages,
    ageSds = ageSds,
    calCurves = calCurves,
    positions = position,
    positionThicknesses = thickness,
    ids = id,
    predictPositions = seq(0, 1500, by = 10),
    thetaStart = startingAges
  )
)
#> Running Bchronology...
#> 
  |                                                                  
  |                                                            |   0%
  |                                                                  
  |                                                            |   1%
  |                                                                  
  |=                                                           |   1%
  |                                                                  
  |=                                                           |   2%
  |                                                                  
  |==                                                          |   3%
  |                                                                  
  |==                                                          |   4%
  |                                                                  
  |===                                                         |   4%
  |                                                                  
  |===                                                         |   5%
  |                                                                  
  |===                                                         |   6%
  |                                                                  
  |====                                                        |   6%
  |                                                                  
  |====                                                        |   7%
  |                                                                  
  |=====                                                       |   8%
  |                                                                  
  |=====                                                       |   9%
  |                                                                  
  |======                                                      |   9%
  |                                                                  
  |======                                                      |  10%
  |                                                                  
  |======                                                      |  11%
  |                                                                  
  |=======                                                     |  11%
  |                                                                  
  |=======                                                     |  12%
  |                                                                  
  |========                                                    |  13%
  |                                                                  
  |========                                                    |  14%
  |                                                                  
  |=========                                                   |  14%
  |                                                                  
  |=========                                                   |  15%
  |                                                                  
  |=========                                                   |  16%
  |                                                                  
  |==========                                                  |  16%
  |                                                                  
  |==========                                                  |  17%
  |                                                                  
  |===========                                                 |  18%
  |                                                                  
  |===========                                                 |  19%
  |                                                                  
  |============                                                |  19%
  |                                                                  
  |============                                                |  20%
  |                                                                  
  |============                                                |  21%
  |                                                                  
  |=============                                               |  21%
  |                                                                  
  |=============                                               |  22%
  |                                                                  
  |==============                                              |  23%
  |                                                                  
  |==============                                              |  24%
  |                                                                  
  |===============                                             |  24%
  |                                                                  
  |===============                                             |  25%
  |                                                                  
  |===============                                             |  26%
  |                                                                  
  |================                                            |  26%
  |                                                                  
  |================                                            |  27%
  |                                                                  
  |=================                                           |  28%
  |                                                                  
  |=================                                           |  29%
  |                                                                  
  |==================                                          |  29%
  |                                                                  
  |==================                                          |  30%
  |                                                                  
  |==================                                          |  31%
  |                                                                  
  |===================                                         |  31%
  |                                                                  
  |===================                                         |  32%
  |                                                                  
  |====================                                        |  33%
  |                                                                  
  |====================                                        |  34%
  |                                                                  
  |=====================                                       |  34%
  |                                                                  
  |=====================                                       |  35%
  |                                                                  
  |=====================                                       |  36%
  |                                                                  
  |======================                                      |  36%
  |                                                                  
  |======================                                      |  37%
  |                                                                  
  |=======================                                     |  38%
  |                                                                  
  |=======================                                     |  39%
  |                                                                  
  |========================                                    |  39%
  |                                                                  
  |========================                                    |  40%
  |                                                                  
  |========================                                    |  41%
  |                                                                  
  |=========================                                   |  41%
  |                                                                  
  |=========================                                   |  42%
  |                                                                  
  |==========================                                  |  43%
  |                                                                  
  |==========================                                  |  44%
  |                                                                  
  |===========================                                 |  44%
  |                                                                  
  |===========================                                 |  45%
  |                                                                  
  |===========================                                 |  46%
  |                                                                  
  |============================                                |  46%
  |                                                                  
  |============================                                |  47%
  |                                                                  
  |=============================                               |  48%
  |                                                                  
  |=============================                               |  49%
  |                                                                  
  |==============================                              |  49%
  |                                                                  
  |==============================                              |  50%
  |                                                                  
  |==============================                              |  51%
  |                                                                  
  |===============================                             |  51%
  |                                                                  
  |===============================                             |  52%
  |                                                                  
  |================================                            |  53%
  |                                                                  
  |================================                            |  54%
  |                                                                  
  |=================================                           |  54%
  |                                                                  
  |=================================                           |  55%
  |                                                                  
  |=================================                           |  56%
  |                                                                  
  |==================================                          |  56%
  |                                                                  
  |==================================                          |  57%
  |                                                                  
  |===================================                         |  58%
  |                                                                  
  |===================================                         |  59%
  |                                                                  
  |====================================                        |  59%
  |                                                                  
  |====================================                        |  60%
  |                                                                  
  |====================================                        |  61%
  |                                                                  
  |=====================================                       |  61%
  |                                                                  
  |=====================================                       |  62%
  |                                                                  
  |======================================                      |  63%
  |                                                                  
  |======================================                      |  64%
  |                                                                  
  |=======================================                     |  64%
  |                                                                  
  |=======================================                     |  65%
  |                                                                  
  |=======================================                     |  66%
  |                                                                  
  |========================================                    |  66%
  |                                                                  
  |========================================                    |  67%
  |                                                                  
  |=========================================                   |  68%
  |                                                                  
  |=========================================                   |  69%
  |                                                                  
  |==========================================                  |  69%
  |                                                                  
  |==========================================                  |  70%
  |                                                                  
  |==========================================                  |  71%
  |                                                                  
  |===========================================                 |  71%
  |                                                                  
  |===========================================                 |  72%
  |                                                                  
  |============================================                |  73%
  |                                                                  
  |============================================                |  74%
  |                                                                  
  |=============================================               |  74%
  |                                                                  
  |=============================================               |  75%
  |                                                                  
  |=============================================               |  76%
  |                                                                  
  |==============================================              |  76%
  |                                                                  
  |==============================================              |  77%
  |                                                                  
  |===============================================             |  78%
  |                                                                  
  |===============================================             |  79%
  |                                                                  
  |================================================            |  79%
  |                                                                  
  |================================================            |  80%
  |                                                                  
  |================================================            |  81%
  |                                                                  
  |=================================================           |  81%
  |                                                                  
  |=================================================           |  82%
  |                                                                  
  |==================================================          |  83%
  |                                                                  
  |==================================================          |  84%
  |                                                                  
  |===================================================         |  84%
  |                                                                  
  |===================================================         |  85%
  |                                                                  
  |===================================================         |  86%
  |                                                                  
  |====================================================        |  86%
  |                                                                  
  |====================================================        |  87%
  |                                                                  
  |=====================================================       |  88%
  |                                                                  
  |=====================================================       |  89%
  |                                                                  
  |======================================================      |  89%
  |                                                                  
  |======================================================      |  90%
  |                                                                  
  |======================================================      |  91%
  |                                                                  
  |=======================================================     |  91%
  |                                                                  
  |=======================================================     |  92%
  |                                                                  
  |========================================================    |  93%
  |                                                                  
  |========================================================    |  94%
  |                                                                  
  |=========================================================   |  94%
  |                                                                  
  |=========================================================   |  95%
  |                                                                  
  |=========================================================   |  96%
  |                                                                  
  |==========================================================  |  96%
  |                                                                  
  |==========================================================  |  97%
  |                                                                  
  |=========================================================== |  98%
  |                                                                  
  |=========================================================== |  99%
  |                                                                  
  |============================================================|  99%
  |                                                                  
  |============================================================| 100%
#> Run completed!
# }