bayesplain.core.gamma_poisson.posterior

bayesplain.core.gamma_poisson.posterior(events, exposure, a=0.5, b=0.0)[source]

Exact Gamma posterior for one rate.

Parameters:
events : int

Events counted.

exposure : float

Exposure over which they were counted.

a : float, default 0.5

Prior shape: worth a events.

b : float, default 0.0

Prior rate parameter: worth b units of exposure. Zero gives an improper prior that is still fine for estimation.

Returns:

Gamma(a + events, b + exposure), as a frozen scipy distribution.

Return type:

scipy.stats.rv_continuous_frozen

Examples

>>> post = posterior(12, 4.0)
>>> round(float(post.mean()), 3)
3.125