rstansim provides a set of helper and utility functions to simplify running simulation studies using R and stan. The package addresses three aspects of running a simulation study:
A small end to end example is demonstrated here.
All simulation data is output in a tidy format, for ease of interaction with tidyverse packages for analysis and visualisation. Additionally reproducability information such as seeds, initial values, and data used, are stored alongside the data.
# Package not yet on CRAN, needs installed from Github: # install.packages("devtools") devtools::install_github("ewan-keith/rstansim")
The four vignettes below provide exmples of how rstansim can be used to simplify simulation studies with stan. The first vignette provides a minimal, end to end example of a simualtion study and it is recommended that this is read first. The next three provide greater detail on the three primary aspects of running a simulation study listed above.
If looking to produce reproducable samples with stans own RNG functions then read this note on the behaviour of these functions.
Further information on the packages functions can be found at the site reference.