bayesplain.frequentist.two_rates

bayesplain.frequentist.two_rates(events, exposure, estimand='ratio', level=0.95)[source]

Exact conditional test comparing two Poisson rates.

Conditional on the total number of events, the count in group 2 is binomial, with success probability equal to group 2’s share of the exposure if the rates are the same. That turns the comparison into an exact binomial test, with no approximation and no dependence on how large the rates are.

Parameters:
events : array_like

Two event counts, [y1, y2].

exposure : array_like

Two exposures, [t1, t2].

estimand : {'ratio', 'difference'}, default 'ratio'

What the interval is on. The ratio gets the exact conditional interval; the difference gets a Wald interval.

level : float, default 0.95

Confidence level.

Returns:

The conventional result, oriented as group 2 relative to group 1.

Return type:

FrequentistTwin