Rstan, Cmdstanr, Brms and Rstanarm

Hi all,

Is there any detailed documentation about the pros/cons of Rstan, Cmdstanr, Brms and Rstanarm? In my understanding in Rstan/Cmdstanr you need to write you complete Stan code but in Rstanarm/Brms you could use some built-in functions, but I am curious about more details.

By the way I am a Windows user.


1 Like

Yeah for rstan and cmdstanr you write the Stan code, which gives you the most options (you can fit any model Stan is capable of fitting). There are also differences between rstan and cmdstanr that are summarized here:

For rstanarm and brms you don’t need to write the Stan code yourself, which makes it easier to use Stan but does limit the modeling options you have compared to writing your own Stan code. rstanarm and brms both have advantages and disadvantages relative to each other also. rstanarm’s biggest advantage is that the models come pre-compiled, which means that you don’t need to set up a C++ toolchain and the models run immediately when you call the R functions. brms requires you to have a functioning C++ toolchain and compiles the models when you call the R function. So pre-compiling the models is an advantage for rstanarm, but it’s also a limitation: it limits the number of the models in the package. Because it writes Stan code for you on the fly, brms is able to support many more models than rstanarm, including some that are pretty advanced. So that’s a big advantage of brms (it can really fit a ton of different models!). Otherwise the packages are pretty similar and support basically the same post-processing functionality.

1 Like