I noticed that rstan (2.14 and 2.15) does report those numerical issues like sigma’s being 0 or so, but it does not report if a divergent transition happened. I only get these reported when looking into the get_sampler_params object.
Warning messages:
1: There were 13 divergent transitions after warmup. Increasing adapt_delta above 0.8 may help. See
http://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup
2: There were 70 transitions after warmup that exceeded the maximum treedepth. Increase max_treedepth above 10. See
http://mc-stan.org/misc/warnings.html#maximum-treedepth-exceeded
3: There were 4 chains where the estimated Bayesian Fraction of Missing Information was low. See
http://mc-stan.org/misc/warnings.html#bfmi-low
4: Examine the pairs() plot to diagnose sampling problems
Good, but then how can I get this output (for a single chain):
The following numerical problems occurred the indicated number of times on chain 1
count
Exception thrown at line 251: Exception thrown at line 117: Max number of iterations exceeded (1000) 9
And then looking into the output of the sampler params, I get:
So how are things being counted? I thought whenever a divergent=1 occurs in the sampler parameters, then this is a divergence. Apparently this is not reported as such.
And as we are at it: A numerical problem like sigma’s hitting 0 or the ODE integrator failing due to reaching the maximal number of steps - how are these counted in rstan?
When I do that then I get the warning I was expecting:
> rstan:::throw_sampler_warnings(pk_fit_1cmt_ode_cp_par)
Warning messages:
1: There were 3 divergent transitions after warmup. Increasing adapt_delta above 0.7 may help. See
http://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup
2: Examine the pairs() plot to diagnose sampling problems
But this does not get displayed when the chain finishes to sample. To make sure, here is my session info:
> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Sierra 10.12.4
locale:
[1] de_CH.UTF-8/de_CH.UTF-8/de_CH.UTF-8/C/de_CH.UTF-8/de_CH.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] cOde_0.2.2 rstan_2.15.1 StanHeaders_2.15.0-1
[4] ggplot2_2.2.1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.10 codetools_0.2-15 assertthat_0.1 grid_3.3.2
[5] plyr_1.8.4 gtable_0.2.0 stats4_3.3.2 scales_0.4.1
[9] lazyeval_0.2.0 tools_3.3.2 munsell_0.4.3 compiler_3.3.2
[13] inline_0.3.14 colorspace_1.2-6 gridExtra_2.2.1 tibble_1.2
>