bayesplain.priors.from_previous_period

bayesplain.priors.from_previous_period(events, exposure)[source]

Build a rate prior from an earlier period’s count.

Treats the earlier period as data observed under the Jeffreys prior, giving Gamma(0.5 + events, exposure). As with from_previous_study(), the strength of the assumption is legible: a prior period of three years is worth three years, no more. Discount it yourself – by passing a fraction of the exposure and events – if you think the rate has drifted since.

Parameters:
events : int

Events in the earlier period.

exposure : float

Exposure in the earlier period, in the same units you will use for the new data.

Returns:

The resulting prior.

Return type:

RatePrior

Examples

>>> from_previous_period(events=30, exposure=5.0).prior_mean
6.1