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    -3.000     0.00     0.0     1.00     1.000
#>     10    11.000    35.00    62.0   149.00   549.050
#>     20    21.975    71.75   123.0   258.00   824.075
#>     30    33.950   106.00   184.5   352.25   967.450
#>     40    45.000   143.50   245.5   431.25  1056.000
#>     50    57.975   181.75   304.0   508.25  1199.025
#>     60    70.000   219.00   357.0   592.25  1287.125
#>     70    81.975   255.00   402.0   657.50  1341.725
#>     80    98.875   290.75   455.5   716.25  1416.325
#>     90   115.950   332.00   507.5   777.25  1463.025
#>    100   132.975   378.75   564.5   841.25  1531.375
#>    110   150.975   416.00   621.5   891.00  1577.125
#>    120   167.975   455.00   674.0   947.25  1597.025
#>    130   188.000   498.00   731.5   999.50  1629.250
#>    140   206.000   553.50   784.5  1066.25  1683.300
#>    150   220.975   605.75   832.0  1118.25  1722.075
#>    160   241.900   653.00   882.5  1172.50  1789.075
#>    170   266.975   700.00   935.0  1224.00  1826.100
#>    180   305.700   748.00   986.5  1266.75  1853.100
#>    190   333.425   784.00  1038.5  1306.00  1881.225
#>    200   353.000   831.50  1087.5  1370.00  1934.050
#>    210   372.900   875.75  1128.0  1440.00  1966.025
#>    220   402.725   921.00  1184.0  1493.75  1990.225
#>    230   445.525   965.50  1234.5  1539.75  2017.025
#>    240   486.825  1012.25  1287.0  1578.25  2038.050
#>    250   527.425  1065.00  1334.5  1626.25  2061.025
#>    260   555.950  1120.00  1391.0  1666.25  2087.175
#>    270   589.950  1159.25  1449.5  1703.25  2117.000
#>    280   619.775  1206.25  1505.0  1759.25  2139.275
#>    290   668.775  1260.00  1563.5  1804.50  2158.875
#>    300   691.775  1318.75  1621.5  1858.00  2215.150
#>    310   720.925  1373.75  1674.0  1900.00  2233.050
#>    320   765.775  1431.75  1725.5  1938.75  2254.100
#>    330   809.875  1479.00  1783.0  1981.25  2270.025
#>    340   882.775  1538.75  1828.5  2023.00  2285.025
#>    350   957.825  1618.75  1881.0  2063.00  2303.150
#>    360  1032.625  1682.50  1935.0  2103.00  2345.025
#>    370  1114.575  1751.75  1985.5  2136.00  2374.225
#>    380  1206.825  1814.00  2036.0  2169.00  2418.100
#>    390  1255.900  1893.00  2091.0  2204.00  2456.275
#>    400  1375.950  1982.50  2141.5  2248.25  2479.450
#>    410  1546.475  2080.00  2194.5  2290.00  2531.125
#>    420  1825.925  2168.75  2269.0  2332.00  2595.000
#>    430  2189.950  2324.00  2398.5  2514.00  3163.675
#>    440  2240.925  2410.00  2536.5  2761.25  3765.250
#>    450  2284.000  2485.50  2675.5  2965.50  4210.325
#>    460  2329.000  2552.00  2786.0  3140.25  4507.675
#>    470  2373.875  2620.75  2896.5  3321.25  4705.050
#>    480  2395.000  2707.75  3010.5  3502.00  4913.375
#>    490  2433.975  2782.75  3107.0  3641.50  5107.050
#>    500  2469.925  2847.50  3209.5  3797.50  5290.400
#>    510  2499.825  2917.25  3322.5  3955.75  5507.850
#>    520  2548.000  2984.50  3420.5  4071.00  5743.125
#>    530  2609.600  3062.75  3537.5  4175.00  5968.100
#>    540  2637.825  3149.00  3658.5  4281.50  6088.200
#>    550  2659.925  3249.25  3768.5  4395.25  6270.100
#>    560  2704.875  3314.75  3861.0  4527.75  6513.750
#>    570  2739.850  3399.25  3966.5  4645.50  6649.425
#>    580  2770.800  3467.75  4060.0  4752.25  6918.525
#>    590  2804.850  3563.00  4168.5  4865.75  7032.125
#>    600  2827.975  3658.00  4279.0  4993.00  7151.050
#>    610  2860.825  3737.00  4381.5  5105.50  7227.025
#>    620  2882.000  3838.75  4488.0  5211.00  7298.225
#>    630  2909.950  3930.50  4582.5  5333.25  7443.675
#>    640  2939.950  4014.50  4679.0  5473.00  7593.375
#>    650  2965.800  4116.50  4767.5  5608.50  7689.225
#>    660  2994.975  4210.75  4865.0  5697.75  7786.775
#>    670  3021.975  4309.25  4978.0  5801.50  7932.650
#>    680  3047.975  4399.25  5093.5  5889.25  8005.000
#>    690  3095.775  4496.50  5208.5  6010.75  8052.975
#>    700  3127.800  4587.75  5289.5  6121.50  8124.300
#>    710  3184.025  4673.75  5403.5  6196.00  8158.175
#>    720  3254.525  4766.00  5500.5  6299.75  8228.050
#>    730  3335.825  4864.00  5612.5  6406.25  8259.750
#>    740  3371.750  4945.50  5744.5  6502.75  8397.825
#>    750  3394.850  5006.25  5829.0  6606.50  8522.075
#>    760  3435.900  5115.00  5945.5  6745.25  8599.000
#>    770  3471.750  5199.25  6044.0  6890.50  8634.050
#>    780  3508.700  5306.50  6149.0  6979.00  8776.500
#>    790  3602.100  5401.75  6244.0  7087.75  8913.225
#>    800  3718.500  5504.25  6336.5  7180.75  8950.175
#>    810  3792.475  5602.75  6454.5  7280.75  8988.700
#>    820  3863.125  5693.75  6564.0  7394.25  9040.350
#>    830  3892.275  5839.50  6666.0  7506.00  9091.325
#>    840  3939.600  5969.25  6766.5  7583.50  9129.425
#>    850  4023.900  6061.50  6859.5  7672.50  9166.325
#>    860  4111.175  6166.75  6973.5  7762.50  9207.100
#>    870  4158.925  6260.75  7103.5  7874.00  9244.350
#>    880  4281.400  6362.00  7205.5  7972.50  9360.025
#>    890  4335.725  6456.25  7323.0  8055.25  9404.225
#>    900  4398.800  6572.25  7424.0  8144.00  9439.350
#>    910  4555.175  6712.00  7524.0  8229.00  9479.175
#>    920  4613.850  6822.00  7647.0  8343.25  9528.475
#>    930  4664.250  6922.50  7757.0  8440.25  9565.425
#>    940  4734.600  7061.50  7861.0  8548.25  9631.075
#>    950  4823.475  7154.00  7961.5  8636.75  9726.625
#>    960  4943.625  7294.75  8077.0  8726.25  9785.075
#>    970  5147.775  7395.00  8190.5  8785.75  9809.325
#>    980  5297.600  7495.00  8294.0  8880.50  9825.775
#>    990  5479.275  7615.50  8390.5  8951.50  9868.425
#>   1000  5520.800  7758.75  8487.5  9040.75  9910.075
#>   1010  5619.500  7851.75  8586.5  9126.25  9936.050
#>   1020  5748.725  7962.75  8691.5  9214.00  9960.250
#>   1030  5823.325  8083.50  8797.0  9304.25 10000.075
#>   1040  5998.400  8221.00  8905.5  9388.00 10027.475
#>   1050  6264.500  8354.25  9011.0  9478.50 10073.025
#>   1060  6489.700  8469.50  9107.0  9560.50 10104.125
#>   1070  6600.925  8579.25  9196.0  9644.75 10129.200
#>   1080  6747.025  8706.75  9302.0  9718.25 10166.025
#>   1090  6856.050  8847.25  9417.5  9798.25 10194.100
#>   1100  7152.025  8998.75  9529.0  9874.25 10215.175
#>   1110  7360.625  9137.75  9638.5  9952.00 10235.125
#>   1120  7539.175  9278.50  9751.5 10022.25 10263.050
#>   1130  7932.675  9447.75  9865.5 10093.25 10296.025
#>   1140  8187.950  9635.00  9984.5 10159.50 10326.150
#>   1150  8785.250  9848.75 10108.0 10217.00 10362.075
#>   1160  9369.750 10123.50 10226.5 10299.00 10430.075
#>   1170 10290.000 10374.00 10427.0 10491.00 10787.025
#>   1180 10416.950 10610.00 10659.5 10716.00 11010.050
#>   1190 10527.800 10847.75 10897.0 10943.25 11121.000
#>   1200 10734.950 11084.75 11127.0 11167.25 11261.025
#>   1210 11167.975 11251.00 11293.0 11370.00 11777.025
#>   1220 11220.925 11322.00 11387.0 11528.00 12036.075
#>   1230 11248.875 11385.50 11477.0 11660.00 12170.400
#>   1240 11277.950 11457.75 11569.0 11758.50 12274.050
#>   1250 11299.000 11528.75 11655.5 11876.00 12374.075
#>   1260 11334.975 11597.75 11742.0 11974.25 12452.100
#>   1270 11360.975 11659.00 11834.0 12064.50 12512.275
#>   1280 11399.650 11733.50 11927.0 12172.25 12567.000
#>   1290 11443.975 11811.75 12010.0 12237.25 12602.275
#>   1300 11477.875 11893.75 12094.5 12321.00 12640.025
#>   1310 11508.950 11972.50 12184.5 12389.25 12688.225
#>   1320 11573.650 12053.00 12277.5 12468.25 12727.075
#>   1330 11610.925 12152.75 12372.0 12537.25 12756.125
#>   1340 11696.900 12251.00 12456.0 12598.25 12786.100
#>   1350 11779.950 12369.75 12544.5 12660.00 12835.000
#>   1360 11904.900 12498.25 12629.0 12716.25 12870.050
#>   1370 12084.925 12623.50 12717.0 12782.00 12922.050
#>   1380 12468.975 12752.00 12804.0 12860.00 13013.025
#>   1390 12823.000 12887.00 12938.0 13007.00 13209.000
#>   1400 12878.975 12999.00 13049.0 13113.00 13286.075
#>   1410 12934.975 13108.75 13157.5 13211.00 13348.000
#>   1420 12990.775 13213.75 13267.0 13312.00 13401.025
#>   1430 13142.975 13325.00 13372.0 13415.00 13513.075
#>   1440 13359.000 13444.75 13502.0 13630.25 14419.000
#>   1450 13378.950 13500.75 13616.0 13829.00 14883.250
#>   1460 13399.000 13556.75 13723.0 13994.50 15316.975
#>   1470 13420.975 13610.00 13821.5 14149.25 15603.925
#>   1480 13441.950 13662.00 13917.5 14281.50 15833.300
#>   1490 13463.000 13717.75 14023.0 14408.75 16029.100
#>   1500 13483.975 13774.75 14116.5 14547.50 16192.175
summary(GlenOut, type = "convergence") # Check model convergence
#> Convergence check (watch for too many small p-values): 
#>             p-value
#> RateMean    0.00016
#> Outlier 6   0.01238
#> Outlier 3   0.04132
#> Outlier 2   0.04726
#> RateVar     0.06189
#> Beta-100901 0.10741
#> Beta-100899 0.11573
#> Beta-100897 0.15349
#> Top-1       0.24645
#> Beta-122061 0.29706
#> Beta-100900 0.30687
#> Outlier 5   0.42540
#> Outlier 1   0.42872
#> Outlier 4   0.42872
summary(GlenOut, type = "outliers") # Look at outlier probabilities
#> Posterior outlier probability by date: 
#>         Date OutlierProb
#>        Top-1       0.009
#>  Beta-122061       0.009
#>  Beta-100901       0.006
#>  Beta-100900       0.009
#>  Beta-100899       0.011
#>  Beta-100897       0.012

# 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!
# }