Hello all,
I am writing this question to have a discussion on very different results I obtained using two different Stan parametrisation of the same model. I would have thought that my STAN models provide the same results, but unfortunately no. I am also comparing the results obtained with a similar parametrisation with JAGS (JAGS is not dead, right ? :-) ) and with beta-expectation tolerance intervals obtained analytically, using Robert Mee 1984 paper (Mee R.W., Beta-expectation and beta-content tolerance limits for balanced one-way ANOVA random model. Technometrics. 1984;26:251-254.). Notice I am not taking the results of Mee as granted (there are some approximation), but I know by experience that they are a good approximation of the tolerance intervals.
A little bit of background: the target is to obtain the posterior distribution of the parameters and the beta-expectation tolerance interval using MonteCarlo estimation (which, in this case, are the prediction interval obtained by integrating posterior parameters into the model/likelihood). Under flat prior, I am (well,... I was) confident that the posterior modes must be similar to the maximum likelihood estimators, and the beta-expectation tolerance interval of Mee's paper is the same than the MC-computed one.
Next, the data set is one of these that provides difficulties to maximum likelihood estimator, with a negative variance component for the random effect (and thus, lme() or SAS/PROC MIXED would put the estimate to 0).
Here is the results with the first part of the code (attached), really just translating the ANOVA 1 random model into Stan (Note also I obtained similar results when running the ANOVA models obtained with brms or rstanarm package, for what's worth. I am running Stan 2.9.0-3 on Mac OS X 10.10.5 and R 3.2.2, but also, similar results have been obtained under Windows 7 (Stan 2.9.0 on R 3.2.2).



Observation : posterior mode are well achieved. Variability of b0 (the fixed intercept) is way too big. Prediction interval (beta-exp. tolerance interval) is way too large (right figure, red). Actually the HPD on b0 is already larger than the tolerance interval obtained using Mee's paper (blue).
And here are the results obtained with the parametrisation in terms of precision (as one would do with JAGS, for instance). Note that JAGS chains and posterior densities looks better, but predictive interval is similar using JAGS.


Observation: Chains and densities look not good except with stronger prior (which also give better running time). But interval is more plausible (In the sense that I would buy it, if I could not see all the other results). Notice that similar results are obtained with JAGS (model attached at the end of the script, but not the running environnement (what we have is sufficient for the discussion and that's already big I think).
So, my problem is that given similar data, I would except different coding to provide different effective sample size, different qualities of results, but not "different" results... And of course I don't know what is preferable, but I have "frequentist" tools, well-know, used and verified that tell me that none of the solution I obtained is good.
So, the code is fully standalone, so please tell me if you observe similar results, if you see that I am making a stupid coding mistake, or if this should be seen as a bug or something to improve. I admit I tried to run it with older version of Stan but I did not succeed to install them properly so I gave up. Can someone run that under rstan 2.4 or something ?
Thanks in advance !
Pierre