arviz.hpd

arviz.hpd(ary, credible_interval=0.94, circular=False)[source]

Calculate highest posterior density (HPD) of array for given credible_interval.

The HPD is the minimum width Bayesian credible interval (BCI). This implementation works only for unimodal distributions.

Parameters
xNumpy array

An array containing posterior samples

credible_intervalfloat, optional

Credible interval to compute. Defaults to 0.94.

circularbool, optional

Whether to compute the hpd taking into account x is a circular variable (in the range [-np.pi, np.pi]) or not. Defaults to False (i.e non-circular variables).

Returns
np.ndarray

lower and upper value of the interval.