7

Is there a possibility to extract the stan code used for the MCMC sampling in rstanarm?

I would like to compare my own parametrisation of a model and prior choices to the one used in rstanarm.

snaut
  • 2,261
  • 18
  • 37

1 Answers1

14

You can execute

library(rstanarm)
example(example_model)
rstan::get_stanmodel(example_model$stanfit)

to see the Stan code or look at it on GitHub. However, it was not intended to be read by humans and is not particularly readable due to the #include statements and the large number of options supported.

Ben Goodrich
  • 4,870
  • 1
  • 19
  • 18
  • Exactly what I was looking for. I'm aware that the models in rstanarm are not intended to be human readable, it's more for learning than for practical use. – snaut Nov 26 '18 at 23:10