Title: | Global Bayesian Foraminifera Core Top Calibration |
---|---|
Description: | A Bayesian, global planktic foraminifera core top calibration to modern sea-surface temperatures. Includes four calibration models, considering species-specific calibration parameters and seasonality. |
Authors: | Steven Malevich [aut, cre] |
Maintainer: | Steven Malevich <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.0.2.9000 |
Built: | 2025-03-05 05:18:01 UTC |
Source: | https://github.com/brews/bayfoxr |
A data set containing marine sediment core samples from the Paleocene-Eocene Thermal Maximum (PETM) section with well preservedforaminifera calcite d18O.
bassriver
bassriver
A data frame with 62 rows and 2 column variables:
marine sediment down-core sample depth, in m
Morozovella spp. shell calcite d18O, in ‰ VPDB
John, C. M., S. M. Bohaty, J. C. Zachos, A. Sulijs, S. Gibbs, H. Brinkhuis, and T. J. Bralower (2008), North American continental margin records of the Paleocene-Eocene thermal maximum: Implications for global carbon and hydrological cycling, Paleoceanography, 23(2), doi:10.1029/2007PA001465.
Parse trace dataframe column names to get vector of available forams.
get_available_forams(d)
get_available_forams(d)
d |
Data frame containing MCMC trace draws. Column names are model parameters with foram group name separated from model parameters name by "__" |
Character vector of available foram names.
Get MCMC trace draws.
get_draws(foram = NULL, seasonal_seatemp = FALSE)
get_draws(foram = NULL, seasonal_seatemp = FALSE)
foram |
Optional. String or |
seasonal_seatemp |
Optional boolean indicating whether to use the seasonal
sea-surface temperature calibrations. Default is |
Four calibration models are available: an "annual pooled" model, a
"seasonal pooled" model, an "annual hierarchical" model, and a
"seasonal hierarchical" model. This function uses magic to determine which
"pooled annual" model is used. Which is the simplest case with potential use
for Deep Time reconstructions of nonexant foram species. Giving a valid string
for foram
will use a hierarchical model, which has foram-specific
variability in calibration model parameters. Passing TRUE
for
seasonal_seatemp
will use a model trained on season sea-surface
temperatures. See reference paper for further details.
Data frame with columns "alpha", "beta", "tau". Which are equal-length vectors of model parameter draws.
prediction
object.Plot a prediction
object.
## S3 method for class 'prediction' plot(...)
## S3 method for class 'prediction' plot(...)
... |
Arguments passed on to |
data(bassriver) # Using the "pooled annual" calibration model: sst <- predict_seatemp(bassriver$d18o, d18osw=0.0, prior_mean=30.0, prior_std=20.0) predictplot(x=bassriver$depth, y=sst, ylim=c(20, 40), ylab="SST (°C)", xlab="Depth (m)")
data(bassriver) # Using the "pooled annual" calibration model: sst <- predict_seatemp(bassriver$d18o, d18osw=0.0, prior_mean=30.0, prior_std=20.0) predictplot(x=bassriver$depth, y=sst, ylim=c(20, 40), ylab="SST (°C)", xlab="Depth (m)")
Predict d18O of foram calcite given seawater temperature and seawater d18O.
predict_d18oc(seatemp, d18osw, foram = NULL, seasonal_seatemp = FALSE, drawsfun = get_draws)
predict_d18oc(seatemp, d18osw, foram = NULL, seasonal_seatemp = FALSE, drawsfun = get_draws)
seatemp |
Numeric or vector of observed sea-surface temperatures (°C). |
d18osw |
Numeric or vector of observed seawater d18O (‰ VSMOW). |
foram |
Optional. String or |
seasonal_seatemp |
Optional boolean indicating whether to use the seasonal
sea-surface temperature calibrations. Default is |
drawsfun |
Optional function used to get get model parameter draws. Must
take arguments for "foram" and "seasonal_seatemp" and return a list with
members "alpha", "beta", "tau". This is for debugging and testing. See
|
Four calibration models are available: an "annual pooled" model, a
"seasonal pooled" model, an "annual hierarchical" model, and a
"seasonal hierarchical" model. This function uses magic to determine which
"pooled annual" model is used. Which is the simplest case with potential use
for Deep Time reconstructions of nonexant foram species. Giving a valid string
for foram
will use a hierarchical model, which has foram-specific
variability in calibration model parameters. Passing TRUE
for
seasonal_seatemp
will use a model trained on season sea-surface
temperatures. See reference paper for further details.
A prediction
instance for inferred foraminiferal calcite
d18O (‰ VPDB).
# Infer d18Oc for a G. bulloides core top sample using annual hierarchical model. # The true, d18Oc for this sample is -2.16 (‰ VPDB). delo_ann <- predict_d18oc(seatemp=28.6, d18osw=0.48, foram="G. bulloides") head(quantile(delo_ann, probs=c(0.159, 0.5, 0.841))) # ± 1 standard deviation # Now using seasonal hierarchical model: delo_sea <- predict_d18oc(seatemp=28.6, d18osw=0.48, foram="G. bulloides", seasonal_seatemp = TRUE) head(quantile(delo_sea, probs=c(0.159, 0.5, 0.841))) # ± 1 standard deviation
# Infer d18Oc for a G. bulloides core top sample using annual hierarchical model. # The true, d18Oc for this sample is -2.16 (‰ VPDB). delo_ann <- predict_d18oc(seatemp=28.6, d18osw=0.48, foram="G. bulloides") head(quantile(delo_ann, probs=c(0.159, 0.5, 0.841))) # ± 1 standard deviation # Now using seasonal hierarchical model: delo_sea <- predict_d18oc(seatemp=28.6, d18osw=0.48, foram="G. bulloides", seasonal_seatemp = TRUE) head(quantile(delo_sea, probs=c(0.159, 0.5, 0.841))) # ± 1 standard deviation
Predict sea-surface temperature given d18O of foram calcite and seawater d18O.
predict_seatemp(d18oc, d18osw, prior_mean, prior_std, foram = NULL, seasonal_seatemp = FALSE, drawsfun = get_draws)
predict_seatemp(d18oc, d18osw, prior_mean, prior_std, foram = NULL, seasonal_seatemp = FALSE, drawsfun = get_draws)
d18oc |
Numeric or vector of observed foram calcite d18O (‰ VPDB). |
d18osw |
Numeric or vector of observed seawater d18O (‰ VSMOW). |
prior_mean |
Numeric indicating prior mean for sea-surface temperature (°C). |
prior_std |
Numeric indicating prior standard deviation for sea-surface temperature (°C). |
foram |
Optional. String or |
seasonal_seatemp |
Optional boolean indicating whether to use the seasonal
sea-surface temperature calibrations. Default is |
drawsfun |
Optional function used to get get model parameter draws. Must take arguments for "foram" and "seasonal_seatemp" and return a list with members "alpha", "beta", "tau". This is for debugging and testing. |
Four calibration models are available: an "annual pooled" model, a
"seasonal pooled" model, an "annual hierarchical" model, and a
"seasonal hierarchical" model. This function uses magic to determine which
"pooled annual" model is used. Which is the simplest case with potential use
for Deep Time reconstructions of nonexant foram species. Giving a valid string
for foram
will use a hierarchical model, which has foram-specific
variability in calibration model parameters. Passing TRUE
for
seasonal_seatemp
will use a model trained on season sea-surface
temperatures. See reference paper for further details.
A prediction
instance for inferred sea-surface temperature (°C).
data(bassriver) # Using the "pooled annual" calibration model: sst <- predict_seatemp(bassriver$d18o, d18osw=0.0, prior_mean=30.0, prior_std=20.0) head(quantile(sst)) # Show only the top few values predictplot(x=bassriver$depth, y=sst, ylim=c(20, 40), ylab="SST (°C)", xlab="Depth (m)")
data(bassriver) # Using the "pooled annual" calibration model: sst <- predict_seatemp(bassriver$d18o, d18osw=0.0, prior_mean=30.0, prior_std=20.0) head(quantile(sst)) # Show only the top few values predictplot(x=bassriver$depth, y=sst, ylim=c(20, 40), ylab="SST (°C)", xlab="Depth (m)")
Constructor for S3 prediction class.
prediction(ensemble)
prediction(ensemble)
ensemble |
A matrix (m x n) of the prediciton posteriors. Where m is the number of values inferred and n is the number of trace draws. |
A prediction
object.
prediction
with intervals.Simple plot of prediction
with intervals.
predictplot(y, x = NULL, probs = c(0.05, 0.5, 0.95), poly_col = grDevices::rgb(0, 0, 0, 0.1), ...)
predictplot(y, x = NULL, probs = c(0.05, 0.5, 0.95), poly_col = grDevices::rgb(0, 0, 0, 0.1), ...)
y |
A |
x |
Optional vector or NULL, indicating were |
probs |
Optional 3-member Vector of numerics indicating low, middle, and high probability intervals to plot. All must be <= 1. |
poly_col |
Optional color for interval polygon. |
... |
Additional arguments passed to |
data(bassriver) # Using the "pooled annual" calibration model: sst <- predict_seatemp(bassriver$d18o, d18osw=0.0, prior_mean=30.0, prior_std=20.0) predictplot(x=bassriver$depth, y=sst, ylim=c(20, 40), ylab="SST (°C)", xlab="Depth (m)")
data(bassriver) # Using the "pooled annual" calibration model: sst <- predict_seatemp(bassriver$d18o, d18osw=0.0, prior_mean=30.0, prior_std=20.0) predictplot(x=bassriver$depth, y=sst, ylim=c(20, 40), ylab="SST (°C)", xlab="Depth (m)")
prediction
.Quantiles for a prediction
.
## S3 method for class 'prediction' quantile(x, ...)
## S3 method for class 'prediction' quantile(x, ...)
x |
A |
... |
Arguments to be passed on to |
Internal function for 'predict_seatemp()'.
target_timeseries_pred(d18osw_now, alpha_now, beta_now, tau_now, proxy_ts, prior_mu, prior_inv_cov)
target_timeseries_pred(d18osw_now, alpha_now, beta_now, tau_now, proxy_ts, prior_mu, prior_inv_cov)
d18osw_now |
Numeric or vector giving seawater d18O. Note, should be in units (‰ VPDB). |
alpha_now |
Numeric, alpha model parameter. |
beta_now |
Numeric, beta model parameter. |
tau_now |
Numeric, tau model parameter. |
proxy_ts |
Numeric or vector of proxy time series (foram d18O). |
prior_mu |
Matrix (n X 1) giving prior mean. |
prior_inv_cov |
Matrix (n X x) giving prior inverse covariance matrix. |
Sample of time time series vector conditional on the other args