Title: | Age-Depth Modelling using Bayesian Statistics |
---|---|
Description: | An approach to age-depth modelling that uses Bayesian statistics to reconstruct accumulation histories for deposits, through combining radiocarbon and other dates with prior information on accumulation rates and their variability. See Blaauw & Christen (2011). |
Authors: | Maarten Blaauw [aut, cre]
|
Maintainer: | Maarten Blaauw <[email protected]> |
License: | GPL (>= 2) |
Version: | 3.3.2 |
Built: | 2025-02-18 21:25:30 UTC |
Source: | https://github.com/maarten14c/rbacon |
Calculate modelled 210Pb values of a sample slice, based on the parameters of the age-model (i.e., time passed since deposition of the bottom and top of the slice), supported and influx
A.modelled( d.top, d.bottom, dens, set = get("info"), phi = set$phi, sup = set$ps )
A.modelled( d.top, d.bottom, dens, set = get("info"), phi = set$phi, sup = set$ps )
d.top |
top depth of the slice |
d.bottom |
bottom depth of the slice |
dens |
Density of the slice (in g/cm3) |
set |
Detailed information of the current run, stored within this session's memory as variable |
phi |
The modelled values of the 210Pb influx |
sup |
The modelled values of the supported 210Pb |
a list of modelled values of A
Maarten Blaauw
Obtain accumulation rates (in years per cm, so actually sedimentation times) as estimated by the MCMC iterations for any age of a core.
accrate.age( age, set = get("info"), cmyr = FALSE, ages = c(), BCAD = set$BCAD, silent = TRUE, na.rm = FALSE )
accrate.age( age, set = get("info"), cmyr = FALSE, ages = c(), BCAD = set$BCAD, silent = TRUE, na.rm = FALSE )
age |
The age for which the accumulation rates need to be returned. |
set |
Detailed information of the current run, stored within this session's memory as variable |
cmyr |
Accumulation rates can be calculated in cm/year or year/cm. By default |
ages |
The ages of the age-depth model. Not provided by default, but can be provided to speed things up if the function is called repeatedly |
BCAD |
The calendar scale of graphs and age output-files is in |
silent |
Warn when ages are outside the core's range. Default |
na.rm |
Remove NA entries. These are NOT removed by default, ensuring that always the same amount of iterations is returned. |
Considering accumulation rates is crucial for age-depth modelling, and even more so if they are subsequently
used for calculating proxy influx values, or interpreted as proxy for environmental change such as carbon accumulation. See also accrate.age.ghost
, accrate.depth
and accrate.depth.ghost
.
Bacon deals explicitly with accumulation rate and its variability through defining prior distributions.
This function obtains accumulation rates (in years per cm, so actually sedimentation times) as estimated
by the MCMC iterations for any age of a core. Deals with only 1 age at a time. See also accrate.depth
.
all MCMC estimates of accumulation rate of the chosen age.
Maarten Blaauw, J. Andres Christen
## Not run: Bacon(run=FALSE, coredir=tempfile()) agedepth(yr.res=50, d.res=50, d.by=10) accrate.a5000 <- accrate.age(5000) plot(accrate.a5000, pch='.') hist(accrate.a5000) ## End(Not run)
## Not run: Bacon(run=FALSE, coredir=tempfile()) agedepth(yr.res=50, d.res=50, d.by=10) accrate.a5000 <- accrate.age(5000) plot(accrate.a5000, pch='.') hist(accrate.a5000) ## End(Not run)
Plot a grey-scale representation of a core's estimated accumulation rates against time.
accrate.age.ghost( set = get("info"), age.lim = c(), age.lab = c(), kcal = FALSE, age.res = 400, acc.res = 200, cutoff = 0.001, dark = 1, rgb.scale = c(0, 0, 0), rgb.res = 100, prob = 0.95, plot.range = TRUE, range.col = grey(0.5), range.lty = 2, plot.mean = TRUE, mean.col = "red", mean.lty = 2, plot.median = TRUE, median.col = "blue", median.lty = 2, acc.lim = c(), acc.lab = c(), BCAD = set$BCAD, cmyr = FALSE, rotate.axes = FALSE, rev.age = FALSE, rev.acc = FALSE, xaxs = "i", yaxs = "i", bty = "l" )
accrate.age.ghost( set = get("info"), age.lim = c(), age.lab = c(), kcal = FALSE, age.res = 400, acc.res = 200, cutoff = 0.001, dark = 1, rgb.scale = c(0, 0, 0), rgb.res = 100, prob = 0.95, plot.range = TRUE, range.col = grey(0.5), range.lty = 2, plot.mean = TRUE, mean.col = "red", mean.lty = 2, plot.median = TRUE, median.col = "blue", median.lty = 2, acc.lim = c(), acc.lab = c(), BCAD = set$BCAD, cmyr = FALSE, rotate.axes = FALSE, rev.age = FALSE, rev.acc = FALSE, xaxs = "i", yaxs = "i", bty = "l" )
set |
Detailed information of the current run, stored within this session's memory as variable info. |
age.lim |
Minimum and maximum calendar age ranges, calculated automatically by default ( |
age.lab |
The labels for the calendar axis (default |
kcal |
Use kcal BP. Default is |
age.res |
Resolution or amount of greyscale pixels to cover the age scale of the plot. Default |
acc.res |
Resolution or amount of greyscale pixels to cover the accumulation rate scale plot. Default |
cutoff |
Point below which colours will no longer be printed. Default |
dark |
The darkest grey value is dark=1 by default; lower values will result in lighter grey but values >1 are not advised. |
rgb.scale |
The function to produce a coloured representation of all age-models. Needs 3 values for the intensity of red, green and blue. Defaults to grey-scales: |
rgb.res |
Resolution of the colour spectrum depicting the age-depth model. Default |
prob |
Probability ranges. Defaults to |
plot.range |
If |
range.col |
Colour of the confidence ranges. |
range.lty |
Line type of the confidence ranges. |
plot.mean |
If |
mean.col |
Colour of the mean accumulation rates. |
mean.lty |
Type of the mean lines. |
plot.median |
If |
median.col |
Colour of the median accumulation rates. |
median.lty |
Type of the median lines. |
acc.lim |
Axis limits for the accumulation rates. |
acc.lab |
Axis label for the accumulation rate. |
BCAD |
The calendar scale of graphs and age output-files is in |
cmyr |
Accumulation rates can be calculated in cm/year or year/cm. By default |
rotate.axes |
The default is to plot the calendar age horizontally and accumulation rates vertically. Change to |
rev.age |
The direction of the age axis, which can be reversed using |
rev.acc |
The direction of the accumulation rate axis, which can be reversed ( |
xaxs |
Extension of the x-axis. White space can be added to the vertical axis using |
yaxs |
Extension of the y-axis. White space can be added to the vertical axis using |
bty |
Type of box to be drawn around the plot ( |
Calculating accumulation rates against calendar age will take some time to calculate, and might show unexpected
rates around the core's maximum ages (only a few of all age-model iterations will reach such ages and they will tend to have
modelled accumulation rates for the lower depths much lower than the other iterations). Axis limits for accumulation rates
are estimated automatically, however upper limits can be very variable (and thus hard to predict) if calculated in cm/yr
.
Therefore you might want to manually adapt the axis limits after plotting with default settings (e.g., acc.lim=c(0,1)
). See also accrate.depth.ghost
, accrate.depth
and accrate.age
.
The grey-scale reconstruction around the oldest ages of any reconstruction often indicates very low accumulation rates.
This is due to only some MCMC iterations reaching those old ages, and these iterations will have modelled very slow accumulation rates.
Currently does not deal well with hiatuses, so do not interpret accumulation rates close to depths with inferred hiatuses.
A greyscale plot of accumulation rate against calendar age, and (invisibly) the list of ages and their accumulation rates (ranges, medians, means).
Maarten Blaauw, J. Andres Christen
## Not run: Bacon(run=FALSE, coredir=tempfile()) agedepth(age.res=20, d.res=20, d.by=10) layout(1) tmp <- accrate.age.ghost(age.res=200, acc.res=100) head(tmp) ## End(Not run)
## Not run: Bacon(run=FALSE, coredir=tempfile()) agedepth(age.res=20, d.res=20, d.by=10) layout(1) tmp <- accrate.age.ghost(age.res=200, acc.res=100) head(tmp) ## End(Not run)
Obtain a summary (95% range, 68% range, median, mean) of the accumulation rates (in years per cm, so actually sedimentation times) as estimated by the MCMC iterations for any age of a core.
accrate.age.summary( age, set = get("info"), cmyr = FALSE, na.rm = TRUE, probs = c(0.025, 0.16, 0.84, 0.975, 0.5) )
accrate.age.summary( age, set = get("info"), cmyr = FALSE, na.rm = TRUE, probs = c(0.025, 0.16, 0.84, 0.975, 0.5) )
age |
The age for which accumulation rates need to be returned. |
set |
Detailed information of the current run, stored within this session's memory as variable |
cmyr |
Accumulation rates can be calculated in cm/year or year/cm. By default |
na.rm |
Remove NA entries. These are NOT removed by default, so that always the same amount of iterations is returned. |
probs |
The probability ranges to be returned. Defaults to the minima and maxima of the 95% and 68% ranges, as well as the median: |
A summary of the estimated accumulation rate of the chosen depth: minimum of the 95% interval, minimum of the 68% interval, maximum of the 68% interval, maximum of the 95% interval, median (i.e., 50%) and mean.
Maarten Blaauw
## Not run: Bacon(run=FALSE, coredir=tempfile()) agedepth(yr.res=50, d.res=50, d.by=10) accrate.age.summary(5000) ## End(Not run)
## Not run: Bacon(run=FALSE, coredir=tempfile()) agedepth(yr.res=50, d.res=50, d.by=10) accrate.age.summary(5000) ## End(Not run)
Obtain accumulation rates (in years per cm, so actually sedimentation times) as estimated by the MCMC iterations for any depth of a core.
accrate.depth(d, set = get("info"), cmyr = FALSE, na.rm = FALSE)
accrate.depth(d, set = get("info"), cmyr = FALSE, na.rm = FALSE)
d |
The depth for which accumulation rates need to be returned. |
set |
Detailed information of the current run, stored within this session's memory as variable |
cmyr |
Accumulation rates can be calculated in cm/year or year/cm. By default |
na.rm |
Remove NA entries. These are NOT removed by default, ensuring that always the same amount of iterations is returned. |
should take into account hiatuses
Considering accumulation rates is crucial for age-depth modelling, and even more so if they are subsequently used for calculating proxy
influx values, or interpreted as proxy for environmental change such as carbon accumulation.
Bacon deals explicitly with accumulation rate and its variability through defining prior distributions.
This function obtains accumulation rates (in years per cm, so actually sedimentation times) as estimated by the MCMC iterations
for any depth of a core. Deals with only 1 depth at a time. See also accrate.age
.
all MCMC estimates of accumulation rate of the chosen depth.
Maarten Blaauw, J. Andres Christen
## Not run: Bacon(run=FALSE, coredir=tempfile()) agedepth(yr.res=50, d.res=50, d.by=10) d20 <- accrate.depth(20) hist(d20) d20 <- accrate.depth(20, cmyr=TRUE) # to calculate accumulation rates in cm/yr mean(d20) ## End(Not run)
## Not run: Bacon(run=FALSE, coredir=tempfile()) agedepth(yr.res=50, d.res=50, d.by=10) d20 <- accrate.depth(20) hist(d20) d20 <- accrate.depth(20, cmyr=TRUE) # to calculate accumulation rates in cm/yr mean(d20) ## End(Not run)
Plot grey-scale representation of modelled accumulation rates over a core's depth. Each section of the core (see Bacon's option "thick"
) will have modelled accumulation rates.
accrate.depth.ghost( set = get("info"), d = set$elbows, d.lim = c(), acc.lim = c(), d.lab = c(), cmyr = FALSE, acc.lab = c(), dark = 1, cutoff = 0.001, rgb.scale = c(0, 0, 0), rgb.res = 100, prob = 0.95, plot.range = TRUE, range.col = grey(0.5), range.lty = 2, plot.mean = TRUE, mean.col = "red", mean.lty = 2, plot.median = TRUE, median.col = "blue", median.lty = 2, rotate.axes = FALSE, rev.d = FALSE, rev.acc = FALSE, xaxs = "r", yaxs = "r", bty = "l", remove.laststep = TRUE )
accrate.depth.ghost( set = get("info"), d = set$elbows, d.lim = c(), acc.lim = c(), d.lab = c(), cmyr = FALSE, acc.lab = c(), dark = 1, cutoff = 0.001, rgb.scale = c(0, 0, 0), rgb.res = 100, prob = 0.95, plot.range = TRUE, range.col = grey(0.5), range.lty = 2, plot.mean = TRUE, mean.col = "red", mean.lty = 2, plot.median = TRUE, median.col = "blue", median.lty = 2, rotate.axes = FALSE, rev.d = FALSE, rev.acc = FALSE, xaxs = "r", yaxs = "r", bty = "l", remove.laststep = TRUE )
set |
Detailed information of the current run, stored within this session's memory as variable info. |
d |
The depths for which the accumulation rates are to be calculated. Default to the entire core. |
d.lim |
Axis limits for the depths. |
acc.lim |
Axis limits for the accumulation rates. |
d.lab |
Label for the depth axis. |
cmyr |
Accumulation rates can be calculated in cm/year or year/cm. By default |
acc.lab |
Axis label for the accumulation rate. |
dark |
The darkest grey value is dark=1 by default; lower values will result in lighter grey but values >1 are not advised. |
cutoff |
Point below which colours will no longer be printed. Default |
rgb.scale |
The function to produce a coloured representation of all age-models. Needs 3 values for the intensity of red, green and blue. Defaults to grey-scales: |
rgb.res |
Resolution of the colour spectrum depicting the age-depth model. Default |
prob |
Probability ranges. Defaults to |
plot.range |
If |
range.col |
Colour of the confidence ranges. |
range.lty |
Line type of the confidence ranges. |
plot.mean |
If |
mean.col |
Colour of the mean accumulation rates. |
mean.lty |
Type of the mean lines. |
plot.median |
If |
median.col |
Colour of the median accumulation rates. |
median.lty |
Type of the median lines. |
rotate.axes |
The default is to plot the accumulation rates horizontally and the depth vertically ( |
rev.d |
The direction of the depth axis can be reversed from the default ( |
rev.acc |
The direction of the accumulation rate axis can be reversed from the default ( |
xaxs |
Extension of x-axis. By default, add some extra white-space at both extremes ( |
yaxs |
Extension of y-axis. By default, add no extra white-space at both extremes ( |
bty |
Type of box to be drawn around the plot ( |
remove.laststep |
Add a white line to remove spurious lines at the extreme of the graph. Defaults to TRUE. |
This plot shows the modelled accumulation rates in grey-scales, where darker grey indicates more likely accumulation rates.
Axis limits for accumulation rates are estimated automatically, however upper limits can be very variable (and thus hard to predict)
if calculated in cm/yr; therefore you might want to manually adapt the axis limits after plotting with default settings (e.g., acc.lim=c(0,1)
). See also accrate.age.ghost
, accrate.depth
and accrate.age
.
A grey-scale plot of accumulation rate against core depth, and (invisibly) the list of depths and their accumulation rates (ranges, medians, means).
Maarten Blaauw, J. Andres Christen
## Not run: Bacon(run=FALSE, coredir=tempfile()) agedepth(yr.res=50, d.res=50, d.by=10) layout(1) tmp <- accrate.depth.ghost() head(tmp) ## End(Not run)
## Not run: Bacon(run=FALSE, coredir=tempfile()) agedepth(yr.res=50, d.res=50, d.by=10) layout(1) tmp <- accrate.depth.ghost() head(tmp) ## End(Not run)
Obtain a summary (95% range, 68% range, median, mean) of the accumulation rates (in years per cm, so actually sedimentation times) as estimated by the MCMC iterations for any depth of a core.
accrate.depth.summary( d, set = get("info"), cmyr = FALSE, na.rm = FALSE, probs = c(0.025, 0.16, 0.84, 0.975, 0.5) )
accrate.depth.summary( d, set = get("info"), cmyr = FALSE, na.rm = FALSE, probs = c(0.025, 0.16, 0.84, 0.975, 0.5) )
d |
The depth for which accumulation rates need to be returned. |
set |
Detailed information of the current run, stored within this session's memory as variable |
cmyr |
Accumulation rates can be calculated in cm/year or year/cm. By default |
na.rm |
Remove NA entries. These are NOT removed by default, so that always the same amount of iterations is returned. |
probs |
The probability ranges to be returned. Defaults to the minima and maxima of the 95% and 68% ranges, as well as the median: |
A summary of the estimated accumulation rate of the chosen depth: minimum of the 95% interval, minimum of the 68% interval, maximum of the 68% interval, maximum of the 95% interval, median (i.e., 50%) and mean.
Maarten Blaauw
## Not run: Bacon(run=FALSE, coredir=tempfile()) agedepth(yr.res=50, d.res=50, d.by=10) accrate.depth.summary(20) ## End(Not run)
## Not run: Bacon(run=FALSE, coredir=tempfile()) agedepth(yr.res=50, d.res=50, d.by=10) accrate.depth.summary(20) ## End(Not run)
Obtain a summary (95% range, 68% range, median, mean) of the accumulation rates (in years per cm, so actually sedimentation times) as estimated by the MCMC iterations for a range of depths of a core, and optionally write this as a file to the core directory (ending in '_accrates.txt').
accrates.core( dseq = c(), set = get("info"), cmyr = FALSE, na.rm = FALSE, probs = c(0.025, 0.16, 0.84, 0.975, 0.5), round = 2, write = TRUE, sep = "\t" )
accrates.core( dseq = c(), set = get("info"), cmyr = FALSE, na.rm = FALSE, probs = c(0.025, 0.16, 0.84, 0.975, 0.5), round = 2, write = TRUE, sep = "\t" )
dseq |
The sequence of depths for which accumulation rates need to be returned. Defaults to whatever info$dseq is, which most often is a sequence from the top to the bottom of the core at 1 cm increments. |
set |
Detailed information of the current run, stored within this session's memory as variable |
cmyr |
Accumulation rates can be calculated in cm/year or year/cm. By default |
na.rm |
Remove NA entries. These are NOT removed by default, so that always the same amount of iterations is returned. |
probs |
The probability ranges to be returned. Defaults to the minima and maxima of the 95% and 68% ranges, as well as the median: |
round |
The number of decimals to report. Defaults to |
write |
Whether or not to write the summary to a file, in the core's directory and ending in '_accrates.txt'. |
sep |
Character to separate the entries within the file. Defaults to a tab, |
A summary of the estimated accumulation rate for all selected depths: minimum of the 95% interval, minimum of the 68% interval, maximum of the 68% interval, maximum of the 95% interval, median (i.e., 50%) and mean. This is optionally written to a file in the core directory.
Maarten Blaauw
## Not run: Bacon(run=FALSE, coredir=tempfile()) agedepth(yr.res=50, d.res=50, d.by=10) myaccrates <- accrates.core() ## End(Not run)
## Not run: Bacon(run=FALSE, coredir=tempfile()) agedepth(yr.res=50, d.res=50, d.by=10) myaccrates <- accrates.core() ## End(Not run)
Add dated depths to plots, e.g. to show dates that weren't used in the age-depth model
add.dates( mn, sdev, depth, cc = 1, set = get("info"), above = 1e-06, postbomb = 0, normal = TRUE, delta.R = set$delta.R, delta.STD = set$delta.STD, t.a = set$t.a, t.b = set$t.b, date.res = 100, height = 0.1, calheight = 1, agesteps = 1, cutoff = 0.005, col = rgb(1, 0, 0, 0.5), border = rgb(1, 0, 0, 0.5), rotate.axes = FALSE, mirror = TRUE, up = TRUE, BCAD = FALSE, pch = 4, cc.dir = c() )
add.dates( mn, sdev, depth, cc = 1, set = get("info"), above = 1e-06, postbomb = 0, normal = TRUE, delta.R = set$delta.R, delta.STD = set$delta.STD, t.a = set$t.a, t.b = set$t.b, date.res = 100, height = 0.1, calheight = 1, agesteps = 1, cutoff = 0.005, col = rgb(1, 0, 0, 0.5), border = rgb(1, 0, 0, 0.5), rotate.axes = FALSE, mirror = TRUE, up = TRUE, BCAD = FALSE, pch = 4, cc.dir = c() )
mn |
Reported mean of the date. Can be multiple dates. Negative numbers indicate postbomb dates (if cc > 0). |
sdev |
Reported error of the date. Can be multiple dates. |
depth |
Depth of the date. |
cc |
The calibration curve to use: |
set |
Detailed information of the current run, stored within this session's memory as variable |
above |
Threshold for plotting of probability values. Defaults to |
postbomb |
Use a postbomb curve for negative (i.e. postbomb) 14C ages. |
normal |
By default, Bacon uses the t-distribution (Christen and Perez 2009) to treat the dates. Use |
delta.R |
Mean of core-wide age offsets (e.g., regional marine offsets). |
delta.STD |
Error of core-wide age offsets (e.g., regional marine offsets). |
t.a |
The dates are treated using the t distribution by default ( |
t.b |
The dates are treated using the t distribution by default ( |
date.res |
Resolution of the date's distribution. Defaults to |
height |
The heights of the distributions of the dates. See also |
calheight |
Multiplier for the heights of the distributions of dates on the calendar scale. Defaults to |
agesteps |
Step size for age units of the distribution. Default |
cutoff |
Avoid plotting very low probabilities of date distributions (default |
col |
The colour of the ranges of the date. Default is semi-transparent red: |
border |
The colours of the borders of the date. Default is semi-transparent red: |
rotate.axes |
The default of plotting age on the horizontal axis and event probability on the vertical one can be changed with |
mirror |
Plot the dates as 'blobs'. Set to |
up |
Directions of distributions if they are plotted non-mirrored. Default |
BCAD |
The calendar scale of graphs is in |
pch |
The shape of any marker to be added to the date. Defaults to a cross, |
cc.dir |
Directory where the calibration curves for C14 dates |
Sometimes it is useful to add additional dating information to age-depth plots, e.g., to show outliers or how dates calibrate with different estimated offsets. Calls rice's draw.dates function.
A date's distribution, added to an age-depth plot.
Maarten Blaauw, J. Andres Christen
Bacon(run=FALSE, coredir=tempfile()) agedepth() add.dates(5000, 100, 60)
Bacon(run=FALSE, coredir=tempfile()) agedepth() add.dates(5000, 100, 60)
Plot the age-depth model of a core.
agedepth( set = get("info"), BCAD = set$BCAD, depth.unit = set$depth.unit, age.unit = "yr", unit = depth.unit, d.lab = c(), age.lab = c(), yr.lab = age.lab, kcal = FALSE, acc.lab = c(), mem.lab = c(), d.min = c(), d.max = c(), d.by = c(), depths = set$depths, depths.file = FALSE, accordion = c(), plotatthesedepths = c(), age.min = c(), yr.min = age.min, age.max = c(), yr.max = age.max, hiatus.option = 1, dark = c(), prob = set$prob, rounded = c(), d.res = 400, age.res = 400, yr.res = age.res, date.res = 100, rotate.axes = FALSE, rev.age = FALSE, rev.yr = rev.age, rev.d = FALSE, maxcalc = 500, height = 1, calheight = 1, mirror = TRUE, up = TRUE, cutoff = 0.1, plot.range = TRUE, range.col = grey(0.5), range.lty = "12", range.lwd = 1, mn.col = "red", mn.lty = "12", mn.lwd = 1, med.col = NA, med.lty = "12", med.lwd = 1, C14.col = rgb(0, 0, 1, 0.35), C14.border = rgb(0, 0, 1, 0.5), cal.col = rgb(0, 0.5, 0.5, 0.35), cal.border = rgb(0, 0.5, 0.5, 0.5), dates.col = c(), pb.background = 0.5, pbmodelled.col = function(x) rgb(0, 0, 1, 0.5 * x), pbmeasured.col = "blue", pb.lim = c(), supp.col = rgb(0.5, 0, 0.5, 0.5), remove.tail = TRUE, MCMC.resample = TRUE, hiatus.col = grey(0.5), hiatus.lty = "12", rgb.scale = c(0, 0, 0), rgb.res = 100, slump.col = grey(0.8), normalise.dists = TRUE, same.heights = FALSE, cc = set$cc, title = set$core, title.location = "topleft", title.size = 1.5, plot.labels = FALSE, labels = c(), label.age = 1, label.size = 0.8, label.col = "black", label.offset = c(0, 0), label.adj = c(0.5, 0), label.rot = 0, after = set$after, bty = "l", mar.left = c(3, 3, 1, 0.5), mar.middle = c(3, 0, 1, 0.5), mar.right = c(3, 0, 1, 0.5), mar.main = c(3, 3, 1, 1), righthand = 3, mgp = c(1.7, 0.7, 0), xaxs = "r", yaxs = "i", MCMC.col = grey(0.4), post.col = grey(0.8), post.border = grey(0.4), prior.col = 3, prior.lwd = 2, prior.fontcol = 2, prior.ticks = "n", prior.fontsize = 0.9, toppanel.fontsize = 0.9, mainpanel.tickfontsize = 1, mainpanel.labelfontsize = 1, acc.xlim = c(), acc.ylim = c(), mem.xlim = c(), mem.ylim = c(), hiatus.xlim = c(), hiatus.ylim = c(), phi.xlim = c(), phi.ylim = c(), supp.xlim = c(), supp.ylim = c(), xaxt = "s", yaxt = "s", plot.pb = TRUE, pb.lty = 1, plot.pdf = FALSE, dates.only = FALSE, model.only = FALSE, verbose = TRUE, save.info = TRUE )
agedepth( set = get("info"), BCAD = set$BCAD, depth.unit = set$depth.unit, age.unit = "yr", unit = depth.unit, d.lab = c(), age.lab = c(), yr.lab = age.lab, kcal = FALSE, acc.lab = c(), mem.lab = c(), d.min = c(), d.max = c(), d.by = c(), depths = set$depths, depths.file = FALSE, accordion = c(), plotatthesedepths = c(), age.min = c(), yr.min = age.min, age.max = c(), yr.max = age.max, hiatus.option = 1, dark = c(), prob = set$prob, rounded = c(), d.res = 400, age.res = 400, yr.res = age.res, date.res = 100, rotate.axes = FALSE, rev.age = FALSE, rev.yr = rev.age, rev.d = FALSE, maxcalc = 500, height = 1, calheight = 1, mirror = TRUE, up = TRUE, cutoff = 0.1, plot.range = TRUE, range.col = grey(0.5), range.lty = "12", range.lwd = 1, mn.col = "red", mn.lty = "12", mn.lwd = 1, med.col = NA, med.lty = "12", med.lwd = 1, C14.col = rgb(0, 0, 1, 0.35), C14.border = rgb(0, 0, 1, 0.5), cal.col = rgb(0, 0.5, 0.5, 0.35), cal.border = rgb(0, 0.5, 0.5, 0.5), dates.col = c(), pb.background = 0.5, pbmodelled.col = function(x) rgb(0, 0, 1, 0.5 * x), pbmeasured.col = "blue", pb.lim = c(), supp.col = rgb(0.5, 0, 0.5, 0.5), remove.tail = TRUE, MCMC.resample = TRUE, hiatus.col = grey(0.5), hiatus.lty = "12", rgb.scale = c(0, 0, 0), rgb.res = 100, slump.col = grey(0.8), normalise.dists = TRUE, same.heights = FALSE, cc = set$cc, title = set$core, title.location = "topleft", title.size = 1.5, plot.labels = FALSE, labels = c(), label.age = 1, label.size = 0.8, label.col = "black", label.offset = c(0, 0), label.adj = c(0.5, 0), label.rot = 0, after = set$after, bty = "l", mar.left = c(3, 3, 1, 0.5), mar.middle = c(3, 0, 1, 0.5), mar.right = c(3, 0, 1, 0.5), mar.main = c(3, 3, 1, 1), righthand = 3, mgp = c(1.7, 0.7, 0), xaxs = "r", yaxs = "i", MCMC.col = grey(0.4), post.col = grey(0.8), post.border = grey(0.4), prior.col = 3, prior.lwd = 2, prior.fontcol = 2, prior.ticks = "n", prior.fontsize = 0.9, toppanel.fontsize = 0.9, mainpanel.tickfontsize = 1, mainpanel.labelfontsize = 1, acc.xlim = c(), acc.ylim = c(), mem.xlim = c(), mem.ylim = c(), hiatus.xlim = c(), hiatus.ylim = c(), phi.xlim = c(), phi.ylim = c(), supp.xlim = c(), supp.ylim = c(), xaxt = "s", yaxt = "s", plot.pb = TRUE, pb.lty = 1, plot.pdf = FALSE, dates.only = FALSE, model.only = FALSE, verbose = TRUE, save.info = TRUE )
set |
Detailed information of the current run, stored within this session's memory as variable |
BCAD |
The calendar scale of graphs and age output-files is in |
depth.unit |
Units of the depths. Defaults to the one provided in the Bacon() command, |
age.unit |
Units of the ages. Defaults to |
unit |
Deprecated and replaced by |
d.lab |
The labels for the depth axis. Default |
age.lab |
The labels for the calendar axis (default |
yr.lab |
Deprecated - use age.lab instead |
kcal |
Use kcal BP. Default is |
acc.lab |
The labels for the accumulation rate plot (top middle). Default |
mem.lab |
The labels for the memory plot (top right). Default |
d.min |
Minimum depth of age-depth model (use this to extrapolate to depths higher than the top dated depth). |
d.max |
Maximum depth of age-depth model (use this to extrapolate to depths below the bottom dated depth). |
d.by |
Depth intervals at which ages are calculated. Default 1. Alternative depth intervals can be provided using, e.g., d. |
depths |
By default, Bacon will calculate the ages for the depths |
depths.file |
By default, Bacon will calculate the ages for the depths |
accordion |
An experimental option to squeeze and stretch depths below a boundary. Needs 2 parameters: boundary depth and compression ratio, e.g., |
plotatthesedepths |
An option to plot ages at different depths (e.g., if a core has been compressed during a run). Use with extreme caution! |
age.min |
Minimum age of the age-depth plot. |
yr.min |
Deprecated - use age.min instead. |
age.max |
Maximum age of the age-depth plot. |
yr.max |
Deprecated - use age.min instead. |
hiatus.option |
How to calculate accumulation rates and ages for sections with hiatuses. Either extrapolate from surrounding sections (default, |
dark |
Darkness of the greyscale age-depth model. By default, the darkest grey value is calculated as 10 times the height of the lowest-precision age estimate |
prob |
Confidence interval to report (between 0 and 1, default 0.95 or 95%). |
rounded |
Rounding of years. Default is to round to single years (1 digit for plum models). |
d.res |
Resolution or amount of greyscale pixels to cover the depth scale of the age-model plot. Default |
age.res |
Resolution or amount of greyscale pixels to cover the age scale of the age-model plot. Default |
yr.res |
Deprecated - use age.res instead. |
date.res |
Date distributions are plotted using |
rotate.axes |
By default, the age-depth model is plotted with the depths on the horizontal axis and ages on the vertical axis. This can be changed with |
rev.age |
The direction of the age axis, which can be reversed using |
rev.yr |
Deprecated - use rev.age instead. |
rev.d |
The direction of the depth axis, which can be reversed using |
maxcalc |
Number of depths to calculate ages for. If this is more than |
height |
The maximum heights of the distributions of the dates on the plot. See also |
calheight |
Multiplier for the heights of the distributions of dates on the calendar scale. Defaults to |
mirror |
Plot the dates as 'blobs'. Set to |
up |
Directions of distributions if they are plotted non-mirrored. Default |
cutoff |
Avoid plotting very low probabilities of date distributions (default |
plot.range |
Whether or not to plot the curves showing the confidence ranges of the age-model. Defaults to ( |
range.col |
The colour of the curves showing the confidence ranges of the age-model. Defaults to medium grey ( |
range.lty |
The line type of the curves showing the confidence ranges of the age-model. Defaults to |
range.lwd |
Widths of the lines of the ranges of the age-depth model. Default |
mn.col |
The colour of the mean age-depth model: default |
mn.lty |
The line type of the mean age-depth model. Default |
mn.lwd |
Width of the line of the mean age-depth model. Default |
med.col |
The colour of the median age-depth model: not drawn by default |
med.lty |
The line type of the median age-depth model. Default |
med.lwd |
Width of the line of the median age-depth model. Default |
C14.col |
The colour of the calibrated ranges of the dates. Default is semi-transparent blue: |
C14.border |
The colours of the borders of calibrated 14C dates. Default is semi-transparent dark blue: |
cal.col |
The colour of the non-14C dates. Default is semi-transparent blue-green: |
cal.border |
The colour of the border of non-14C dates in the age-depth plot: default semi-transparent dark blue-green: |
dates.col |
As an alternative to colouring dates based on whether they are 14C or not, sets of dates can be coloured as, e.g., |
pb.background |
Probability at which total Pb values are considered to have reached background values, or in other words, that their modelled values are at or below supported + detection limit (Al)). Setting this at 0.5 means that any depth with a Pb measurement, where at least half of the iterations model Pb values reaching background values, is flagged as having reached background. The age-model is not extended to any Pb measurements that have reached background. |
pbmodelled.col |
Colour of the modelled 210Pb values. Defaults to shades of blue: |
pbmeasured.col |
Colour of the measured 210Pb values (default |
pb.lim |
Axis limits for the Pb-210 data. Calculated automatically by default ( |
supp.col |
Colour of supported Pb-210. Defaults to semi-transparent purple, because why not. |
remove.tail |
Whether or not to remove the tail measurements when plotting. Sometimes automated removal might go wrong, so then this option can be used to avoid removing the tail measurements. |
MCMC.resample |
After the MCMC run, if there are more MCMC iterations than requested, only the last 'ssize' iterations will be retained. Defaults to TRUE. |
hiatus.col |
The colour of the depths of any hiatuses. Default |
hiatus.lty |
The line type of the depths of any hiatuses. Default |
rgb.scale |
The function to produce a coloured representation of all age-models. Needs 3 values for the intensity of red, green and blue. Defaults to grey-scales: |
rgb.res |
Resolution of the colour spectrum depicting the age-depth model. Default |
slump.col |
Colour of slumps. Defaults to |
normalise.dists |
By default, the distributions of more precise dates will cover less time and will thus peak higher than less precise dates. This can be avoided by specifying |
same.heights |
Plot the distributions of the dates all at the same maximum height (default |
cc |
Calibration curve for 14C dates: |
title |
The title of the age-depth model is plotted on the main panel. By default this is the core's name. To leave empty: |
title.location |
Location of the title. Default |
title.size |
Size of the title font. Defaults to |
plot.labels |
Whether or not to plot labels next to the dated depths. Defaults to |
labels |
Add labels to the dates (as given by the first column of the .csv file). |
label.age |
Position on the age axis of the date labels. By default draws them before the youngest age (1), but can also draw them after the oldest age (2), or above its mean (3). |
label.size |
Size of labels. |
label.col |
Colour of the labels. Defaults to the colour given to the borders of the dates. |
label.offset |
Offsets of the positions of the labels, giving the x and y offsets. Defaults to c(0,0). |
label.adj |
Justification of the labels. Follows R's adj option: A value of ‘0’ produces left-justified text, ‘0.5’ (the default) centered text and ‘1’ right-justified text. |
label.rot |
Rotation of the label. 0 by default (horizontal). |
after |
Sets a short section above and below hiatus.depths within which to calculate ages. For internal calculations - do not change. |
bty |
Type of box to be drawn around plots ( |
mar.left |
Plot margins for the topleft panel (amount of white space along edges of axes 1-4). Default |
mar.middle |
Plot margins for the middle panel(s) at the top (amount of white space along edges of axes 1-4). Default |
mar.right |
Plot margins for the topright panel (amount of white space along edges of axes 1-4). Default |
mar.main |
Plot margins for the main panel (amount of white space along edges of axes 1-4). Default |
righthand |
Adapt the righthand margins by a certain amount (default 2) to allow a righthand axis to be plotted (for plum) |
mgp |
Axis text margins (where should titles, labels and tick marks be plotted). Defaults to |
xaxs |
Extension of x-axis. By default, add some extra white-space at both extremes ( |
yaxs |
Extension of y-axis. By default, add no extra white-space at both extremes ( |
MCMC.col |
Colour of the MCMC output. Defaults to |
post.col |
Colour of the posterior histogram. Defaults to |
post.border |
Colour of the posterior border. Defaults to |
prior.col |
Colour of the prior curve. Defaults to light green, |
prior.lwd |
Line width of the prior curve. Defaults to |
prior.fontcol |
Colour of the font accompanying the posterior histograms. Defaults to red, |
prior.ticks |
Plot tickmarks and values on the vertical axes for the prior and posterior distributions. Defaults to no tick marks ( |
prior.fontsize |
Font size of the prior, relative to R's standard size. Defaults to |
toppanel.fontsize |
Font size of the top panels, relative to R's standard size. Defaults to |
mainpanel.tickfontsize |
Font size of values at the tick marks in the main panel, relative to R's standard size. Defaults to |
mainpanel.labelfontsize |
Font size of axis labels in the main panel, relative to R's standard size. Defaults to |
acc.xlim |
Horizontal axis limits of the accumulation rate panel. Calculated automatically by default. |
acc.ylim |
Vertical axis limits of the accumulation rate panel. Calculated automatically by default. |
mem.xlim |
Horizontal axis limits of the memory panel. Calculated automatically by default. |
mem.ylim |
Vertical axis limits of the memory panel. Calculated automatically by default. |
hiatus.xlim |
Horizontal axis limits of the hiatus size panel. Calculated automatically by default. |
hiatus.ylim |
Vertical axis limits of the hiatus size panel. Calculated automatically by default. |
phi.xlim |
Horizontal axis limits of the phi panel. Calculated automatically by default. |
phi.ylim |
Vertical axis limits of the phi panel. Calculated automatically by default. |
supp.xlim |
Horizontal axis limits of the supported-Pb panel. Calculated automatically by default. |
supp.ylim |
Vertical axis limits of the supported-Pb panel. Calculated automatically by default. |
xaxt |
Whether or not to plot the x-axis. Can be used to adapt axes after a plot. See ?par for other options. |
yaxt |
Whether or not to plot the y-axis. Can be used to adapt axes after a plot. See ?par for other options. |
plot.pb |
Plot the 210Pb data (if present). Defaults to |
pb.lty |
Line type of measured Pb-210 data. |
plot.pdf |
Produce a pdf file of the age-depth plot. |
dates.only |
By default, the age-depth model is plotted on top of the dates. This can be avoided by supplying |
model.only |
By default, panels showing the MCMC iterations and the priors and posteriors for accumulation rate and memory are plotted above the main age-depth model panel. This can be avoided by supplying |
verbose |
Provide a summary of the age ranges after producing the age-depth model graph; default |
save.info |
By default, a variable called ‘info’ with relevant information about the run (e.g., core name, priors, settings, ages, output) is saved into the working directory. Note that this will overwrite any existing variable with the same name - as an alternative, one could run, e.g., |
After loading a previous run, or after running either the scissors or thinner command, plot the age-model
again using the command agedepth()
.
A plot of the age-depth model, and estimated ages incl. confidence ranges for each depth.
Maarten Blaauw, J. Andres Christen
Bacon(ask=FALSE, coredir=tempfile()) agedepth()
Bacon(ask=FALSE, coredir=tempfile()) agedepth()
For one MCMC iteration (it), extract the corresponding age-depth model.
agemodel.it(it, set = get("info"), BCAD = set$BCAD, save.info = FALSE)
agemodel.it(it, set = get("info"), BCAD = set$BCAD, save.info = FALSE)
it |
The MCMC iteration of which the age-model should be calculated. |
set |
Detailed information of the current run, stored within this session's memory as variable info. |
BCAD |
The calendar scale of graphs and age output-files is in |
save.info |
If TRUE, a variable called ‘info’ with relevant information about the run (e.g., core name, priors, settings, ages, output) is saved into the working directory. Note that this will overwrite any existing variable with the same name. |
A variable with two columns - depth and the age-depth model of a single iteration.
Maarten Blaauw, J. Andres Christen
## Not run: Bacon(run=FALSE, coredir=tempfile()) agedepth(age.res=50, d.res=50, d.by=10) lines(agemodel.it(5), col="red") ## End(Not run)
## Not run: Bacon(run=FALSE, coredir=tempfile()) agedepth(age.res=50, d.res=50, d.by=10) lines(agemodel.it(5), col="red") ## End(Not run)
Plot probability curves for events in the core, expressed against calendar age.
AgesOfEvents( window, move, set = get("info"), plot.steps = FALSE, BCAD = set$BCAD, age.lab = c(), yr.lab = age.lab, age.lim = c(), yr.lim = age.lim, prob.lab = "probability", prob.lim = c(), rotate.axes = FALSE, rev.age = TRUE, rev.yr = rev.age, yaxs = "i", bty = "l" )
AgesOfEvents( window, move, set = get("info"), plot.steps = FALSE, BCAD = set$BCAD, age.lab = c(), yr.lab = age.lab, age.lim = c(), yr.lim = age.lim, prob.lab = "probability", prob.lim = c(), rotate.axes = FALSE, rev.age = TRUE, rev.yr = rev.age, yaxs = "i", bty = "l" )
window |
Width of the window. |
move |
Step size with which the window moves. |
set |
Detailed information of the current run, stored within this session's memory as variable |
plot.steps |
Plot probability values step-wise (defaults to |
BCAD |
The calendar scale of graphs and age output-files is in |
age.lab |
The labels for the calendar axis (default |
yr.lab |
Deprecated - use age.lab instead |
age.lim |
Minimum and maximum calendar age ranges, calculated automatically by default ( |
yr.lim |
Deprecated - use age.lim instead |
prob.lab |
Label of the probability axis (default |
prob.lim |
Limits of the probability axis (calculated automatically by default). |
rotate.axes |
The default of plotting age on the horizontal axis and event probability on the vertical one can be changed with |
rev.age |
The direction of the age axis, which can be reversed using |
rev.yr |
Deprecated - use rev.age instead |
yaxs |
Extension of the y-axis. Defaults to the exact ranges of the probability values. White space can be added to the vertical axis using |
bty |
Type of box to be drawn around plots. Draw a box around the graph ( |
Probabilities of depths with 'events' in an age-modelled core can be plotted against time, taking into account chronological uncertainties (Blaauw et al. 2007). Such events could be for example core depths at which proxies indicate changes toward wetter local conditions. This can be expressed as values between 0 (no event) and 1 (event at 100% probability) for each depth.
Blaauw et al. 2010 propose to estimate probabilities of events by finding specific proxy features such as increasing curves. Probabilities are then estimated through resampling from the proxy values, where low to modest rises of proxy curves result in low event probabilities, and clear proxy rises in high probabilities. A smooth spline can be applied to adapt the balance of short-term vs long-term events. To calculate the event probabilities, produce a file with two columns (depth and corresponding proxy-derived probabilities, separated by white spaces). Do not provide headers at the file's first line, and save the file with extension "_events.txt" within the core's Bacon folder. See Cores/MSB2K/MSB2K_events.txt (or Bacon_runs/MSB2K/MSB2K_events.txt) for an example. Events are calculated as the probability that an event took place within specific time windows - or more specifically, that the Bacon age-depth model puts depths with assigned event probabilities in that time window.
does not yet deal correctly with hiatuses.
The resulting probabilities are plotted and saved within the core's folder (file names ending with the window width and "_probs.txt").
Maarten Blaauw, J. Andres Christen
Blaauw, M., Christen, J.A., Mauquoy, D., van der Plicht, J., Bennett, K.D. (2007) Testing the timing of radiocarbon-dated events between proxy archives. _The Holocene_, *17*, 283-288. Blaauw, M., Wohlfarth, B., Christen, J.A., Ampel, L., Veres, D., Hughen, K.A., Preusser, F., Svensson, A. (2010) Were last glacial climate events simultaneous between Greenland and France? A quantitative comparison using non-tuned chronologies. _Journal of Quaternary Science_ *25*, 387-394.
Bacon(run=FALSE, coredir=tempfile()) agedepth(yr.res=50) AgesOfEvents(100, 10)
Bacon(run=FALSE, coredir=tempfile()) agedepth(yr.res=50) AgesOfEvents(100, 10)
Checks which of the Pb-210 data most likely have reached background levels and thus are below the detection limit Al (probabilities between 0 and 1)
background(set = get("info"), Al = set$Al)
background(set = get("info"), Al = set$Al)
set |
Detailed information of the current run, stored within this session's memory as variable |
Al |
The detection limit. Default |
a list of probabilities for each Pb-210 data point
Maarten Blaauw
This is the main age-depth modelling function of the rbacon package.
Bacon( core = "MSB2K", thick = 5, coredir = "", prob = 0.95, d.min = NA, d.max = NA, add.bottom = TRUE, d.by = 1, seed = NA, depths.file = FALSE, depths = c(), depth.unit = "cm", age.unit = "yr", unit = depth.unit, acc.shape = 1.5, acc.mean = 20, mem.strength = 10, mem.mean = 0.5, boundary = NA, hiatus.depths = NA, hiatus.max = 10000, add = c(), after = 1e-04/thick, cc = 1, cc1 = "IntCal20", cc2 = "Marine20", cc3 = "SHCal20", cc4 = "ConstCal", cc.dir = c(), postbomb = 0, F14C = c(), pMC = c(), delta.R = 0, delta.STD = 0, t.a = 3, t.b = 4, normal = FALSE, suggest = TRUE, accept.suggestions = FALSE, reswarn = c(10, 200), remember = TRUE, ask = TRUE, run = TRUE, defaults = "defaultBacon_settings.txt", sep = ",", dec = ".", runname = "", slump = c(), remove = FALSE, BCAD = FALSE, ssize = 4000, th0 = c(), burnin = min(500, ssize), youngest.age = c(), oldest.age = c(), MinAge = c(), MaxAge = c(), cutoff = 0.01, plot.pdf = TRUE, dark = 1, date.res = 100, age.res = 200, yr.res = age.res, close.connections = TRUE, save.info = TRUE, older.than = c(), younger.than = c(), save.elbowages = FALSE, verbose = TRUE, ... )
Bacon( core = "MSB2K", thick = 5, coredir = "", prob = 0.95, d.min = NA, d.max = NA, add.bottom = TRUE, d.by = 1, seed = NA, depths.file = FALSE, depths = c(), depth.unit = "cm", age.unit = "yr", unit = depth.unit, acc.shape = 1.5, acc.mean = 20, mem.strength = 10, mem.mean = 0.5, boundary = NA, hiatus.depths = NA, hiatus.max = 10000, add = c(), after = 1e-04/thick, cc = 1, cc1 = "IntCal20", cc2 = "Marine20", cc3 = "SHCal20", cc4 = "ConstCal", cc.dir = c(), postbomb = 0, F14C = c(), pMC = c(), delta.R = 0, delta.STD = 0, t.a = 3, t.b = 4, normal = FALSE, suggest = TRUE, accept.suggestions = FALSE, reswarn = c(10, 200), remember = TRUE, ask = TRUE, run = TRUE, defaults = "defaultBacon_settings.txt", sep = ",", dec = ".", runname = "", slump = c(), remove = FALSE, BCAD = FALSE, ssize = 4000, th0 = c(), burnin = min(500, ssize), youngest.age = c(), oldest.age = c(), MinAge = c(), MaxAge = c(), cutoff = 0.01, plot.pdf = TRUE, dark = 1, date.res = 100, age.res = 200, yr.res = age.res, close.connections = TRUE, save.info = TRUE, older.than = c(), younger.than = c(), save.elbowages = FALSE, verbose = TRUE, ... )
core |
Name of the core, given using quotes. Defaults to one of the cores provided with rbacon, |
thick |
Bacon will divide the core into sections of equal thickness specified by thick (default |
coredir |
Folder where the core's files |
prob |
Confidence interval to report. This should lie between 0 and 1, default 0.95 (95 %). |
d.min |
Minimum depth of age-depth model (use this to extrapolate to depths higher than the top dated depth). |
d.max |
Maximum depth of age-depth model (use this to extrapolate to depths below the bottom dated depth). |
add.bottom |
Add a model section at the bottom of the core, in order to ensure the bottommost date is taken into account. Default |
d.by |
Depth intervals at which ages are calculated. Defaults to |
seed |
Seed used for C++ executions. If it is not assigned ( |
depths.file |
By default, Bacon will calculate the ages for the depths |
depths |
By default, Bacon will calculate the ages for the depths |
depth.unit |
Units of the depths. Defaults to |
age.unit |
Units of the ages. Defaults to |
unit |
Deprecated and replaced by |
acc.shape |
The prior for the accumulation rate consists of a gamma distribution with two parameters.
Its shape is set by acc.shape (default |
acc.mean |
The accumulation rate prior consists of a gamma distribution with two parameters. Its mean is set by acc.mean (default |
mem.strength |
The prior for the memory (dependence of accumulation rate between neighbouring depths) is a beta distribution, which looks much like the gamma distribution.
but its values are always between 0 (no assumed memory) and 1 (100% memory). Its default settings of |
mem.mean |
The prior for the memory is a beta distribution, which looks much like the gamma distribution but
its values are always between 0 (no assumed memory) and 1 (100% memory). Its default settings of |
boundary |
The assumed depths of any boundary, which divides sections of different accumulation rate regimes (e.g., as indicated by major change in the stratigraphy). No hiatus is assumed between these sections, and memory is reset crossing the boundary. Different accumulation priors can be set for the sections above and below the boundary, e.g., |
hiatus.depths |
The assumed depths for any hiatus should be provided as, e.g.,
|
hiatus.max |
The prior for the maximum length of the hiatus. Hiatus length is a uniform distribution, with equal probabilities between 0 and |
add |
Add a value to the maximum hiatus length if a boundary is chosen. Defaults to 100 yr (or whatever other age unit is chosen). Can be adapted if Bacon complains that the parameters are out of support. |
after |
Sets a short section above and below hiatus.depths within which to calculate ages. For internal calculations - do not change. |
cc |
Calibration curve for C-14 dates: |
cc1 |
For northern hemisphere terrestrial 14C dates (IntCal20). |
cc2 |
For marine 14C dates (Marine20). |
cc3 |
For southern hemisphere 14C dates (SHCal20). |
cc4 |
Provide the name of an alternative curve (3 columns: cal BP, 14C age, error, separated by white spaces and saved as a plain-text file). It is important here to first produce a tailor-made folder for your and the default calibration curves to live in. See |
cc.dir |
Directory where the calibration curves for C14 dates |
postbomb |
Use a postbomb curve for negative (i.e. postbomb) 14C ages. |
F14C |
Radiocarbon ages can be provided as F14C values. If doing so, please indicate here which dates were entered as F14C (e.g., if the first 4 dates are in F14C, write |
pMC |
Radiocarbon ages can be provided as pMC values. If doing so, please indicate here which dates were entered as pMC (e.g., if the first 4 dates are in pMC, write |
delta.R |
Mean of core-wide age offsets (e.g., regional marine offsets). |
delta.STD |
Error of core-wide age offsets (e.g., regional marine offsets). |
t.a |
The dates are treated using the t distribution (Christen and Perez 2009) by default ( |
t.b |
The dates are treated using t distribution by default ( |
normal |
By default, Bacon uses the t-distribution to treat the dates. Use |
suggest |
If initial analysis of the data indicates abnormally slow or fast accumulation rates, Bacon will suggest to change the prior. |
accept.suggestions |
Automatically accept the suggested values. Use with care. Default |
reswarn |
Bacon will warn you if the number of sections lies outside the safe range (default between 10 and 200 sections;
|
remember |
Bacon will try to remember which settings you have applied to your cores (default |
ask |
By default Bacon will ask you to confirm that you want to run the core with the provided settings. Disable this using |
run |
In order to load an existing Bacon run instead of producing a new one, you can use |
defaults |
Name of the file containing settings for the core. For internal use only - do not change. |
sep |
Separator between the fields of the plain text file containing the dating information. Default |
dec |
Character for decimal points. Default to |
runname |
Text to add to the corename for specific runs, e.g., |
slump |
Upper and lower depths of any sections of assumed abrupt accumulation, that require excising before age-modelling (and adding after age-modelling). Requires pairs of depths, e.g., |
remove |
Whether or not to remove depths within slumps. Defaults to |
BCAD |
The calendar scale of graphs and age output-files is in cal BP (calendar or calibrated years before the present, where the present is AD 1950) by default, but can be changed to BC/AD using |
ssize |
The amount of iterations to store at the end of the MCMC run. Default 4000; decrease for faster (but less reliable) runs or increase for cores where the MCMC mixing (panel at upper-left corner of age-model graph) appears problematic. |
th0 |
Starting years for the MCMC iterations. These are randomly chosen by default. |
burnin |
Amount of initial, likely sub-optimal MCMC iterations that will be removed. |
youngest.age |
Minimum age limit for Bacon runs, default at current year in cal BP. To set plot limits, use |
oldest.age |
Maximum age limit for Bacon runs, default at 1,000,000 cal BP. To set plot limits, use |
MinAge |
Deprecated - use youngest.age instead. |
MaxAge |
Deprecated - use oldest.age instead. |
cutoff |
Avoid plotting very low probabilities of date distributions (default |
plot.pdf |
Produce a pdf file of the age-depth plot. Defaults to |
dark |
Darkness of the greyscale age-depth model. The darkest grey value is |
date.res |
Date distributions are plotted using |
age.res |
Resolution or amount of greyscale pixels to cover the age scale of the age-model plot. Default |
yr.res |
Deprecated - use age.res instead |
close.connections |
Internal option to close connections after a run. Default |
save.info |
By default, a variable called ‘info’ with relevant information about the run (e.g., core name, priors, settings, ages, output) is saved into the working directory. Note that this will overwrite any existing variable with the same name - as an alternative, one could run, e.g., |
older.than |
an option to enable dates at the limit of C-14 dating. If there are older.than dates, they tell us that the core should be older than a certain age at that depth. For example, if the 7th and 8th dates in the core's .csv file are older-than dates, use as |
younger.than |
an option to provide younger-than ages, for example a historical pollen marker. If there are younger-than dates, they tell us that the core should be younger than a certain age at that depth. For example, if the 7th and 8th dates in the core's .csv file are younger.than dates, use as |
save.elbowages |
If you want to have a file with the MCMC-derived ages for all the age-depth model's elbows, set |
verbose |
Provide feedback on what is happening (default |
... |
options for the age-depth graph. See agedepth and calib.plot |
Bacon is an approach to age-depth modelling that uses Bayesian statistics in order to reconstruct Bayesian accumulation histories for deposits, through combining radiocarbon and other dates with prior information ('Blaauw' and 'Christen', 2011).
Bacon divides a core into many thin vertical sections (by default of thick=5
cm thickness),
and through millions of Markov Chain Monte Carlo (MCMC) iterations estimates
the accumulation rate (in years/cm; so more correctly, sedimentation times) for each of these sections.
Combined with an estimated starting date for the first section, these accumulation rates then form the age-depth model.
The accumulation rates are constrained by prior information on the accumulation rate (acc.mean, acc.shape
) and its
variability between neighbouring depths, or "memory" (mem.mean, mem.strength
). Hiatuses can be introduced as well, also constrained by prior information (hiatus.max
).
Although Bacon works with any kind of absolute dates (e.g., OSL, tephra or other dates on a calendar scale),
it is often used to age-model 14C-dated sequences. Radiocarbon dates should be calibrated using either IntCal20
(for terrestrial northern hemisphere material; Reimer et al., 2020), Marine20 (for marine dates; Hughen et al., 2020),
SHCal20 (for southern hemisphere dates; Hogg et al., 2020) or any other calibration curve (see below), while modern 14C
dates are calibrated using one of the post-bomb calibration curves (NH1, NH2 or NH3 for the northern hemisphere,
SH1-2 or SH3 for the southern hemisphere; Hua et al., 2022). See http://calib.org/CALIBomb/ if you are unsure which
postbomb curve you need. If Bacon finds postbomb dates (negative 14C ages) and you haven't specified a postbomb curve,
you will be prompted. Provide postbomb curves as, e.g., postbomb=1
for the NH1 postbomb curve (2 for NH2, 3 for NH3, 4 for SH1-2, 5 for SH3).
For calendar dates, i.e. dates that are already on the calendar scale and thus should not be calibrated, setcc=0
.
Since version 3.1.0, rbacon can also handle younger-than and older-than ages, with the model aiming to either go 'above' or 'below' such dates as requested. If the resulting combination of parameters becomes problematic (e.g., no initial combination of parameters can be found that obeys the priors or is in chronological order), then the output will often be wrong. If so, using the function set.initvals could help.
By default, the initial MCMC values of the Bacon age-depth model (upper ages and accumulation rate for each model section) are estimated randomly. Since version 3.1.0, these starting values can also be provided in a file with extension _bacon.init, placed within the core's folder. This file will need to have two rows, each for one of the two initial sets of parameters required (the t-walk requires two starting estimates for all MCMC parameters). If such a file is found (and correctly formatted), Bacon will use the values within this file as starting points for the MCMC run. See function set.initvals for more information.
From version 2.5.1 on (i.e., since February 2021), the default memory prior has changed to mem.mean=0.5
and mem.strength=10
. Previously used c++ code contained a bug which caused the prior information for the memory not to be
taken into account correctly. Now that this bug has been repaired, the default memory prior has been updated such that it should work
for most types of cores, and should result in similar output to previous versions of Bacon. There is no need to re-do previous runs.
However, it is considered good practice to test the impact of different settings on a site's age-depth model
(e.g., thick, acc.mean, acc.shape, mem.mean, acc.strength).
An age-depth model graph, its age estimates, and a summary.
Maarten Blaauw, J. Andres Christen
Blaauw, M. and Christen, J.A., 2011. Flexible paleoclimate age-depth models using an autoregressive gamma process. Bayesian Anal. 6(3): 457-474.
Christen, J.A., Perez E., S., 2010. A new robust statistical model for radiocarbon data. Radiocarbon 51: 1047-1059.
Reimer et al., 2020. The IntCal20 Northern Hemisphere radiocarbon age calibration curve (0–55 cal kBP). Radiocarbon 62(4): 725-757. doi:10.1017/RDC.2020.41
Hogg et al. 2020 SHCal20 Southern Hemisphere calibration, 0-55,000 years cal BP. Radiocarbon 62(4): 759-778. doi:10.1017/RDC.2020.59
Hughen et al. 2020 Marine20-the marine radiocarbon age calibration curve (0-55,000 cal BP). Radiocarbon 62(4): 779-820. doi:10.1017/RDC.2020.68
Hua et al. 2022 Atmospheric radiocarbon for the period 1950-2019. Radiocarbon 64(4), 723-745, doi:10.1017/RDC.2021.95
Jones, V.J., Stevenson, A.C., Battarbee, R.W., 1989. Acidification of lakes in Galloway, south west Scotland - a diatom and pollen study of the post-glacial history of the Round Loch of Glenhead. Journal of Ecology 77: 1-23.
Bacon(ask=FALSE, coredir=tempfile()) Bacon(cc=2, delta.R=80, delta.STD=40, coredir=tempfile())
Bacon(ask=FALSE, coredir=tempfile()) Bacon(cc=2, delta.R=80, delta.STD=40, coredir=tempfile())
Output all MCMC-derived age estimates for a given depth.
Bacon.Age.d( d, set = get("info"), its = set$output, BCAD = set$BCAD, na.rm = FALSE )
Bacon.Age.d( d, set = get("info"), its = set$output, BCAD = set$BCAD, na.rm = FALSE )
d |
The depth of which Bacon age estimates are to be returned. Has to be a single depth. |
set |
Detailed information of the current run, stored within this session's memory as variable info. |
its |
The set of MCMC iterations to be used. Defaults to the entire MCMC output, |
BCAD |
The calendar scale of graphs and age output-files is in |
na.rm |
Whether or not to remove NA values (ages within slumps) |
Obtaining an age-depth model is often only a step towards a goal, e.g., plotting a core's fossil series ('proxies') against calendar time. Bacon.Age.d can be used to list all MCMC-derived age estimates for a given (single) depth, for example to calculate mean ages for a depth. See also Bacon.d.Age which calculates the depths of a single age estimate.
Outputs all MCMC-derived ages for a given depth.
Maarten Blaauw, J. Andres Christen
## Not run: Bacon(run=FALSE, coredir=tempfile()) agedepth(age.res=50, d.res=50, d.by=10) ages.d20 = Bacon.Age.d(20) mean(ages.d20) ## End(Not run)
## Not run: Bacon(run=FALSE, coredir=tempfile()) agedepth(age.res=50, d.res=50, d.by=10) ages.d20 = Bacon.Age.d(20) mean(ages.d20) ## End(Not run)
Remove files ending in .bacon, .plum (if it exists), .out, .pdf, _ages.txt, and _settings.txt of current core.
Bacon.cleanup(set = get("info"))
Bacon.cleanup(set = get("info"))
set |
Detailed information of the current run, stored within this session's memory as variable |
If cores behave badly, you can try cleaning up previous runs and settings, by removing files *.bacon, *.plum, *.out, *.pdf, *_ages.txt, and *_settings.txt of current core.
A message stating that the files and settings of this run have been deleted.
Maarten Blaauw, J. Andres Christen
Bacon(run=FALSE, coredir=tempfile()) Bacon.cleanup()
Bacon(run=FALSE, coredir=tempfile()) Bacon.cleanup()
Output all MCMC-derived depth estimates for a single given age.
Bacon.d.Age( age, set = get("info"), BCAD = set$BCAD, its = set$output, na.rm = FALSE )
Bacon.d.Age( age, set = get("info"), BCAD = set$BCAD, its = set$output, na.rm = FALSE )
age |
The age estimate for which depths are to be returned. Has to be a single age. |
set |
Detailed information of the current run, stored within this session's memory as variable info. |
BCAD |
The calendar scale of graphs and age output-files is in |
its |
The set of MCMC iterations to be used. Defaults to the entire MCMC output, |
na.rm |
Whether or not to remove NA values (ages within slumps) |
Obtaining an age-depth model is often only a step towards a goal, e.g., plotting a core's fossil series ('proxies') against calendar time. Bacon.d.Age can be used to list all MCMC-derived depths belonging to a given (single) age, for example to calculate mean depths belonging to a modelled depth. This function was kindly written and provided by Timon Netzel (Bonn University). See also Bacon.Age.d, which calculates the ages for a single depth.
Outputs all MCMC-derived depths for a given age.
Maarten Blaauw, J. Andres Christen
## Not run: Bacon(run=FALSE, coredir=tempfile()) agedepth(age.res=50, d.res=50, d.by=10) ages.d20 = Bacon.Age.d(20) mean(ages.d20) ## End(Not run)
## Not run: Bacon(run=FALSE, coredir=tempfile()) agedepth(age.res=50, d.res=50, d.by=10) ages.d20 = Bacon.Age.d(20) mean(ages.d20) ## End(Not run)
Calculate the distribution of age estimates of single or multiple depths.
Bacon.hist( d, set = get("info"), BCAD = set$BCAD, age.lab = c(), age.lim = c(), hist.lab = "Frequency", calc.range = TRUE, hist.lim = c(), draw = TRUE, prob = set$prob, hist.col = grey(0.5), hist.border = grey(0.2), range.col = "blue", med.col = "green", mean.col = "red", verbose = TRUE, save.info = FALSE )
Bacon.hist( d, set = get("info"), BCAD = set$BCAD, age.lab = c(), age.lim = c(), hist.lab = "Frequency", calc.range = TRUE, hist.lim = c(), draw = TRUE, prob = set$prob, hist.col = grey(0.5), hist.border = grey(0.2), range.col = "blue", med.col = "green", mean.col = "red", verbose = TRUE, save.info = FALSE )
d |
The depth or depths for which a histogram and age ranges should be provided. If multiple depths are given, then just the age ranges, median and means (no graphs) are provided for each depth. |
set |
Detailed information of the current run, stored within this session's memory as variable info. |
BCAD |
The calendar scale of graphs and age output-files is in |
age.lab |
The labels for the calendar axis (default |
age.lim |
Minimum and maximum calendar age ranges, calculated automatically by default ( |
hist.lab |
The y-axis is labelled |
calc.range |
Calculate ranges? Takes time so can be left out |
hist.lim |
Limits of the y-axis. |
draw |
Draw a plot or not. Defaults to |
prob |
Age ranges are given as quantiles, e.g., 2.5% and 97.5% for the default of 95% confidence limits ( |
hist.col |
Colour of the histogram. Default grey, |
hist.border |
Colour of the histogram's outline. Default dark grey, |
range.col |
Colour of confidence ranges. Defaults to |
med.col |
Colour of the median. Defaults to |
mean.col |
Colour of the mean. Defaults to |
verbose |
Provide feedback on what is happening (default |
save.info |
A variable called ‘info’ with relevant information about the run (e.g., core name, priors, settings, ages, output) can be saved into the working directory. Note that this will overwrite any existing variable with the same name - as an alternative, one could run, e.g., |
Age estimates of specific depths can also be plotted.
A local variable called ‘hists’, and a plot with the histogram and the age ranges, median and mean, or just the age ranges, medians and means if more than one depth d
is given.
Maarten Blaauw, J. Andres Christen
## Not run: Bacon(run=FALSE, coredir=tempfile()) agedepth(age.res=50, d.res=50, d.by=10) Bacon.hist(20) Bacon.hist(20:30) ## End(Not run)
## Not run: Bacon(run=FALSE, coredir=tempfile()) agedepth(age.res=50, d.res=50, d.by=10) Bacon.hist(20) Bacon.hist(20:30) ## End(Not run)
Reads a Bacon .csv file containing the dates, and transforms it into a clam .csv file.
bacon2clam(core, bacondir = "Bacon_runs", clamdir = "clam_runs", sep = ",")
bacon2clam(core, bacondir = "Bacon_runs", clamdir = "clam_runs", sep = ",")
core |
The name of the core for which a Bacon .csv.file needs to be translated into a clam .csv file |
bacondir |
The directory where the Bacon runs reside. Defaults to |
clamdir |
The directory where the clam runs reside. Defaults to |
sep |
The separator for the .csv files. Defaults to |
Assumes that Bacon .csv files with 4 columns indicate 14C dates. Please make sure this is correct.
A clam .csv file
Maarten Blaauw, J. Andres Christen
{ tmpfl <- tempfile() Bacon(run=FALSE, ask=FALSE, coredir=tmpfl) bacon2clam("MSB2K", bacondir=tmpfl, clamdir=tmpfl) }
{ tmpfl <- tempfile() Bacon(run=FALSE, ask=FALSE, coredir=tmpfl) bacon2clam("MSB2K", bacondir=tmpfl, clamdir=tmpfl) }
Test how well-mixed and converged the MCMC runs are with the chosen core and settings, by running the core several times and comparing the different runs using the Gelman and Rubin Reduction factor (Brooks and Gelman, 1998).
Baconvergence(core = "MSB2K", runs = 5, suggest = FALSE, verbose = TRUE, ...)
Baconvergence(core = "MSB2K", runs = 5, suggest = FALSE, verbose = TRUE, ...)
core |
Name of the core, given using quotes. Defaults to one of the cores provided with rbacon, |
runs |
Amount of runs to test for mixing. Default |
suggest |
If initial analysis of the data indicates abnormally slow or fast accumulation rates, Bacon will suggest to change the prior. |
verbose |
Provide feedback on what is happening (default |
... |
additional options that can be given to the Bacon function. |
Generally Bacon will perform millions of MCMC iterations for each age-model run, although only a fraction of these will be stored. In most cases the remaining MCMC iterations will be well mixed (the upper left panel of the fit of the iterations shows no strange features such as sudden systematic drops or rises). However if the iterations seem not well mixed, or if too few remain (say less than a few hundred), then you could check the Gelman and Rubin Reduction Factor. Too high differences (high Factors) between runs indicate poor MCMC mixing. Robust MCMC mixing is indicated by a Gelman and Rubin Reduction factor (Brooks and Gelman, 1998) below the 1.05 safety threshold.
NA
Maarten Blaauw, J. Andres Christen
Brooks, SP. and Gelman, A. (1998) General methods for monitoring convergence of iterative simulations. _Journal of Computational and Graphical Statistics_, *7*, 434-455.
Baconvergence(runs=2, ssize=100, coredir=tempfile()) # a quick-and-dirty toy example
Baconvergence(runs=2, ssize=100, coredir=tempfile()) # a quick-and-dirty toy example
Produce a plot of the dated depths and their dates
calib.plot( set = get("info"), dets = set$dets, accordion = c(), BCAD = set$BCAD, cc = set$cc, rotate.axes = FALSE, rev.d = FALSE, rev.age = FALSE, rev.yr = rev.age, age.lim = c(), yr.lim = age.lim, date.res = 100, d.lab = c(), age.lab = c(), yr.lab = age.lab, height = 1, calheight = 1, mirror = TRUE, up = TRUE, cutoff = 0.1, C14.col = rgb(0, 0, 1, 0.5), C14.border = rgb(0, 0, 1, 0.75), cal.col = rgb(0, 0.5, 0.5, 0.5), cal.border = rgb(0, 0.5, 0.5, 0.75), dates.col = c(), slump.col = grey(0.8), new.plot = TRUE, plot.dists = TRUE, same.heights = FALSE )
calib.plot( set = get("info"), dets = set$dets, accordion = c(), BCAD = set$BCAD, cc = set$cc, rotate.axes = FALSE, rev.d = FALSE, rev.age = FALSE, rev.yr = rev.age, age.lim = c(), yr.lim = age.lim, date.res = 100, d.lab = c(), age.lab = c(), yr.lab = age.lab, height = 1, calheight = 1, mirror = TRUE, up = TRUE, cutoff = 0.1, C14.col = rgb(0, 0, 1, 0.5), C14.border = rgb(0, 0, 1, 0.75), cal.col = rgb(0, 0.5, 0.5, 0.5), cal.border = rgb(0, 0.5, 0.5, 0.75), dates.col = c(), slump.col = grey(0.8), new.plot = TRUE, plot.dists = TRUE, same.heights = FALSE )
set |
Detailed information of the current run, stored within this session's memory as variable |
dets |
The set of determinations to be plotted. |
accordion |
If depths have to be squeezed/stretched, the parameters can be set here. Defaults to being empty, but requires 2 parameters if active, e.g., |
BCAD |
The calendar scale of graphs is in |
cc |
Calibration curve to be used (defaults to info$cc) |
rotate.axes |
The default of plotting age on the horizontal axis and event probability on the vertical one can be changed with |
rev.d |
The direction of the depth axis can be reversed from the default ( |
rev.age |
The direction of the calendar age axis can be reversed from the default ( |
rev.yr |
Deprecated - use rev.age instead |
age.lim |
Minimum and maximum calendar age ranges, calculated automatically by default ( |
yr.lim |
Deprecated - use age.lim instead |
date.res |
Date distributions are plotted using |
d.lab |
The labels for the depth axis. Default |
age.lab |
The labels for the calendar axis (default |
yr.lab |
Deprecated - use age.lab instead |
height |
The heights of the distributions of the dates. See also |
calheight |
Multiplier for the heights of the distributions of dates on the calendar scale. Defaults to |
mirror |
Plot the dates as 'blobs'. Set to |
up |
Directions of distributions if they are plotted non-mirrored. Default |
cutoff |
Avoid plotting very low probabilities of date distributions (default |
C14.col |
Colour of the calibrated distributions of the dates. Default is semi-transparent blue: |
C14.border |
Colours of the borders of calibrated 14C dates. Default is transparent dark blue: cal.col |
cal.col |
Colour of the non-14C dates in the age-depth plot: default semi-transparent blue-green: |
cal.border |
Colour of the of the border of non-14C dates in the age-depth plot: default semi-transparent dark blue-green: |
dates.col |
As an alternative to colouring dates based on whether they are 14C or not, sets of dates can be coloured as, e.g., |
slump.col |
Colour of slumps. Defaults to |
new.plot |
Start a new plot ( |
plot.dists |
Plot the distributions of the dates (default |
same.heights |
Plot the distributions of the dates all at the same maximum height (default |
This function is generally called internally to produce the age-depth graph. It can be used to produce custom-built graphs.
NA
Maarten Blaauw, J. Andres Christen
Bacon(run=FALSE, coredir=tempfile()) calib.plot()
Bacon(run=FALSE, coredir=tempfile()) calib.plot()
Reads a clam .csv file containing the dates, and transforms it into a Bacon .csv file.
clam2bacon( core, clamdir = "clam_runs", bacondir = "Bacon_runs", sep = ",", cc = 1 )
clam2bacon( core, clamdir = "clam_runs", bacondir = "Bacon_runs", sep = ",", cc = 1 )
core |
The name of the core for which a clam .csv.file needs to be translated into a Bacon .csv file |
clamdir |
The directory where the clam runs reside. Defaults to |
bacondir |
The directory where the Bacon runs reside. Defaults to |
sep |
The separator for the .csv files. Defaults to |
cc |
Calibration curve for C-14 dates: |
Please ensure that if the clam file has offset (d.R) estimates, that errors (d.STD) are provided manually, since these values cannot be determined automatically from the clam .csv file.
A Bacon .csv file
Maarten Blaauw, J. Andres Christen
Produce a plot of the 210Pb data and their depths
draw.pbmeasured( set = get("info"), rotate.axes = FALSE, rev.d = FALSE, rev.age = FALSE, BCAD = set$BCAD, pb.lim = c(), age.lim = c(), d.lim = c(), d.lab = c(), pb.lab = c(), pbmeasured.col = "blue", pbmeasured.lty = 2, pb.log = FALSE, supp.col = "purple", newplot = TRUE, on.agescale = FALSE )
draw.pbmeasured( set = get("info"), rotate.axes = FALSE, rev.d = FALSE, rev.age = FALSE, BCAD = set$BCAD, pb.lim = c(), age.lim = c(), d.lim = c(), d.lab = c(), pb.lab = c(), pbmeasured.col = "blue", pbmeasured.lty = 2, pb.log = FALSE, supp.col = "purple", newplot = TRUE, on.agescale = FALSE )
set |
Detailed information of the current run, stored within this session's memory as variable |
rotate.axes |
The default of plotting age on the horizontal axis and event probability on the vertical one can be changed with |
rev.d |
The direction of the depth axis can be reversed from the default ( |
rev.age |
The direction of the calendar age axis can be reversed from the default ( |
BCAD |
The calendar scale of graphs and age output-files is in cal BP (calendar or calibrated years before the present, where the present is AD 1950) by default, but can be changed to BC/AD using |
pb.lim |
Minimum and maximum of the 210Pb axis ranges, calculated automatically by default ( |
age.lim |
Minimum and maximum of the age ranges to be used to plot 210Pb values. Calculated automatically by default ( |
d.lim |
Minimum and maximum depths to plot; calculated automatically by default ( |
d.lab |
The labels for the depth axis. Default |
pb.lab |
The label for the 210Pb axis (default |
pbmeasured.col |
The label for the measured 210Pb data. |
pbmeasured.lty |
Line type of the measured 210Pb data. Defaults to continuous lines. |
pb.log |
Use a log scale for the 210Pb-axis (default |
supp.col |
Colour of the supported 210Pb data. Defaults to red: |
newplot |
make new plot (default TRUE) |
on.agescale |
Plot the Pb-210 on the cal BP scale. Defaults to FALSE. |
This function is generally called internally to produce the age-depth graph. It can be used to produce custom-built graphs.
A plot of the measured 210Pb values
Maarten Blaauw, J. Andres Christen, Marco Aquino-Lopez
Produce a plot of the 210Pb data and their depths
draw.pbmodelled( set = get("info"), BCAD = set$BCAD, rotate.axes = FALSE, rev.d = FALSE, rev.age = FALSE, pb.lim = c(), d.lim = c(), d.lab = c(), pb.lab = c(), pbmodelled.col = function(x) rgb(0, 0, 1, x), pbmeasured.col = "blue", supp.col = "purple", plot.measured = TRUE, age.lim = c(), mgp = mgp, pb.lty = 1 )
draw.pbmodelled( set = get("info"), BCAD = set$BCAD, rotate.axes = FALSE, rev.d = FALSE, rev.age = FALSE, pb.lim = c(), d.lim = c(), d.lab = c(), pb.lab = c(), pbmodelled.col = function(x) rgb(0, 0, 1, x), pbmeasured.col = "blue", supp.col = "purple", plot.measured = TRUE, age.lim = c(), mgp = mgp, pb.lty = 1 )
set |
Detailed information of the current run, stored within this session's memory as variable |
BCAD |
The calendar scale of graphs is in |
rotate.axes |
The default of plotting age on the horizontal axis and event probability on the vertical one can be changed with |
rev.d |
The direction of the depth axis can be reversed from the default ( |
rev.age |
The direction of the calendar age axis can be reversed from the default ( |
pb.lim |
Minimum and maximum of the 210Pb axis ranges, calculated automatically by default ( |
d.lim |
Minimum and maximum depths to plot; calculated automatically by default ( |
d.lab |
The labels for the depth axis. Default |
pb.lab |
The label for the 210Pb axis (default |
pbmodelled.col |
Colour of the modelled 210Pb values. Defaults to scales of blue: |
pbmeasured.col |
Colour of the measured 210Pb values. Defaults to blue. |
supp.col |
Colour of the supported 210Pb data. Defaults to red: |
plot.measured |
Plot the measured 210Pb values (default |
age.lim |
values of the age axis. Used to calculate where to plot the pb values on the secondary axis |
mgp |
Axis text margins (where should titles, labels and tick marks be plotted). Defaults to |
pb.lty |
Line type of measured Pb-210 data. |
This function is generally called internally to produce the age-depth graph. It can be used to produce custom-built graphs.
A plot of the modelled (and optionally the measured) 210Pb values
Maarten Blaauw, J. Andres Christen, Marco Aquino-Lopez
Plot grey-scale representation of estimated flux rates for proxies against calendar age.
flux.age.ghost( proxy = 1, age.lim = c(), yr.lim = age.lim, age.res = 200, yr.res = age.res, set = get("info"), flux = c(), plot.range = TRUE, prob = 0.8, range.col = grey(0.5), range.lty = 2, plot.mean = TRUE, mean.col = "red", mean.lty = 2, plot.median = TRUE, median.col = "blue", median.lty = 2, flux.lim = c(), flux.lab = expression("flux (g cm"^-1 * " yr"^-1 * ")"), upper = 0.95, rgb.scale = c(0, 0, 0), rgb.res = 100, dark = set$dark, cutoff = 0.001, BCAD = set$BCAD, age.lab = c(), yr.lab = age.lab, rotate.axes = FALSE, rev.flux = FALSE, rev.age = FALSE, rev.yr = rev.age )
flux.age.ghost( proxy = 1, age.lim = c(), yr.lim = age.lim, age.res = 200, yr.res = age.res, set = get("info"), flux = c(), plot.range = TRUE, prob = 0.8, range.col = grey(0.5), range.lty = 2, plot.mean = TRUE, mean.col = "red", mean.lty = 2, plot.median = TRUE, median.col = "blue", median.lty = 2, flux.lim = c(), flux.lab = expression("flux (g cm"^-1 * " yr"^-1 * ")"), upper = 0.95, rgb.scale = c(0, 0, 0), rgb.res = 100, dark = set$dark, cutoff = 0.001, BCAD = set$BCAD, age.lab = c(), yr.lab = age.lab, rotate.axes = FALSE, rev.flux = FALSE, rev.age = FALSE, rev.yr = rev.age )
proxy |
Which proxy to use (counting from the column number in the .csv file after the depths column). |
age.lim |
Minimum and maximum calendar age ranges, calculated automatically by default ( |
yr.lim |
Deprecated - use age.lim instead |
age.res |
Resolution or amount of greyscale pixels to cover the age scale of the plot. Default |
yr.res |
Deprecated - use age.res instead |
set |
Detailed information of the current run, stored within this session's memory as variable info. |
flux |
Define a flux variable within the R session (consisting of depths and their proxy concentrations in two columns) and provide the name of this variable, e.g.:
|
plot.range |
Plot curves that indicate a probability range, at resolution of yr.res. |
prob |
Probability range, defaults to |
range.col |
Red seems nice. |
range.lty |
Line type of the confidence ranges. |
plot.mean |
Plot the mean fluxes. |
mean.col |
Red seems nice. |
mean.lty |
Line type of the means. |
plot.median |
Plot the median fluxes. |
median.col |
Blue seems nice. |
median.lty |
Line type of the medians. |
flux.lim |
Limits of the flux axes. |
flux.lab |
Axis labels. Defaults to |
upper |
Maximum flux rates to plot. Defaults to the upper 99%; |
rgb.scale |
The function to produce a coloured representation of all age-models. Needs 3 values for the intensity of red, green and blue. Defaults to grey-scales: |
rgb.res |
Resolution of the colour spectrum depicting the age-depth model. Default |
dark |
The darkest grey value is |
cutoff |
Point below which colours will no longer be printed. Default |
BCAD |
The calendar scale of graphs and age output-files is in |
age.lab |
The labels for the calendar axis (default |
yr.lab |
Deprecated - use age.lab instead |
rotate.axes |
The default of plotting calendar year on the horizontal axis and fluxes on the vertical one can be changed with |
rev.flux |
The flux axis can be reversed with |
rev.age |
The direction of the age axis can be reversed using |
rev.yr |
Deprecated - use rev.age instead |
To plot flux rates (e.g. pollen grains/cm2/yr) as greyscales,
provide a plain text file with headers and the data in columns separated by commas, ending in '_flux.csv'
and saved in your core's folder. The first column should contain the depths, and the next columns should contain
the proxy concentration values (leaving missing values empty). Then type for example flux.age.ghost(1)
to plot the
flux values for the first proxy in the .csv file. Instead of using a _flux.csv file, a flux variable can also be defined
within the R session (consisting of depths and their proxy concentrations in two columns). Then provide the name of this variable, e.g.: flux.age.ghost(flux=flux1)
.
See Bacon_runs/MSB2K/MSB2K_flux.csv for an example.
A plot of flux rates.
Maarten Blaauw, J. Andres Christen
## Not run: Bacon(run=FALSE, coredir=tempfile()) agedepth(yr.res=50) flux.age.ghost(1) ## End(Not run)
## Not run: Bacon(run=FALSE, coredir=tempfile()) agedepth(yr.res=50) flux.age.ghost(1) ## End(Not run)
Proxies analysed along the depths of a core can be plotted as 'proxy-ghost' graphs against calendar time while taking into account chronological uncertainties. Here darker grey indicates more likely calendar ages for specific proxy value.
proxy.ghost( proxy = 1, proxy.lab = NULL, proxy.res = 250, age.res = 200, yr.res = age.res, rgb.scale = c(0, 0, 0), rgb.res = 100, set = get("info"), cutoff = 0.001, dark = 1, darkest = 1, rotate.axes = FALSE, proxy.rev = FALSE, age.rev = FALSE, yr.rev = age.rev, plot.mean = FALSE, mean.col = "red", age.lim = NULL, yr.lim = age.lim, proxy.lim = NULL, sep = ",", xaxs = "i", yaxs = "i", xaxt = "s", yaxt = "s", bty = "l", BCAD = set$BCAD, age.lab = ifelse(BCAD, "BC/AD", "cal yr BP"), yr.lab = age.lab, verbose = TRUE, add = FALSE )
proxy.ghost( proxy = 1, proxy.lab = NULL, proxy.res = 250, age.res = 200, yr.res = age.res, rgb.scale = c(0, 0, 0), rgb.res = 100, set = get("info"), cutoff = 0.001, dark = 1, darkest = 1, rotate.axes = FALSE, proxy.rev = FALSE, age.rev = FALSE, yr.rev = age.rev, plot.mean = FALSE, mean.col = "red", age.lim = NULL, yr.lim = age.lim, proxy.lim = NULL, sep = ",", xaxs = "i", yaxs = "i", xaxt = "s", yaxt = "s", bty = "l", BCAD = set$BCAD, age.lab = ifelse(BCAD, "BC/AD", "cal yr BP"), yr.lab = age.lab, verbose = TRUE, add = FALSE )
proxy |
Which proxy to use (counting from the column number in the .csv file after the depths column). |
proxy.lab |
Label of the proxy axis. Default names are taken from the csv file. |
proxy.res |
Greyscale pixels are calculated for |
age.res |
Resolution or amount of greyscale pixels to cover the age scale of the age-model plot. Default |
yr.res |
Deprecated - use age.res instead |
rgb.scale |
The function to produce a coloured representation of all age-models. Needs 3 values for the intensity of red, green and blue. Defaults to grey-scales: |
rgb.res |
Resolution of the colour spectrum depicting the age-depth model. Default |
set |
Detailed information of the current run, stored within this session's memory as variable info. |
cutoff |
Point below which colours will no longer be printed. Default |
dark |
By default, the darkest grey value is assigned to the most likely value within the entire core (normalised to 1; |
darkest |
Darkness of the most likely value. Is black by default ( |
rotate.axes |
The default is to plot the calendar horizontally, however the plot can be rotated ( |
proxy.rev |
The proxy axis can be reversed if |
age.rev |
The calendar axis can be reversed using |
yr.rev |
Deprecated - use age.rev instead |
plot.mean |
The mean ages of the proxy values can be added using |
mean.col |
Colour of the weighted mean ages of the proxy values. |
age.lim |
Minimum and maximum calendar age ranges, calculated automatically by default ( |
yr.lim |
Deprecated - use age.lim instead |
proxy.lim |
Ranges of the proxy axis, calculated automatically by default ( |
sep |
Separator between the fields of the plain text file containing the depth and proxy data. |
xaxs |
Extension of x-axis. By default, no white-space will be added at the axis extremes ( |
yaxs |
Extension of y-axis. By default, no white-space will be added at the axis extremes ( |
xaxt |
The x-axis is plotted by default, but this can be switched off using |
yaxt |
The y-axis is plotted by default, but this can be switched off using |
bty |
Type of box to be drawn around the plot ( |
BCAD |
The calendar scale of graphs and age output-files is in |
age.lab |
The labels for the calendar axis (default |
yr.lab |
Deprecated - use age.lab instead |
verbose |
Provide feedback on what is happening (default |
add |
Add to an existing graph (default |
Place a csv file with the values of proxies against depth within your core's folder. The values should be in columns separated by commas (default sep=","
), the first column containing the depths and the first line (header) containing the proxy names.
The file name should start with the core's name and end with "_proxies.csv". For an example see "Bacon_coredir/MSB2K/MSB2K_proxies.csv"
or "Cores/MSB2K/MSB2K_proxies.csv"
.
A grey-scale graph of the proxy against calendar age.
Maarten Blaauw, J. Andres Christen
Bacon(ask=FALSE, coredir=tempfile()) layout(1) proxy.ghost()
Bacon(ask=FALSE, coredir=tempfile()) layout(1) proxy.ghost()
Removes iterations of the MCMC time series, and then updates the output file.
scissors(burnin, set = get("info"), write = TRUE, save.info = TRUE)
scissors(burnin, set = get("info"), write = TRUE, save.info = TRUE)
burnin |
Number of iterations to remove of the iterative time series. If this value is higher than the amount of remaining iterations, a warning is given and the iterations are not removed. If the provided number is negative, the iterations will be removed from the end of the run, not from the start. If a range is given, this range of iterations is removed. |
set |
Detailed information of the current run, stored within this session's memory as variable |
write |
Whether or not to write the changes to the output file. Defaults to TRUE. |
save.info |
By default, a variable called ‘info’ with relevant information about the run (e.g., core name, priors, settings, ages, output) is saved into the working directory. Note that this will overwrite any existing variable with the same name - as an alternative, one could run, e.g., |
Bacon will perform millions of MCMC iterations for each age-model run by default, although only a fraction
of these will be stored. In most cases the remaining MCMC iterations will be well mixed (the upper left panel
of the fit of the iterations shows no undesirable features such as trends or sudden systematic drops or rises).
If the run has a visible remaining burn-in, scissors can be used to remove them.
To remove, e.g., the first 300 iterations, type scissors(300)
. To remove the last 300 iterations, type scissors(-300)
. To remove iterations 300 to 600, type scissors(300:600)
.
NA
Maarten Blaauw, J. Andres Christen
Bacon(ask=FALSE, coredir=tempfile()) nrow(info$output) scissors(100) nrow(info$output)
Bacon(ask=FALSE, coredir=tempfile()) nrow(info$output) scissors(100) nrow(info$output)
Select initial values th0 and th1 for a Bacon MCMC run and write them into a file that can be read by Bacon.
set.initvals(set = get("info"), core = set$core, values = c(), click = 1)
set.initvals(set = get("info"), core = set$core, values = c(), click = 1)
set |
Detailed information of the current run, stored within this session's memory as variable |
core |
The name of the core for which a bacon.init file needs to be made |
values |
use this if you wish to provide the values (2 rows with starting age, accumulation rates for each model section, and memory parameter w). |
click |
use this if you wish to use the cursor to manually select age-depth points from the current graphic device. This is the default option. Right click once you have selected all datapoints, or provide the number of expected datapoints as a value (e.g., |
By default, the initial MCMC values th0 and th1 of the Bacon age-depth model (upper ages and accumulation rate for each model section) are estimated randomly. Since version 3.1.0, these starting values can also be provided in a file with extension _bacon.init, placed within the core's folder. This file will need to have two rows, each for one of the two initial sets of parameters required (the t-walk requires two starting estimates for all MCMC parameters). If such a file is found (and correctly formatted), Bacon will use the values within this file as starting points for the MCMC run.
A .bacon.init file
Maarten Blaauw, J. Andres Christen
Squeeze or compress depths below a boundary by a certain amount. Accompanies the stretch function; see the stretch function for code on running the accordion
squeeze(d, boundary, times)
squeeze(d, boundary, times)
d |
The depth(s) to be squeezed |
boundary |
The depth below which depths should be squeezed |
times |
The factor by which the depths should be squeezed |
The squeezed depth(s)
Maarten Blaauw
squeeze(40,25,20)
squeeze(40,25,20)
Stretch squeezed depths e.g., calculate the original depths of depths that were squeezed. Accompanies the squeeze function.
stretch(d, boundary, times)
stretch(d, boundary, times)
d |
The depth(s) to be stretched |
boundary |
The depth below which depths should be stretched |
times |
The factor by which the depths should be stretched |
The stretched depth(s)
Maarten Blaauw
stretch(25.75,25,20) ## Not run: # To play the accordion, first squeeze an existing core. # Let's squeeze the depths below 10 cm core depth 20 times: Bacon("accordion", 1) dets <- info$dets dets[,4] <- squeeze(dets[,4], 10, 20) # make a new directory for the squeezed core, and place the dets file there: dir.create("Bacon_runs/squeezed") write.table(dets, "Bacon_runs/squeezed/squeezed.csv", row.names=FALSE, sep=",") # now run that squeezed core, adding a boundary (10cm) and adapting the acc.mean prior (20x): Bacon("squeezed", 1, boundary=10, acc.mean=c(5, 20*5)) # finally, plot while stretching the depths onto the original scale: agedepth(accordion=c(10,20)) ## End(Not run)
stretch(25.75,25,20) ## Not run: # To play the accordion, first squeeze an existing core. # Let's squeeze the depths below 10 cm core depth 20 times: Bacon("accordion", 1) dets <- info$dets dets[,4] <- squeeze(dets[,4], 10, 20) # make a new directory for the squeezed core, and place the dets file there: dir.create("Bacon_runs/squeezed") write.table(dets, "Bacon_runs/squeezed/squeezed.csv", row.names=FALSE, sep=",") # now run that squeezed core, adding a boundary (10cm) and adapting the acc.mean prior (20x): Bacon("squeezed", 1, boundary=10, acc.mean=c(5, 20*5)) # finally, plot while stretching the depths onto the original scale: agedepth(accordion=c(10,20)) ## End(Not run)
Randomly thin iterations by a given proportion, for example if autocorrelation is visible within the MCMC series.
thinner(proportion = 0.1, set = get("info"), write = TRUE, save.info = TRUE)
thinner(proportion = 0.1, set = get("info"), write = TRUE, save.info = TRUE)
proportion |
Proportion of iterations to remove. Should be between 0 and 1. Default |
set |
Detailed information of the current run, stored within this session's memory as variable |
write |
Whether or not to write the changes to the output file. Defaults to TRUE. |
save.info |
By default, a variable called ‘info’ with relevant information about the run (e.g., core name, priors, settings, ages, output) is saved into the working directory. Note that this will overwrite any existing variable with the same name - as an alternative, one could run, e.g., |
From all iterations, a proportion is removed with to-be-removed iterations sampled randomly among all iterations.
NA
Maarten Blaauw, J. Andres Christen
Bacon(ask=FALSE, coredir=tempfile()) nrow(info$output) thinner(.2) nrow(info$output)
Bacon(ask=FALSE, coredir=tempfile()) nrow(info$output) thinner(.2) nrow(info$output)
Bacon for vegans
tofu(...)
tofu(...)
... |
options for the Bacon command. See Bacon |
A vegan wrapper for Bacon - does everything Bacon does, but without the meat.
A tofu age-model