bayesplain.core.intervals.interval

bayesplain.core.intervals.interval(draws=None, level=0.95, kind='hdi', dist=None)[source]

Posterior interval, taken analytically when that is possible.

If a frozen scipy distribution is supplied, the bounds come from it – the quantile function for an equal-tailed interval, a one-dimensional optimisation for a highest-density one – and carry no Monte Carlo error at all. Otherwise they are estimated from draws.

Parameters:
draws : array_like, optional

Posterior draws. Required unless an ETI is requested with dist.

level : float, default 0.95

Probability the interval should contain.

kind : {'hdi', 'eti'}, default 'hdi'

Highest-density or equal-tailed.

dist : scipy.stats.rv_continuous_frozen, optional

Analytic posterior, when one exists.

Returns:

Lower and upper bounds.

Return type:

tuple of float