Beta-Binomial Conjugate Prior Bayesian Posterior & 95% Credible Interval Calculator

Update Beta(α₀, β₀) prior with binomial successes/failures for posterior mean, MAP, and 95% CI.

Bayesian Posterior Mean Beta(38, 16) 70.37 %
Maximum A Posteriori (MAP) Mode 71.154 %
Posterior Standard Deviation 6.157 %
95% Credible Half-Width (±1.96 SD) 12.068 ±%
Inputs
Try:
α₀
Prior Beta shape parameter α₀ (1 = flat uniform prior; 0.5 = Jeffreys prior).
β₀
Prior Beta shape parameter β₀.
successes
Observed binomial successes (s).
failures
Observed binomial failures (f = n − s).
Results & Graph
Bayesian Posterior Mean Beta(38, 16)
70.37 %
Maximum A Posteriori (MAP) Mode
71.154 %
Posterior Standard Deviation
6.157 %
95% Credible Half-Width (±1.96 SD)
12.068 ±%

Bayesian Posterior Mean Beta(38, 16)

Graph 1 • How the inputs feed Beta-Binomial Bayesian Update
Beta-Binomial Conjugate Prior Bayesian Posterior & 95% Credible Interval Calculator • Custom Domain Schematic (Probability Distributions & Survival Analysis) μ / Critical Cutoff (priorAlp, priorBet) Prior Alpha0: 2 α₀ • Prior Beta0: 2 β₀ BAYESIAN POSTERIOR MEAN BE 70.37 % • Maximum A Posteriori (: 71.154 % • Posterior Standard Dev: 6.157 % Eq: α_post = α₀ + s; β_post = β₀ +
Graph 2 • Bayesian Posterior Mean Beta(38, 16) as Prior Alpha0 changes (40% to 160% of current)
0 % 39.06 % 78.12 % 69.70 0.800α₀ 69.92 1.20α₀ 70.15 1.60α₀ 70.37 2α₀ 70.59 2.40α₀ 70.80 2.80α₀ 71.01 3.20α₀
Graph 3 • Prior Alpha0 and Prior Beta0 together Compares Bayesian Posterior Mean Beta(38, 16) when Prior Beta0 is shifted +25% (solid) vs. −25% (dashed).
0 % 39.24 % 78.48 % --- Prior Beta0 @ 75% 69.39 -30% 69.56 -15% 69.72 +0% 69.89 +15% 70.05 +30%
Summary: Updating Beta(2, 2) with 36 successes and 14 failures yields Beta(38, 16) with posterior mean 70.37%, MAP mode 71.15%, and approximate 95% credible band 58.3%–82.44% (normal approximation, clipped to 0–100%).
Summary: Updating Beta(2, 2) with 36 successes and 14 failures yields Beta(38, 16) with posterior mean 70.37%, MAP mode 71.15%, and approximate 95% credible band 58.3%–82.44% (normal approximation, clipped to 0–100%).
Interactive chart & math engine powered by CalculatorGraph

Formula: Beta-Binomial Bayesian Update Formula

αpost = α₀ + s
βpost = β₀ + f
PosteriorMean = αpost / (αpost + βpost)
MAP = αpost − 1αpost + βpost − 2
α_post = α₀ + s; β_post = β₀ + f; PosteriorMean = α_post / (α_post + β_post); MAP = (α_post − 1) / (α_post + β_post − 2)
  • priorAlpha0: Prior Alpha0 (α₀)
  • priorBeta0: Prior Beta0 (β₀)
  • observedSuccessesS: Observed Successes S (successes)
  • observedFailuresF: Observed Failures F (failures)

Frequently Asked Questions

Why is the posterior mean lower than my observed success rate?

Because the Beta(2, 2) prior is centred on 50% and adds the equivalent of 2 successes and 2 failures. That nudges the estimate toward the middle. With 36 out of 50, the observed rate is 72% and the posterior mean is 70.37%. The more data you have, the smaller this pull becomes, and with a flat prior the MAP matches the observed rate exactly.

What prior should I use if I know nothing?

Beta(1, 1), the flat prior, and Beta(0.5, 0.5), the Jeffreys prior, are the usual choices. With 50 trials they give posterior means of 71.154% and 71.569% for the default data, within about half a point of each other. The choice matters only when data are scarce. If you have real earlier evidence, encode it instead of using a noninformative prior.

Can alpha and beta be fractions?

Yes. They are shape parameters, not literal counts, so values such as 0.5 or 1.2 are valid, and the lower preset uses an alpha of 1.2. They must be above zero; a zero or negative prior returns an error. Successes and failures, on the other hand, must be whole numbers, since they come from counted trials, and a fractional count is rejected.

How is a credible interval different from a confidence interval?

A 95% credible interval says that, given your prior and data, the true rate has a 95% probability of lying inside. A 95% confidence interval says that the method would capture the true value in 95% of repeated experiments, which is a statement about the procedure. With weak priors and plenty of data the two intervals are often numerically similar.

Why is the credible band symmetric around the mean?

The page uses the mean plus or minus 1.96 standard deviations, which is always symmetric before any clipping at 0% or 100%. The true beta posterior is usually skewed. For the default Beta(38, 16), the exact interval is about 57.65% to 81.66%, compared with the page's approximate 58.3% to 82.44%. The difference is small here but grows large when counts are small.

Can I update the posterior again with new data?

Yes, and that is one of the attractions of the conjugate setup. Take the posterior alpha and beta, here 38 and 16, and enter them as the new prior. Then add only the new successes and failures. The result is identical to running everything at once from the original prior, so you can update batch by batch as data arrive.

What does the 6.157% posterior standard deviation mean?

It is the spread of plausible values for the true rate after seeing the data. Roughly two thirds of the posterior probability lies within one standard deviation of the 70.37% mean. It shrinks with more trials: ten times as many observations at the same rate bring it down to about 2%. It is not the variability of individual trial outcomes.

Is this the same as the beta-binomial distribution?

Related but not the same. The beta-binomial distribution describes how many successes you would expect in a future batch of trials when the rate itself is uncertain. This page reports the beta posterior for the rate. To predict future counts you would combine the posterior with the number of planned trials, which the calculator does not do.

My successes are zero. Is the result still useful?

The posterior is still valid. With zero successes the estimate leans heavily on the prior and the posterior is skewed toward zero. The page's symmetric band would dip below 0%, so it is clipped: with 14 failures and the default prior it reads 0% to 25.24%. Use the posterior alpha and beta it gives and look up exact beta percentiles, or report a one-sided upper bound instead.

When should I not use a beta prior at all?

When outcomes are not simple success or failure, when trials are not independent, or when the rate changes over time. Counts per hour, survival times and measurements on a scale need other models. A drifting rate, such as a conversion rate after a website redesign, also breaks the assumption that one fixed rate generated all the data.

Does the order of successes and failures matter?

No. The beta posterior depends only on the totals, so 36 successes followed by 14 failures gives the same Beta(38, 16) as any other sequence with those counts. That is a direct result of assuming independent trials with one fixed rate. If the order seems to matter in your data, for instance a run of failures after a process change, that assumption is probably wrong.

Beta(2, 2) plus 36 successes and 14 failures

The default starts with a mild prior, Beta(2, 2), and adds 36 successes and 14 failures from 50 trials. The update is pure addition: the successes go onto alpha and the failures onto beta, so the posterior is Beta(38, 16). Nothing else is needed for the update itself, which is why the beta and binomial pair is called conjugate.

From that posterior the page reports a mean of 70.37%, which is 38 divided by 54. The MAP, or most likely single value, is 71.154%, which is 37 divided by 52. The posterior standard deviation is 6.157%, and the 95% credible half-width is 12.068 points, giving a band from 58.3% to 82.44%.

Read in plain terms: after seeing 36 out of 50, and starting from a belief that the rate was probably somewhere near the middle, the best single estimate is about 70%, and the rate is very likely between the high fifties and low eighties. The raw success rate on its own is 72%. The prior has pulled the estimate slightly toward 50%, by less than two points.

The prior as pretend trials you already ran

The easiest way to choose alpha and beta is to treat them as imaginary earlier results. Beta(2, 2) behaves roughly like having already seen 2 successes and 2 failures. Next to 50 real trials, those 4 pretend ones carry little weight, which is why the posterior mean of 70.37% sits close to the observed 72%.

The presets show how little a small prior matters here. Dropping alpha to 1.2 gives a posterior mean of 69.925%; raising it to 3 gives 70.909%. One extra pretend success moves the answer about half a point when you have 50 real observations.

A strong prior is a different story. Beta(20, 20) is like 40 pretend trials split evenly. With the same data the posterior becomes Beta(56, 34), with a mean of 62.222% and a band from 52.26% to 72.18%. The prior now accounts for almost half of the total evidence and drags the estimate toward 50%. Use a prior that strong only when you really have that much earlier evidence, for example last year's results on a similar process.

The help text mentions two standard weak priors. Beta(1, 1) is flat, treating every rate from 0 to 100% as equally plausible beforehand; with the default data it gives a mean of 71.154%. Beta(0.5, 0.5) is the Jeffreys prior, often used as a default in reporting; it gives 71.569%. With 50 trials all three weak priors agree within about a point.

The ±1.96 SD band is an approximation of the true interval

The credible interval on this page is the posterior mean plus or minus 1.96 posterior standard deviations, and the sentence now says so: it calls the band approximate and notes the normal approximation. The posterior is a beta distribution, which is not symmetric unless alpha equals beta, so the approximation shifts the band slightly.

For the default posterior Beta(38, 16), the exact equal-tailed 95% interval, found from the 2.5th and 97.5th percentiles of the beta distribution, runs from about 57.65% to 81.66%. The page reports 58.3% to 82.44%. Both ends of the page's band are a little high, by roughly 0.7 points, because a beta distribution centred above 50% has a longer tail toward the lower values.

For most practical purposes with 50 or more trials, that gap is small. If the interval is going into a report, a regulatory submission or a decision with a hard threshold, compute the exact percentiles in a statistics package using the alpha and beta the page gives you. The posterior parameters are exact; only the band is approximate.

Three successes and no failures: where the approximation fails

The approximation breaks down when the data are thin or the rate is near 0 or 100%. Try a flat Beta(1, 1) prior with 3 successes and 0 failures. The posterior is Beta(4, 1), with a mean of 80% and a standard deviation of 16.33%. The half-width line shows 32.007 points, which would carry the band past 100%, so the sentence clips it and reports 47.99% to 100%.

Clipping keeps the figures possible, but it does not make them right. The exact equal-tailed interval for Beta(4, 1) is about 39.76% to 99.37%. It is lopsided, with most of the uncertainty below the mean, and its lower limit is about eight points lower than the page's.

Zero successes is the mirror case. With the default prior and 0 successes against 14 failures, the posterior is Beta(2, 16), the mean is 11.11%, and the band reads 0% to 25.24%. A lower limit sitting exactly at 0% is the clue that clipping has happened and the exact percentiles are needed.

The same distortion shows up with no data at all. Leaving successes and failures at zero gives back the Beta(2, 2) prior with a band of 6.17% to 93.83%, while the exact interval is about 9.43% to 90.57%. As a rough guide, trust the page's band only when both alpha and beta in the posterior are above about 10. Below that, use exact beta percentiles.

Mean, MAP and the plain success rate

Three point estimates are in play, and they answer different questions. The plain observed rate, 36 out of 50, is 72%. The posterior mean, 70.37%, is the average of all plausible rates weighted by how plausible each one is. The MAP mode, 71.154%, is the single most probable rate.

With a flat Beta(1, 1) prior, the MAP equals the observed rate exactly. The page shows this: with the flat prior the MAP is 72%. That is one reason the flat prior is popular, since its MAP reproduces the classical estimate while still giving a full distribution.

The MAP also behaves sensibly at the edges. When the posterior beta parameter is 1 or less and alpha is above 1, the density keeps rising all the way to 100%, so that is the mode. For Beta(4, 1) the page shows a MAP of 100%, even though the mean is 80%. The mirror case puts the MAP at 0%. Those edge values are correct, but they show why the MAP alone is a poor summary of a lopsided posterior.

For decisions under uncertainty, the mean is usually the better summary because it accounts for the whole distribution. The MAP is useful mostly as a check against the raw rate.

Ten times the data, a third of the spread

Posterior uncertainty shrinks roughly with the square root of the number of trials. Multiply both counts in the default by ten, keeping the same 72% success rate and the Beta(2, 2) prior, and the posterior standard deviation falls from 6.157% to 2.002%. The 95% half-width drops from 12.068 to 3.924 points, and the posterior mean moves to 71.825%, closer to the raw 72% as the prior's 4 pretend trials become negligible.

That square root rule is the main planning tool this page offers. To halve the width of your interval, you need about four times the data. If the default band of about plus or minus 12 points is too wide for your decision, you can estimate how many more trials you need before running them.

It also explains why early results swing so much. After 10 trials, one extra success or failure moves the estimate by several points; after several hundred, it barely registers.

Failures, not total trials, go in the second box

The fourth input is the number of failures, not the number of trials. If you ran 50 trials and had 36 successes, enter 14 failures. Typing 50 would tell the engine you saw 86 trials with 36 successes, and the posterior would shift to Beta(38, 52) with a mean of 42.22%, a completely different conclusion.

The counts also need to come from trials that are independent and share the same underlying rate. Conversion rates on a website across very different days, or defect rates across different machines, may not. When the rate genuinely varies between groups, pooling them into one beta posterior gives a band that is too narrow. A hierarchical model, or separate posteriors per group, is the honest approach.

Inputs have to be possible. Prior alpha and beta must be above zero, and successes and failures must be whole numbers of 0 or more; anything else returns an error. Small positive priors such as 0.05 are accepted as typed: Beta(0.05, 2) with the default data gives a posterior mean of 69.26%.

Turning Beta(38, 16) into a decision

Credible intervals have the interpretation most people wrongly give to confidence intervals: given the prior and the data, there is a 95% probability that the true rate lies in the band. That makes them convenient for decisions.

Often the real question is a threshold. Is the success rate above 60%? Above 50%? The page does not compute that, but the posterior answers it directly. For Beta(38, 16) the probability that the true rate exceeds 60% is about 95%, and the probability that it exceeds 50% is about 99.9%. Any statistics package or spreadsheet with a beta distribution function will give you these from the alpha and beta on the page.

In A/B testing, the same approach compares two variants. Build a posterior for each with this page, then estimate the probability that one rate is higher than the other. That last step needs simulation or a dedicated tool, but the posterior parameters are the starting point.