Is it possible to extract a .stan model from a glm defined using rstanarm?

Hi, I am trying to follow along with this but would ideally like to specify the models manually as Stan files so I can do a similar analysis in Julia using Stan.jl. Is there an easy way to extract .stan files from models defined using the rstanarm package, I can manually translate but it would save a lot of time as I go through the examples.


Not that I know of. You might want to use brms, which has a similar structure to rstanarm. brms allows you to dump out the Stan model code.

You could try

m <- stan_lm(mpg ~ disp, mtcars, prior = R2(location = 0.4, what = "median"))

By the way, if there is more interest in Stan.jl, please let us know, as we’ve been having a lot of conversations recently about improvements on the interfaces, so it would be good for Julia to be part of this.