knitr::opts_chunk$set(collapse = T)
Once data has been simulated and models fit the next stage is to organise the results for analyse/storage and then to extract the relevant data.
Any simulation study is likely to involve multiple stan models, and therefore likely to involve multiple calls to fit_models()
and multiple output objects from these calls. Held seperately these increase the complexity of analysing the simulation results. For this reason, in cases where multiple simulation objects are being managed it is strongly recommended that the collect()
function is used to group them into a single object of class stansim_collection
.
See the end to end example for an example of how to use the collect()
function to combine multiple stansim_simulation
objects in to one. collect()
can be used to combine both stansim_simulation
and stansim_collection
objects together. Once all results for a single simulation study have been combined further analysis and storage only needs to focus on a single R object.
Once data is collected into a single object it is then best extracted using the packages built in functions, all prefixed with extract_
. These functions currently include:
extract_data()
: Returns all parameter estimates from fitted models.extract_refitted()
: Returns all models that have been refitted using the refit()
function since the initial fit_models()
call.extract_time_elapsed()
: Returns information on the time taken to fit all models.Any other stored data can be extracted manually, but this process can be quite involved due to the deep structure of the stansim_simulation
and stansim_collection
objects.
In order that all simulation data is clear and understandable it's important that informative object names are set. If for whatever reason they're not set when initially constructed both stansim_simulation
and stansim_collection
objects can have their names reset by the rename()
function.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.