Using rstanarm to learn how to write stan programs

I’m assuming that rstanarm writes stan programs in the background. I would like to view that code to help learn how to write my own stan models. Is there a way to extract the stan model code from rstanarm?

1 Like

Rstanarm code is highly optimized and glued together. You’re better off looking at the case studies.

But you could look code generated by brms. It’s not always using the most recent prior recommendations (e.g. for GPs), but it produces code which can be used to learn many types of models.

2 Likes

The make_stancode() function in brms looks like exactly what I wanted. Thanks!