PyStan diagnostics

It seems that writing to a diagnostics file hasn’t quite been implemented for PyStan yet, so is there another way to get diagnostics about the sampler?

Raw values you can get with


Next release has pystan.diagnostics. It contains functions that will hint you if you have a problem with your model.

Is there a guide on how to interpret the statistics it returns? My divergence array is full of ones for instance, is this a count or a boolean? (I’m guessing it is bad either way).

This doesn’t use the new build in functions, but explains some of the interpretation of the diagnostics, More on divergences with corresponding R code (which is sufficiently easy to translate to Python) can be found at

Is there any plan to integrate the stan_utility into PyStan?

It’s already merged.


To get it before 2.18 is released install from git

pip install git+

What @ahartikainen. Note that I update the stan_utility functionality from time to time so the version in my case studies will always be the most up to date.

Yeah, sorry, I didn’t check if it was updated.

Oh, no worries. There hasn’t been any substantial change yet, but there will be at some point. I was just making the point that the diagnostics are still a matter of research and hence evolving, so while we’ll strive to keep the versions in the interfaces up to date the most advanced versions that I recommend will be in the case studies.