Stan for Bayesian Hierarchical Models


Hi All,

A paper, essentially on using Stan for non-linear/non-Gaussian hierarchical models, is now online at:
The paper is very much in draft form, and any suggestions and comments are very much welcomed.

The paper aims to overcome problems with applying (Euclidian metric) HMC to hierarchical models. The methodology is easily implemented in Stan, and produces potentially large speedups / improved robustness for such models.

The idea is to introduce an explicitly (bijective) computable re-parameterization of the model, in such a manner that the re-parametererized model is easily sampled using Stan. The re-parameterization utilises both information from priors and observations in order to make the sampling problem as easy as possible. The method has similarities with a class of Riemann manifold HMC methods, but allows fully explicit, and thus computationally fast, sampling.


Many regressions: unique (stable) function for exponential and s-shape behaviour

tagging @betanalpha



You seem to be maxing n_eff at N. RStan in github has fixed n_eff computation which can give n_eff larger than n (possible with antithetic Markov chain with negative odd lag correlations). For constant information we have seen n_eff even 2.5 times N. It would cool if you could estimate also the fixed n_eff values.


I’ll try to work out how build the package from github to get updated n_eff computations. How long is it until the updated n_effs will be in the main release?


You can also just get the updated monitor.R an then you don’t need to install the full package.

The next CRAN release will have the updates, and I think the plan is to have release before StanCon 2018 Helsinki.


I tried the updated n_eff / ess routines for some of the problems, but in those cases the first order (and all the other as well) autocorrelation was essentially zero, i.e. no over-relaxation going on, and thus the results remained the same.
Anyway, I will surely redo all of the computations once the latest version is on CRAN when revising the paper. Thanks again for suggesting this.


CmdStan 2.18 is already out. @bgoodri is working on RStan 2.18 now. I don’t know if there’s a timeline for PyStan 2.18 (I mainly work down at the library and language level).

We may release a CmdStan 2.19 before then, but it will depend on how many more bug fixes and features work their way through the system. It will definitely happen if the GPU Cholesky factorization lands in the math library before then.