You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is good to see another package on CRAN making use of Stan! But for packages like bmlm that offer a fixed set of Stan models, it is preferable to compile them when the package is built for several reasons:
The vast majority of users --- who are installing binary packages from CRAN for Windows or Mac --- would not need to first install a C++ toolchain in order to use bmlm. Only people who install packages from source would need the C++ toolchain and they probably already have one.
Users would not have to wait 30 -- 60 seconds for the models to start running.
It is somewhat more robust to updates to StanHeaders on CRAN.
The easiest way to do this is to call rstan::rstan.package.skeleton("skeleton") when the working directory is /tmp or something and copy the contents of /tmp/skeleton into your local clone of bmlm. This is how the rstanarm, beanz, and eggCounts R packages work. Ultimately, there will be a list called stanmodels in the bmlm NAMESPACE that you can extract a precompiled stanmodel from to pass to rstan::sampling.
Also, your two .stan files are almost identical except for a couple of lines, so they are good candidates to utilize the #include ... mechanism of rstan::stanc_builder, which is automatic for packages created by rstan::rstan.package.skeleton. You can put .stan files into inst/chunks that have all the common pieces and then put #include "piece.stan" in the appropriate place in your Stan programs and it will paste inst/chunks/piece.stan there. This way, there are fewer mistakes when you change something in one place and forget to change it in the other place(s). See https://github.com/stan-dev/rstanarm/blob/master/exec/polr.stan for one example of how to do this.
The text was updated successfully, but these errors were encountered:
It is good to see another package on CRAN making use of Stan! But for packages like bmlm that offer a fixed set of Stan models, it is preferable to compile them when the package is built for several reasons:
The easiest way to do this is to call
rstan::rstan.package.skeleton("skeleton")
when the working directory is/tmp
or something and copy the contents of/tmp/skeleton
into your local clone of bmlm. This is how the rstanarm, beanz, and eggCounts R packages work. Ultimately, there will be a list calledstanmodels
in the bmlm NAMESPACE that you can extract a precompiledstanmodel
from to pass torstan::sampling
.Also, your two .stan files are almost identical except for a couple of lines, so they are good candidates to utilize the
#include ...
mechanism ofrstan::stanc_builder
, which is automatic for packages created byrstan::rstan.package.skeleton
. You can put .stan files intoinst/chunks
that have all the common pieces and then put#include "piece.stan"
in the appropriate place in your Stan programs and it will pasteinst/chunks/piece.stan
there. This way, there are fewer mistakes when you change something in one place and forget to change it in the other place(s). See https://github.com/stan-dev/rstanarm/blob/master/exec/polr.stan for one example of how to do this.The text was updated successfully, but these errors were encountered: