Guidelines for rstan-based packages

Oops yeah meant to point to this particular issue

Also what kind of survival models are you working on? We’ve been wanting to
get survival models (essentially a stan_survreg function similar
to R’s survreg) into rstanarm for a while but haven’t had the time.


So far I have multi-level weibull and weibull-uniform mixture models. It’s a setting where a whole range of quantiles needs to be accurately represented by the model and you need to avoid noisy estimates for small units without much data so multi-level models are really a good match. The multi-level part works well but I need something more flexible than the Weibull-uniform mixture for dealing with the tail.

Writing or generating all-doubles wrappers makes the most sense if I’m going to avoid expose_stan_functions. I did look at the code generator and the changes needed in the code are pretty minimal but I haven’t looked at how a flag for all-doubles would need to be plumbed through the code generator.

You shouldn’t have to use expose_stan_functions. Just write your C++ functions in the src/ directory, export them to R in the NAMESPACE, and then in the Stan programs declare those functions in the functions block without defining them. It works now if you install a StanHeaders that is based on the develop versions of math and stan.

Let me know if you need help. It needs to drop the
tempate type declarations and replace all their uses
with “double”. It’ll leave residual constant reference
arguments, but that shouldn’t be a problem in this context.

  • Bob

I’ll start a separate thread about this, if you don’t like what I propose there it would be good to do a call/skype to resolve it.

Quick question: there aren’t any tests currently for the generate_function* functions so I have no examples to go on. My first thought about how to create tests for the generate_doubles_function tests is to write the out stream to a stringstream and count matches to expected substrings. Is that what you would do?

Ok I’m going to post these guidelines on stan-users soon. Should I put them elsewhere as well? On somewhere maybe?

A wiki? I feel like the wiki is way out of control and I wish there was a separate wiki.

If we actually wanted to solve these problems, we could do one of a number of things:

  • just keep on with how we’re managing it
  • create a new repo (cause there are no organization level wikis) that holds a wiki
  • create a new repo that we point to. It’ll be .md files for editing and it won’t be just a normal wiki. It’ll be a website.


I agree that the stan-dev/stan wiki is wrong for something that’s basically targeting technical users. I like the option, but that’s mostly because I find the github wikis hard to navigate.

I don’t think the wiki is necessarily the wrong place. I just think we need to organize a little better. Bob’s already taken a first pass. We need to take subsequent passes to get it in shape.

@jonah, I’d suggest doing whatever is easy to implement.

I’m also planning on putting the guidelines in a CRAN vignette so another
option is to post on stan-users for now and then when the vignette is up on
CRAN we could just put a link to the CRAN vignette somewhere instead of
hosting our own version. That way all changes would also only need to be
made in one place.