bayesplain.priors.RatePrior

class bayesplain.priors.RatePrior(shape, exposure=0.0, name='custom', rationale='')[source]

A Gamma prior on a rate of events per unit of exposure.

Read the two numbers as data you pretend to have seen already: shape events over exposure units of watching. The presets set exposure to zero, which carries no information about how large the rate is – no units, so nothing to get wrong – and leaves only the small shape term, which matters when events are rare.

Variables:
shape : float

Worth this many events.

exposure : float

Worth this much exposure, in the same units as the data. Zero gives an improper prior, which is fine for estimation but cannot be drawn.

name : str

Short label used in printed output.

rationale : str

Plain-English statement of what this assumption commits you to.

Methods

dist()

Return the prior as a frozen scipy distribution, or None.

dist()[source]

Return the prior as a frozen scipy distribution, or None.

An improper prior (exposure == 0) has no density to draw, so plotting code skips the prior layer for the presets.

exposure = 0.0[source]
property label[source]

Name and parameters together, for printing in a summary table.

name = 'custom'[source]
property prior_mean[source]

Mean rate under the prior; infinite when the prior is improper.

rationale = ''[source]
shape[source]