A wrapper around saveRDS
that saves a fitted
coevfit
model object while ensuring that all posterior draws and
diagnostics are correctly saved by cmdstanr.
save_coevfit(object, file, ...)
An object of class coevfit
A string declaring the path where the file should be saved
Other arguments to pass to saveRDS
besides
object
and file
An .RDS file containing the fitted coevfit
model object
if (FALSE) { # \dontrun{
# fit dynamic coevolutionary model
fit <- coev_fit(
data = authority$data,
variables = list(
political_authority = "ordered_logistic",
religious_authority = "ordered_logistic"
),
id = "language",
tree = authority$phylogeny,
# additional arguments for cmdstanr::sample()
chains = 4,
parallel_chains = 4,
seed = 1
)
# save model to .rds file
save_coevfit(fit, file = "model.rds")
} # }