A Note on Reproducability

Ewan Keith

2017-09-21

By specifying seed values when calling functions dependent on random number generation (RNG) both rstan and rstansim allow for fully reproducable results to be produced. However, in cases where rstan is used to generate new values in the generated quantities code block (using “_rng" suffixed commands) a common seed is not sufficient to guarantee reproducability within the same R session (see the discussion here).

This can be managed by restarting the R session in advance of calling any functions reliant on rstans RNG functions. If running rstudio this is easily achieved by calling .rs.restartR().

Manual tests of this behaviour are available with this package for examples of this in practice.