Statistics & probability

Bayesian A B test probability of improvement calculator

Compare two uncertain success rates after independent beta-prior/binomial updates.

Your numbers

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Compare two uncertain success rates after independent beta-prior/binomial updates. The page integrates the probability that B exceeds A and the expected positive absolute improvement, rather than declaring a winner from posterior means alone. Prior shapes, counts and the distinction between probability and expected loss are all explicit.

THE FORMULAP(B>A)=∫ f_B(b) F_A(b) db.

A worked example

With A uniform Beta(1,1) and B Beta(2,1), P(B>A)=∫0¹2b² db=2/3. Expected positive absolute improvement is 1/4; expected regret from choosing B is 1/4−(2/3−1/2)=1/12.

Good to know

Independent beta/binomial models, integer posterior shapes 1–200. Quadrature over posterior rates; absolute improvement, not relative lift. No optional-stopping policy guarantee or automatic winning decision.

Update each group before comparing them

A beta prior with shapes a,b becomes Beta(a+s,b+n−s) after s successes in n independent Bernoulli trials. Counts must use the same definition of success within a group. The priors belong to the rates before these trials and should not already include the observations entered again as counts.

The two posterior rates are assumed independent. Paired outcomes, repeated users across variants or shared latent effects can violate that assumption. The calculator does not infer such dependence from aggregate counts. If the data collection design couples the groups, a different joint model is needed before interpreting the comparison probability.

Probability of winning and expected improvement are different quantitiesB density 2b; A density 1P(B>A)=2/3E[(B−A)+]=1/4Not a lift ratio
With A uniform Beta(1,1) and B Beta(2,1), P(B>A)=∫0¹2b² db=2/3. Expected positive absolute improvement is 1/4; expected regret from choosing B is 1/4−(2/3−1/2)=1/12. Diagram is schematic; labels specify the numerical values.

The Bayesian linear regression posterior calculator uses a Gaussian observation model and continuous coefficients. This A/B comparison uses independent beta posteriors for Bernoulli rates and distinguishes win probability from expected absolute improvement.

Distinguish means from probability of superiority

A posterior mean summarizes one rate, while P(B>A) compares complete posterior distributions. Two groups can have similar means but different uncertainty, and a higher mean does not imply near-certain superiority. The integration accounts for both posterior shapes instead of comparing only their centers.

The probability is not a frequentist p-value and is not the chance that a null hypothesis generated the observed counts. It is conditional on the specified priors, binomial likelihoods and independence assumption. Report those assumptions rather than labeling the output a universal confidence that a particular product decision is correct.

Derive the superiority integral

Condition on a possible value b of B. Given that value, the chance A is below it is FA(b). Averaging over B gives the integral of fB(b)FA(b) from zero to one. This is the calculation used for the displayed superiority probability.

The integral is deterministic numerical quadrature, not a Monte Carlo simulation with a hidden random seed. Posterior beta shapes are restricted to positive integers no greater than two hundred to keep the supported parameter range manageable. A quadrature failure is reported instead of returning a guessed probability at the nearest allowed parameters.

Verify a simple unequal-posterior example

The default A has a uniform Beta(1,1) posterior. B starts with the same prior and has one success in one trial, giving Beta(2,1), whose density is 2b. Since FA(b)=b, superiority probability is the integral of 2b squared, equal to two thirds.

The posterior means are one half and two thirds, a difference of one sixth. This mean difference is not the same as superiority probability two thirds or expected positive improvement one quarter. Each measures a different feature of the comparison and should retain its own label when quoted.

Read expected gain and regret in rate units

Expected positive B improvement is E[max(B−A,0)]. It averages the size of favorable differences, assigning zero when B is worse. For the default posteriors, conditioning on B gives b squared divided by two for the uniform-A improvement, and integrating against 2b gives one quarter.

Expected regret from choosing B is E[max(A−B,0)]. The identity E[(B−A)+]−E[(A−B)+]=E[B]−E[A] gives regret one quarter minus one sixth, or one twelfth. These are absolute rate differences, not relative percentage lifts. Multiplying by a future trial count would add assumptions about future population and constancy of rates.

Choose priors and decision rules before inspecting a winner

A uniform prior is a modeling choice rather than a universal absence of information. A prior concentrated near a historical rate can matter substantially with few trials. Compare justified alternatives to understand sensitivity, but avoid selecting a prior after seeing which one produces the desired superiority probability.

The form does not choose a launch threshold, incorporate switching costs or account for multiple metrics. A probability such as 0.95 can coexist with a very small practical improvement, while a moderate probability can accompany an important expected gain. Decisions need the scale of consequences as well as posterior ordering.

Keep sequential testing and future performance separate

Bayesian updating allows the entered counts to be updated as observations arrive, but a decision procedure can still have operating characteristics that depend on its stopping rule, selection process and data quality. This page does not certify an optional-stopping policy or control the frequentist error rate of a repeated experimentation program.

Biased assignment, changing populations and delayed outcomes are not fixed by integrating a posterior accurately. The result describes the supplied independent binomial model. Validate the experiment design and practical costs separately before making a consequential decision, and do not interpret a high probability as a promise that B will outperform in every future sample.

A few questions, answered

Is probability B exceeds A a p-value?

No. It is a posterior comparison probability conditional on the priors and likelihood assumptions.

Is expected improvement a relative percentage lift?

No. It is an absolute rate difference. Relative lift would involve a different quantity and potentially unstable division.

Can I enter posterior shapes and the same counts again?

Not without double-counting. Prior fields describe information before the trials entered in the count fields.

Does the calculator declare a winner automatically?

No. It returns probabilities and expected differences, leaving costs, thresholds and experiment validity to the decision process.

Find your calculator

Start typing to explore the library.