rstansim: An R package for running simulation studies using stan
Currently unmanaged and likely not up to date with modern stan and loo interfaces. Not recomended for current use.
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.
# Install latest version from cran install.packages("rstansim") # Or the the development version 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.
- Using rstansim to run a simulation study
- Simulating datasets using rstan and rstansim
- Model fitting and capture of relevant data
- Managing simulation results with rstansim
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.