Beta Binomial Prediction
Compare a beta-mixture predictive count with a binomial count having the same mean probability.
By Riano · Published · Updated · Report a correction
Beta Binomial Prediction
Mixture Models and Overdispersion
When modeling a series of Bernoulli trials, a standard binomial distribution assumes the success probability is exactly known and identical across all trials. In many real-world predictive scenarios, the underlying probability itself is uncertain and governed by a prior distribution, often modeled with a Beta distribution. The Beta-Binomial distribution emerges when we marginalize out this uncertain probability. The shared uncertainty in the parameter introduces positive correlation among the trials, leading to "overdispersion" — greater variance than a binomial model with the equivalent mean probability would predict.
Analytic Setup and an Independently Worked Example
Let a shared success probability P follow a continuous Beta(a, b) distribution. Conditionally on P = p, let the count K of successes in n trials follow a Binomial(n, p) distribution. Integrating out p gives the marginal probability mass function for K = k:
where B is the Beta function. The mean of this predictive distribution is n * a / (a + b). Its variance is n * a * b * (a + b + n) / ((a + b)2 * (a + b + 1)), which for n greater than 1 exceeds the variance of a simple Binomial plug-in distribution evaluated at the expected probability p = a / (a + b).
Consider an original worked example where a = 2, b = 3, and n = 3.
- The expected success probability is
a / (a + b) = 2 / 5 = 0.4. The expected number of successes isn * (2/5) = 3 * 0.4 = 1.2. - The Beta-Binomial variance is
(3 * 2 * 3 * (2 + 3 + 3)) / ((2 + 3)2 * (2 + 3 + 1)) = (18 * 8) / (25 * 6) = 144 / 150 = 0.96. - For comparison, a standard Binomial with n = 3 and p = 0.4 would have variance
3 * 0.4 * 0.6 = 0.72. The Beta-Binomial is distinctly overdispersed due to the uncertainty in P. - We can calculate the specific probability of observing exactly k = 2 successes. We need B(2+2, 3+3-2) = B(4, 4) and B(2, 3). For integers, B(x, y) = (x-1)! (y-1)! / (x+y-1)!. So B(4, 4) = (3! 3!) / 7! = (6 * 6) / 5040 = 1 / 140. Also B(2, 3) = (1! 2!) / 4! = 2 / 24 = 1 / 12.
- The PMF is C(3, 2) * (1 / 140) / (1 / 12) = 3 * (12 / 140) = 36 / 140 = 9 / 35 ≈ 0.2571.
Interactive Exploration
You can test these properties interactively in the Beta Binomial Prediction module.
- Set Future trials n to
4, Shape a to1and Shape b to1. This represents a uniform prior on the success probability. Observe the uniform Beta-Binomial PMF (probability 0.2 across all counts) compared to the peaked Same-Mean Binomial. Note the Beta-Binomial variance is 2.0 while the Binomial variance is 1.0. - Change Shape a to
2and Shape b to2. This creates a prior centered at 0.5. The Beta-Binomial variance drops to 1.6, but is still greater than the Binomial's 1.0. - Set Future trials n to
3. The predictive horizon changes, and the possible counts range from 0 to 3. - Set Success count k to
3to probe this specific outcome. The exact probability (PMF at k=3) will update. If you increase k beyond n (e.g., k=4), the PMF correctly evaluates to 0.
Model Limitations
The Beta-Binomial model assumes that a single unobserved probability P governs all n trials simultaneously, rather than drawing a fresh independent p for each trial. If the probability were re-drawn independently for each trial, the marginal count distribution would simply revert to a Binomial distribution with p = a / (a + b).
Additionally, this analytical model assumes the prior follows specifically a Beta distribution, making it a conjugate prior. Other bounded distributions on [0,1] could be used for the uncertainty in P, but they would not result in this exact, closed-form predictive PMF. The positive shape bounds are small integers (1 to 4). On the declared trial grid, factorial products stay within exact safe-integer range, while their ratios and displayed probabilities use ordinary floating-point arithmetic. At n = 0 or n = 1 the predictive and same-mean binomial variances are equal.
References and Further Reading
For more information on the Beta-Binomial distribution, you can refer to the following official documentation:
- SciPy Community (2026). scipy.stats.betabinom. Official SciPy reference documentation on the Beta-Binomial distribution and its probability mass function derived from the Beta function.
Experience it interactively
Adjust parameters, observe in real time, and build deep intuition with Riano’s interactive Beta Binomial Prediction module.
Try Beta Binomial Prediction on Riano →