bayesplain.core.intervals.hdi_from_draws

bayesplain.core.intervals.hdi_from_draws(draws, level=0.95)[source]

Highest-density interval from posterior draws.

Finds the shortest window that contains level of the draws, by sliding a fixed-width window across the sorted sample. Valid for unimodal posteriors, which covers everything this package produces.

Parameters:
draws : array_like

Posterior draws.

level : float, default 0.95

Probability the interval should contain.

Returns:

Lower and upper bounds of the shortest such interval.

Return type:

tuple of float