Bayesian Posterior Calculator
Free Bayesian posterior Calculator for ab testing. Enter values to get step-by-step solutions with formulas and graphs.
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer
Bayesian Posterior Calculator
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser — no data is sent to any server.
Formula: Posterior = Beta(alpha + successes, beta + failures) | P(A|B) = P(B|A)P(A) / P(B)
Worked example — Posterior Beta(47, 473): mean = 9.04%, 95% CI [6.7%, 11.7%]
Formula
Posterior = Beta(alpha + successes, beta + failures) | P(A|B) = P(B|A)P(A) / P(B)
In the Beta-Binomial model, the posterior distribution is analytically derived by adding observed successes to the prior alpha and failures to the prior beta. For simple Bayes' theorem, the posterior probability is the product of the likelihood and prior divided by the total evidence probability.
Worked Examples
Example 1: A/B Test Conversion Rate
Problem:Prior: Beta(2, 18) (10% baseline conversion). Observed: 45 conversions out of 500 visitors. Calculate the posterior.
Solution:Prior: Beta(alpha=2, beta=18), mean = 2/20 = 10% Data: s=45 successes, f=455 failures Posterior: Beta(2+45, 18+455) = Beta(47, 473) Posterior mean = 47/520 = 9.04% Observed rate = 45/500 = 9.00% Prior mean was 10%, posterior shrunk toward data 95% CI: approximately [6.7%, 11.7%]
Result:Posterior Beta(47, 473): mean = 9.04%, 95% CI [6.7%, 11.7%]
Example 2: Medical Diagnostic Test
Problem:A disease has 1% prevalence. A test has 95% sensitivity and 5% false positive rate. Patient tests positive. What is the probability of disease?
Solution:P(Disease) = 0.01 (prior) P(Positive|Disease) = 0.95 (sensitivity) P(Positive|No Disease) = 0.05 (false positive) P(Positive) = 0.95 x 0.01 + 0.05 x 0.99 = 0.0095 + 0.0495 = 0.059 P(Disease|Positive) = (0.95 x 0.01) / 0.059 = 16.1%
Result:Posterior probability of disease = 16.1% (not 95%!)
Frequently Asked Questions
What is Bayesian posterior probability and why is it important?
Bayesian posterior probability represents the updated probability of a hypothesis after observing new evidence, calculated using Bayes' theorem. It combines prior knowledge (what we believed before seeing data) with the likelihood of the observed data to produce a refined estimate. The formula is: P(A|B) = P(B|A) x P(A) / P(B). This framework is foundational in modern statistics, machine learning, medical diagnostics, and A/B testing because it provides a principled way to update beliefs incrementally as new data arrives. Unlike frequentist methods that treat parameters as fixed, Bayesian analysis treats them as probability distributions, enabling richer uncertainty quantification and more intuitive interpretation of results.
What is the Beta-Binomial model used in A/B testing?
The Beta-Binomial model is the most common Bayesian framework for A/B testing because the Beta distribution is the conjugate prior for Binomial data. This means if your prior belief about a conversion rate follows a Beta(alpha, beta) distribution and you observe s successes in n trials, the posterior is simply Beta(alpha + s, beta + n - s). The prior parameters alpha and beta can be interpreted as pseudo-counts: alpha represents prior successes and beta represents prior failures. A Beta(1,1) prior is uniform (no prior knowledge), while Beta(100,900) encodes a strong belief in a 10% rate. This conjugate relationship makes calculations analytically tractable without requiring computationally expensive MCMC sampling, making it ideal for real-time dashboard reporting in product experimentation.
How do I choose an appropriate prior distribution?
Choosing a prior depends on your available knowledge and desired level of informativeness. A non-informative (flat) prior like Beta(1,1) gives equal weight to all possible parameter values and lets the data speak entirely for itself — useful when you have no prior knowledge. A weakly informative prior like Beta(2,2) slightly favors values near 0.5 while remaining flexible. An informative prior encodes domain expertise — if historical conversion rates cluster around 5%, Beta(5,95) captures this belief while allowing the data to update it. The prior's effective sample size (alpha + beta) determines how strongly it influences the posterior relative to new data. A general rule is to set the prior strength comparable to or weaker than your expected sample size to avoid overwhelming the data.
What is a credible interval and how does it differ from a confidence interval?
A Bayesian credible interval is a range that contains the true parameter value with a specified probability (e.g., 95%), given the observed data and prior. For example, a 95% credible interval of [3.2%, 5.8%] means there is a 95% probability that the true conversion rate lies in this range. This is fundamentally different from a frequentist confidence interval, which states that 95% of similarly constructed intervals would contain the true value in repeated sampling — a subtle but important distinction. Credible intervals directly answer the question practitioners actually want to ask: 'What values are plausible for my parameter?' They naturally incorporate prior information, can be asymmetric, and provide probability statements about the parameter rather than about the procedure.
What is Bayesian shrinkage and why does it occur?
Bayesian shrinkage is the phenomenon where the posterior estimate is pulled ('shrunk') from the observed data toward the prior mean. This occurs because the Bayesian posterior is a weighted average of the prior belief and the observed evidence. With small sample sizes, the prior dominates and shrinkage is strong — if your prior expects a 10% rate and you observe 3/10 (30%), the posterior might estimate 15% rather than 30%. As sample size increases, the data overwhelms the prior and shrinkage diminishes. Shrinkage is actually beneficial in many scenarios: it reduces overfitting, stabilizes estimates for small samples, and provides natural regularization. In multi-arm A/B tests, Bayesian hierarchical models use shrinkage to 'borrow strength' across variants, producing more reliable estimates for low-traffic segments.
References
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer · Editorial policy
Related Calculators
🧮Descriptive Statistics Calculator
Calculate descriptive statistics with inputs, formulas, and instant results.
🧮False Discovery Rate Calculator
Calculate false discovery rate with inputs, formulas, and instant results.
🧮Correlation Coefficient Calculator
Calculate correlation coefficient with inputs, formulas, and instant results.
🧮Binomial Distribution Calculator
Calculate binomial distribution with inputs, formulas, and instant results.
🧮Chi Square Test Calculator
Calculate chi square test with inputs, formulas, and instant results.
🧮Ztest Proportions Calculator
Calculate ztest proportions with inputs, formulas, and instant results.
🧮Effect Size Calculator
Calculate effect size with inputs, formulas, and instant results.