R package using cmdstanr

Has anyone written a package that uses cmdstanr models inside it?

I was writing a little package to test some things and I could use an example of how to organize things (how to handle the model compile, how to set up tests, etc. etc.).

Pinging a few people who might know @jonah @mike-lawrence @rok_cesnovar

1 Like

Brms and the rethinking package use cmdstanr, but those build models on the fly to compile them so that is probably not a good comparison. I have seen some other packages like EpiNow2 that either use cmstanr already or are transitioning.


@wlandau has a package combining his targets system with Stan for simulation/validation: https://github.com/wlandau/targets-stan


Thanks for the plug, @mike-lawrence. That’s actually more of a workflow archetype though. I’m also thinking about a pipeline package for Stan models (basically tarchetypes for cmstanr) but that won’t have any actual models in it.

@bbbales2 I have been wondering about this too, and I think it is related to Cmdstanr and R packages with precompiled models.


OOo, this is useful information, thanks!

FYI, I just released the dev version of a new package called stantargets (announced here).