Summarize inference data (HDI)

hdi_3% / hdi_97%.

A simple example that shows the issue:

import arviz as az
import pymc as pm

with pm.Model() as model:
    pm.Exponential('exp', lam=.01)
    trace = pm.sample(10000)

print(az.summary(trace))

Output:

       mean      sd  hdi_3%  hdi_97%  mcse_mean  mcse_sd  ess_bulk  ess_tail  r_hat
exp  100.48  99.953   0.007  280.653      0.805    0.583   10419.0    9841.0    1.0

But there isn’t 3% of the posterior below 0.007, there is almost 0% of it. 3% of the posterior is under about 3.046. And at the other end of the interval, it’s about 94% of the posterior that’s under 280.653, not 97%. 97% is under ~350.66.

It’s correct as an HDI, but there aren’t 3% of the posterior on each side, contrary to what the names of the columns imply; there is 0% on the left and 6% on the right.