knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  cache = TRUE, autodep = TRUE,
  fig.width = 9,
  dev = "png",
  dev.args = list(type = "cairo-png"),
  dpi = 300
)

Installation

hamstrbacon can be installed directly from Github

if (!require("remotes")) {
  install.packages("remotes")
}

remotes::install_github("earthsystemdiagnostics/hamstrbacon")

Fitting age-models with rbacon via hamstrbacon

Using the example core "MSB2K" from the rbacon package.

library(hamstrbacon)
hambac_1 <- hamstr_bacon(id = "tst", 
                         depth = MSB2K$depth,
                         obs_age = MSB2K$age,
                         obs_err = MSB2K$error,
                         thick = 5, cc = 1, 
                         # pass seed to rbacon so that mcmc sample is the same
                         # each time for the example
                         seed = 20220103
                         )

Plot the Bacon model with hamstr plotting functions

plot(hambac_1)

Extract summary downcore age-depth model

summary(hambac_1)

Get the individual model realisations

predict(hambac_1)

Plot the accumulation rates

plot(hambac_1, type = "acc")

Smooth the accumulation rates with 10 cm filter before calculating the statistics

plot(hambac_1, type = "acc", tau = 10)

Get the ages interpolated at specific depths

spec_depths <- predict(hambac_1, depth = c(10:15))

spec_depths

Summary also works after interpolation

summary(spec_depths)

References



EarthSystemDiagnostics/hamstrbacon documentation built on June 2, 2025, 5:04 a.m.