bayesplain.priors.from_previous_study

bayesplain.priors.from_previous_study(successes, n)[source]

Build a prior from an earlier study’s counts.

Treats the earlier study as data observed under a flat prior, giving Beta(1 + successes, 1 + failures). This is the honest way to say “we already know something about this rate”, and it makes the strength of the assumption legible: a prior study of 80 cases is worth 80 cases, no more.

Parameters:
successes : int

Successes in the earlier study.

n : int

Trials in the earlier study.

Returns:

The resulting prior.

Return type:

BetaPrior

Examples

>>> from_previous_study(successes=12, n=80).prior_mean
0.15853658536585366