In performance marketing, test velocity is competitive advantage. Under the frequentist A/B testing scenario, you wait two weeks for confidence intervals to settle while campaign budgets burn. The Bayesian approach gives you an updated posterior distribution every day — you can declare "variant B has a 73% probability of winning" before the test even concludes. This article unpacks the mechanical logic of Bayesian A/B testing, sequential decision rules, and sample size dynamics. You shift from frequentist's fixed horizon constraint toward continuous decision updates within daily data flow.
The Fixed Horizon Problem in Frequentist Testing
Classical A/B testing revolves around p-values and fixed sample sizes. You start by planning "we need n=5,000 visitors, this will take 14 days" and commit to making no decision before day 14. Throughout that period, you continue sending traffic to the losing variant — even if its conversion rate is 2 percentage points lower, you must wait to avoid violating your test plan. Early stopping inflates Type I error; the multiple testing problem emerges.
In frequentist logic, p < 0.05 delivers statistical significance, but in practice you often find "significant but worthless" lifts. A 0.5% lift can register as statistically significant (thanks to large sample size) yet deliver zero business impact. You need to distinguish between confidence interval width and effect size — the frequentist framework doesn't surface this automatically.
Another constraint: you cannot conduct sequential monitoring. You calculate required sample size upfront and wait until you reach it. During this period, one variant may be clearly winning, yet you must continue the test to avoid "peeking," which invalidates your p-value. This forced patience burns budget on inferior variants.
Bayesian Testing: Updated Posterior Every Day
Bayesian methodology operates on prior belief + data = posterior logic. At test start, you define a prior distribution for each variant's conversion rate (typically uninformative Beta(1,1) or an informative prior from historical data). With each visitor, Bayes theorem updates the posterior. At visitor 100, the posterior has one shape; at visitor 200, it has another — continuous refinement.
The posterior distribution directly answers "what is the probability density of this variant's true conversion rate?" For example, a Beta(25, 75) posterior indicates high probability density between 20% and 30% conversion rate. By comparing two variants' posteriors, you calculate "probability that B beats A" — this P(B > A) formula emerges naturally in the Bayesian framework.
Bayesian sequential testing works like this: update the posterior daily and stop when P(B > A) > 0.95. This threshold reflects your risk tolerance — you could use 90%, 95%, or 99%. Frequentist methodology offers no such stopping mechanism outside a fixed horizon; Bayesian approach lets you decide at any moment because the posterior always contains complete information.
Bayesian tests have no p-value. Instead, you use probability of superiority (P(B > A)), expected loss (expected lift forgone if you choose A over B), and credible intervals (the 95% range of the posterior). These are more actionable in practice — you can say "variant B has an 85% chance of winning and delivers 2.3% expected lift if it does."
Posterior Update Code
import numpy as np
from scipy.stats import beta
# Prior: Beta(1,1) = uniform
prior_alpha, prior_beta = 1, 1
# Incoming data: variant A → 50 conversions, 200 visits
conversions_A = 50
visits_A = 200
failures_A = visits_A - conversions_A
# Posterior: Beta(alpha + conversions, beta + failures)
post_alpha_A = prior_alpha + conversions_A
post_beta_A = prior_beta + failures_A
# Draw samples from posterior
samples_A = beta.rvs(post_alpha_A, post_beta_A, size=10000)
# Same for variant B
conversions_B = 60
visits_B = 200
failures_B = visits_B - conversions_B
post_alpha_B = prior_alpha + conversions_B
post_beta_B = prior_beta + failures_B
samples_B = beta.rvs(post_alpha_B, post_beta_B, size=10000)
# Calculate P(B > A)
prob_B_wins = (samples_B > samples_A).mean()
print(f"P(B > A): {prob_B_wins:.2%}") # Example: 0.82 = 82% chance B wins
Dynamic Sample Size and Early Stopping
In Bayesian testing, sample size is not fixed. You can set a minimum threshold upfront — "at least 1,000 visitors" so the posterior doesn't stay excessively wide — but the upper bound is dynamic. Once P(B > A) crosses 0.95, you stop the test immediately. This could happen at visitor 500 or visitor 5,000.
The expected loss metric is excellent for early stopping decisions. Formula: E[Loss] = E[max(0, CR_winner - CR_chosen)]. If you pick variant A but B actually wins, expected loss quantifies the forgone lift. Set a loss threshold — say "ELoss < 0.5%" — and stop once you guarantee minimal regret. This makes risk-averse decision-making straightforward.
Sequential stopping rule example:
| Metric | Threshold | Action |
|---|---|---|
| P(B > A) | > 0.95 | Declare B winner |
| P(A > B) | > 0.95 | Declare A winner |
| ELoss | < 0.005 | Stop losing variant |
| Minimum visits | < 1,000 | Hold; insufficient data |
These rules typically cut test duration by 30–40% (per Google Optimize and VWO Bayesian engine benchmarks). For large effect sizes, you can make 95%-confidence decisions in 3 days instead of 14.
Multi-armed bandit differs here: Bayesian A/B testing still doesn't optimize exploration-exploitation tradeoffs; it simply updates posteriors and applies stopping rules. Bandit algorithms dynamically reweight traffic (Thompson Sampling being a prime example), while Bayesian testing holds a fixed 50/50 split but exits early. Bandit is aggressive — each impression pushes more traffic to the winning variant. Bayesian testing is more conservative — split remains fixed; only decision speed increases.
Informative Priors and Incrementality Testing
Prior selection is the most critical decision in Bayesian testing. Uninformative prior (Beta(1,1)) discards historical knowledge, generating a purely data-driven posterior. Informative prior comes from past tests or segment-level baseline conversion rates. For example, if mobile segments averaged 12% conversion across 50 past tests, you could use Beta(60, 440) (approximately 12% mean with appropriate spread). This prior gives your new test a "reasonable anchor" grounded in history.
Informative priors reduce sample size requirements because posterior updates start from informed points, not zero. The downside: misspecified priors introduce bias. If the segment shifted or seasonality changed, old priors mislead. Always perform prior sensitivity analysis — verify results don't flip with different reasonable priors.
In Conversion Rate Optimization workflows, Bayesian testing simplifies incrementality measurement. Incrementality tests need holdout groups or geo-splits. With Bayesian methods, you compare the holdout group's conversion rate posterior against the test group's posterior and derive lift distribution. Instead of a classical t-test, you calculate P(lift > 0) — more interpretable. You can say "new campaign has 78% chance of delivering incrementality with expected lift between 1.2–2.8%."
Prior Selection Comparison
# Uninformative prior
prior_uninf = beta(1, 1)
# Informative prior: 12% historical conversion, n=500 data points
# Beta mean = alpha / (alpha + beta) → 60/500 = 0.12
prior_inf = beta(60, 440)
# Update with 20 conversions, 100 visits
conversions, visits = 20, 100
post_uninf = beta(1 + conversions, 1 + (visits - conversions))
post_inf = beta(60 + conversions, 440 + (visits - conversions))
# Posterior means
print(f"Uninformative posterior mean: {post_uninf.mean():.2%}") # ~20%
print(f"Informative posterior mean: {post_inf.mean():.2%}") # ~13.3%
Uninformative prior is data-sensitive at small sample sizes; informative prior regularizes using historical knowledge.
Tradeoffs: Bayesian vs Frequentist vs Bandit
Bayesian testing is not universally optimal. Frequentist testing is preferred in regulated environments (medical, financial) because p-value is a standard; peer review processes are built around it. Bayesian prior selection can feel subjective. If regulation mandates p-values and test windows are fixed (e.g., 30 days is non-negotiable), frequentist makes sense.
Bandit algorithms (Thompson Sampling, UCB) automatically balance exploration-exploitation and dynamically reweight traffic. For longer-term tests (3+ weeks), bandits often outperform Bayesian A/B because they send less traffic to losers. Over 1–2 weeks, Bayesian A/B suffices — bandit regret minimization doesn't matter as much.
With very small sample sizes (e.g., 100 visitors daily), both Bayesian and frequentist struggle. Posteriors become so wide that P(B > A) never reaches 95%. In this case, use micro-conversions (clicks, add-to-cart — more frequent events) or geo-aggregated testing. Bayesian doesn't magically solve small-sample problems; it just provides interpretable output.
Bayesian testing truly shines in cross-channel test orchestration. Say you're testing creative variants on paid channels while running a landing page CRO test simultaneously. You can combine both tests' posteriors (joint posterior) and decompose lift contributions. Frequentist would require complex ANOVA; Bayesian handles this naturally via Markov Chain Monte Carlo (MCMC).
Practical Implementation: Platforms and Tooling
Google Optimize (now sunset) used a Bayesian engine. Today, open-source Python bayesian-testing or R bayesAB packages are available. For production, build your own stack — compute posteriors in BigQuery via SQL UDFs or use dbt models for posterior pipelines.
Example dbt macro: daily test data flows in, macro updates posterior alpha/beta parameters and computes P(B > A). When thresholds are crossed, a Slack notification fires. Instead of manual monitoring, automatic stopping rules run. Feed credible intervals and expected loss to dashboards — stakeholders see "82% probability B wins" instead of asking "when will we decide?"
A/B testing platforms (VWO, Optimizely) added Bayesian engines but don't default to Bayesian; they show frequentist and Bayesian side-by-side. This is because prior selection is a user parameter — platforms can't auto-configure it. Platforms assume uninformative priors; custom setups require informative priors. At scale, in-house tooling often beats platform limitations.
Multi-variant testing (A/B/C/D) is simpler under Bayesian logic. Frequentist requires multiple comparison correction (Bonferroni, Holm). Bayesian calculates each variant's posterior separately and lets you compute all pairwise probabilities — P(C > A), P(D > B), etc. Winner selection: highest posterior mean or lowest expected loss.
Bayesian A/B testing accelerates decision velocity in performance marketing. It removes frequentist's fixed-horizon requirement and enables sequential monitoring. Posterior distributions stay current; P(B > A) and expected loss metrics let you make controlled decisions. Informative priors carry historical test data into new tests, reducing sample size needs. The tradeoff: prior selection is subjective, regulation may demand frequentist methodology, and small samples gain limited advantage. But for mid-to-large-scale performance marketing tests, Bayesian approaches deliver actionable insights within days — the 14-day waiting period becomes obsolete.