Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to extract stan code from rstanarm object

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.

like image 388
snaut Avatar asked Nov 26 '18 13:11

snaut


1 Answers

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.

like image 82
Ben Goodrich Avatar answered Oct 21 '22 06:10

Ben Goodrich