Beta-Binomial Batch Risk Calculator

Use one uncertain event probability across a batch, or compare with a fixed probability equal to its mean. Enter integer Beta shapes and optionally update them with observed outcomes. Compare count variance, exact probabilities, and allowance checks.

Posterior predictive comparison

Compare batch risk when trials share an uncertain rate

Compare the beta-binomial model and a fixed-rate binomial at the same mean event probability.

Future batch and prior

Optional update. Use 0 for none.

Optional update. Use 0 for none.

The largest upper-tail probability you want to allow.

Only the fixed-rate model meets the tail allowance.

Chance of at least 4 events

Shared rate

18.42105263%

Above allowance

Count variance 2.909091

Fixed rate

12.08738816%

Below allowance

Count variance 1.6

Active rate distribution
Beta(2, 8)
Mean rate in both models
20%
Mean event count
2
Shared-to-fixed variance ratio
1.818182×
Shared rate, exactly 4
9.2879257%
Fixed rate, exactly 4
8.8080384%
Shared rate, at least 4
18.42105263%
Fixed rate, at least 4
12.08738816%
Exact probabilities for this count
Shared exact count
30/323
Fixed exact count
172032/1953125
Shared upper tail
7/38
Fixed upper tail
1180409/9765625
Probability by event count
Shared-rate and fixed-rate probability comparisonShared-rate chance of at least 4 events is 18.42105263%. Fixed-rate chance is 12.08738816%. The tail allowance is 15%.Outcome probability30.2%0Event count10

Violet is the shared-rate model and green is the fixed-rate model. The shaded region starts at the entered threshold.

The shared model uses one uncertain event rate for the whole batch. Use observations that inform that same rate. The two predictions depend on the entered model and data.

Export the batch probability audit

The CSV records both exact distributions, all upper tails, and the allowance check.

View CSV text

How to use this calculator

  1. Enter the number of future trials and the minimum event count to include in the upper tail.
  2. Enter the two positive prior shapes. Optionally add observed event and non-event counts that inform the same batch rate.
  3. Set the maximum acceptable upper-tail probability, then compare model outcomes and count variance.
  4. Use the count slider and both chart views to inspect exact counts and tails. Export the full exact distributions if needed.

The Formula

The mathematical logic powering this calculation is:

Let the same latent event probability p apply to all future trials of the batch. Conditional on p, the trials are independent Bernoulli draws. Model uncertainty in p with Beta(α,β). If observed outcomes inform that same p, update the beta shapes to a = α + observed events and b = β + observed non-events before predicting the separate future trials. Leave both observation inputs at zero to use the prior directly.

For x events among n future trials, the beta-binomial mass is C(n,x) × (a)ₓ × (b)ₙ₋ₓ / (a+b)ₙ, where (v)ⱼ = v(v+1)…(v+j−1) and (v)₀=1. The mean-matched fixed-rate comparator uses the binomial with p = a/(a+b). The models have the same expected event count np. Their variances are np(1−p)(a+b+n)/(a+b+1) and np(1−p) respectively. The shared-rate model induces pairwise correlation 1/(a+b+1) between distinct trials from the batch.

The upper tail P(X ≥ k) includes the mass at k. The worksheet sums the exact rational masses and compares the result to the entered allowance. Equality meets the allowance. Larger variance may raise or lower a particular tail, depending on the threshold. A Poisson–binomial model instead uses independent trials with individual fixed probabilities. A finite-lot hypergeometric model uses sampling without replacement from a lot with a fixed number of events.

Use 1–120 future trials, an integer threshold from zero through n, prior shapes from 1–500, and 0–5,000 per observed count. Enter the allowance from 0% through 100%, with at most eight decimal places. Chart probabilities are rounded for display, with exact fractions available for each count and in the CSV. The result is a conditional prediction under the model and the entered shapes and observations.

Worked Example

If you input:

  • Future trials: 10
  • Event threshold: At least 4
  • Prior: Beta(2, 8)
  • Tail allowance: 15%

Result:

The shared-rate tail is 7/38, about 18.4211%. The fixed-rate tail at the same 20% mean is 1180409/9765625, about 12.0874%. The fixed-rate model meets the 15% allowance. The shared rate model has count variance 32/11 compared with 8/5.

Frequently Asked Questions

When is a shared event rate appropriate?

Use it when there is an uncertain common rate for the future batch. The Bernoulli outcomes are independent given that rate. After averaging over the uncertainty, they are positively associated.

What changes when I enter observed events and non-events?

The counts are added to the respective prior shapes. Predictions use that posterior and compare with a fixed rate at its mean. Enter recorded counts from observations that inform the same rate and keep them separate from future trials.

Does greater variance always increase the upper tail?

The threshold matters. A spread-out count distribution can have a smaller probability above a low threshold and a larger probability in a far tail.

What happens at the entered allowance?

The calculator compares exact fractions. Exactly equal probability shows At allowance. A value above the entered maximum shows Above allowance even if rounding would look similar.

Similar Calculators