What is the best way to distribute Stan function definitions?

I’ve written some Stan functions that implement various probability distributions which are not built into Stan. I’ve emailed them to my colleagues and they are using them in a variety of different models. However, it’s tricky to keep everyone up-to-date as I fix bugs and add new features. Therefore, I’ve created an R package that contains an R function for each density function that returns a string containing the Stan code. This is nice as I can also include the R version of each density function in the same package and easily test they produce the same results.

However, I feel like there must be a better way of distributing snippets of Stan code. Is there a better way of doing this or any existing examples I can look at for inspiration?

I have looked at rstanarm and brms, but they are doing something more complex than what I hope to achieve. I don’t want to create or distribute full models. I just want to make individual function definitions available to people.

1 Like

@spinkney has a repo which I think would be a great place for those.

2 Likes