fit-method-save_object | R Documentation |
This method is a wrapper around base::saveRDS()
that ensures
that all posterior draws and diagnostics are saved when saving a fitted
model object. Because the contents of the CmdStan output CSV files are only
read into R lazily (i.e., as needed), the $save_object()
method is the
safest way to guarantee that everything has been read in before saving.
See the "Saving fitted model objects" section of the Getting started with CmdStanR vignette for some suggestions on faster model saving for large models.
save_object(file, ...)
file |
(string) Path where the file should be saved. |
... |
Other arguments to pass to |
CmdStanMCMC
, CmdStanMLE
, CmdStanVB
, CmdStanGQ
## Not run:
fit <- cmdstanr_example("logistic")
temp_rds_file <- tempfile(fileext = ".RDS")
fit$save_object(file = temp_rds_file)
rm(fit)
fit <- readRDS(temp_rds_file)
fit$summary()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.