Skip to contents

This function closely imitates cmdstanr::save_object() but saves the entire model output object from run_model() which contains more details regarding data preparation (stratification etc.).

Usage

save_model_run(model_output, retain_csv = TRUE, path = NULL, quiet = FALSE)

Arguments

model_output

List. Model output generated by run_model().

retain_csv

Logical Should the Stan csv files be retained. Defaults to TRUE if user calls function directly. However, when this function is called internally by run_model this is set to FALSE.

path

Character. Optional file path to use for saved data. Defaults to the file path used for the original run.

quiet

Logical. Suppress progress messages? Default FALSE.

Value

Nothing. Creates an .rds file at path.

Details

Files are saved to path, or if not provided, to the original location of the Stan model run files (if the original files exist).

See also

Other modelling functions: copy_model_file(), run_model()

Examples

# By default, the model is saved as an RDS file during `run_model()`

# But you can also deliberately save the file (here with an example model)
save_model_run(pacific_wren_model, path = "my_model.rds")

# Clean up
unlink("my_model.rds")