est_model.Rd
this is a wrapper function around compiling and sampling from the Bayesian bomb radiocarbon model sets. Flags generated in the data_prep function are used to compile the appropriate model specific to your machine's C++ compiler and then sample from the model.
est_model(data, save_dir, ...)
data prepared using the data_prep function
directory to save cmdstan outputs
arguments to 'cmdstanr' sample function
A list containing the STAN model and samples if fitted successfully.
model: the CmdStanModel object used to sample from
fitted: the returned samples from calling sample
on the CmdStanModel object
#REFERENCE-ONLY
df <- data_prep(sim_ref)
#> No values provided in df_unk, skipping validation and estimating reference series only
#estimate model
fit <- est_model(df, show_messages = FALSE, show_exceptions = FALSE)
#> Warning in '/var/folders/dn/5kjcqxy50yzgn22tm45_k8jc0000gn/T/RtmpWDH01L/model-4175f38fc78.stan', line 2, column 8: Functions
#> do not need to be declared before definition; all user defined function
#> names are always in scope regardless of definition order.
#estimate model with args to cmdstanr sample function
if (FALSE) {
fit <- est_model(df, iter_warmup = 3000, iter_sampling = 500, parallel_chains = 4)
}
#INTEGRATED MODEL
df_int <- data_prep(sim_ref, sim_unk)
#estimate model
if (FALSE) {
fit_int <- est_model(df_int, parallel_chains = 4, iter_warmup=3000, iter_sampling = 250)
}
#FIXED NUMBER OF KNOTS
if (FALSE) {
df <- data_prep(sim_ref, fixed.knot = 12L)
fit <- est_model(df, parallel_chains = 4, iter_warmup=1000, iter_sampling = 250)
}