How to use this calculator
Update a binomial success probability with a beta prior, including posterior mean, variance, equal-tail credible bounds, and probability above a threshold.
- Enter Observed successes, Observed trials, Prior alpha, Prior beta, then complete the remaining labeled fields. Match the units shown beside each field and review the result together with the assumptions below.
- Read the worked example below to check the expected input format and result.
- Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Beta binomial posterior credible interval explained
A beta prior updated with binomial successes and failures gives a beta posterior. This page reports its mean, variance, equal-tail credible interval, and probability above a chosen threshold.
Inputs, symbols, and units
s— Observed successes- Whole count of successes among n observed Bernoulli trials. It cannot exceed n. Enter a whole number.
n— Observed trials- Total observed Bernoulli trials, including successes and failures. Zero trials returns the prior. Enter a whole number.
a— Prior alpha- Positive beta prior shape α. Together with β it describes the prior distribution of the success probability.
b— Prior beta- Positive beta prior shape β. It is not a scale or an observed failure count.
level— Credible probability- Probability coverage for the labeled interval, expressed as a fraction such as 0.95 rather than 95. The article distinguishes confidence from posterior credibility.
q— Probability threshold- Probability threshold from zero to one for the posterior event p>q.
Formula and method
α′=α+s; β′=β+n−s; E(p)=α′/(α′+β′); Var(p)=α′β′/[(α′+β′)²(α′+β′+1)].
Multiplying a Beta(α,β) prior by a binomial likelihood gives another beta distribution. Invert its CDF at the two equal-tail probabilities for the credible interval. The tail probability above q is one minus the posterior beta CDF at q.
A worked scenario
Observed successes = 17; Observed trials = 25; Prior alpha = 2; Prior beta = 3; Credible probability = 0.95; Probability threshold = 0.5.
- Posterior mean probability: 0.63333333
- Equal-tail credible lower bound: 0.45669427
- Equal-tail credible upper bound: 0.7931313
- Posterior probability above threshold: 0.93197703
- Posterior variance: 0.0074910394
- Posterior alpha: 19
- Posterior beta: 11
Seventeen successes and eight failures update Beta(2,3) to Beta(19,11). The posterior mean is 19/30 rather than the raw observed rate 17/25.
Assumptions and edge cases
Independent exchangeable Bernoulli trials with one fixed success probability. The interval is conditional on the chosen prior and model. Bounds are equal-tail rather than highest-posterior-density. Numerical inversion uses floating-point incomplete beta functions.
Reading the outputs
The threshold result is a posterior probability about p. Variance is on the squared probability scale; it is not the predictive variance of a future count.
Frequently asked questions
Can I use zero trials?
Yes. With zero successes and trials, the posterior equals the prior.
Is this a Wilson confidence interval?
No. It is a Bayesian interval conditional on the beta prior.
Do I need separate mean and variance pages?
No. Both are included here with the same posterior parameters.
How do I use the Beta binomial posterior credible interval calculator?
Enter Observed successes, Observed trials, Prior alpha, Prior beta, then complete the remaining labeled fields. Match the units shown beside each field and review the result together with the assumptions below.
What is a worked example of Beta binomial posterior credible interval?
Observed successes = 17; Observed trials = 25; Prior alpha = 2; Prior beta = 3; Credible probability = 0.95; Probability threshold = 0.5. Posterior mean probability: 0.63333333 Equal-tail credible lower bound: 0.45669427 Equal-tail credible upper bound: 0.7931313 Posterior probability above threshold: 0.93197703 Posterior variance: 0.0074910394 Posterior alpha: 19 Posterior beta: 11 Seventeen successes and eight failures update Beta(2,3) to Beta(19,11). The posterior mean is 19/30 rather than the raw observed rate 17/25.
Method reference: SciPy beta distribution definition.
Read our calculation methodology.