stan-dev / cmdstanr

CmdStanR: the R interface to CmdStan
https://mc-stan.org/cmdstanr/
Other
143 stars 63 forks source link

Adding a `sampling_GQ` argument to `sample()` (feature request & design discussion) #428

Open mike-lawrence opened 3 years ago

mike-lawrence commented 3 years ago

Similar to the FR to have a warmup_GQ argument, it would be useful to have an argument to turn on/off the running of the GQ section during sampling. For example, when you know that GQ will take up time in compute/IO and you just want to get the model sampling first. I've also seen users that explicitly want to always do the GQ separately, but still want the simplicity of having a GQ section in the same stanfile as the model. While there are hacks to achieve this whereby that section is commented out, etc, it seems trivial to add to cmdstanr properly, especially if we go forward with the warmup_GQ argument anyway.

In contrast with the warmup_GQ=FALSE default I recommended in that FR, I think the default for sampling_GQ should be TRUE.

jgabry commented 3 years ago

I've also seen users that explicitly want to always do the GQ separately, but still want the simplicity of having a GQ section in the same stanfile as the model.

Yeah this is related to https://github.com/stan-dev/stan/issues/2934. In general I don't think standalone generated quantities should require a separate Stan file, but I think that's something that would be preferable to implement for all Stan users not just CmdStanR users. That said, if for some reason it's decided that this won't be changed in Stan/CmdStan then we could potentially do it just in CmdStanR because I definitely agree this would be useful.