A/B/n Test
An A/B/n test extends the classic A/B test to more than two versions. Instead of A against B, you run A against B against C and so on up to \(n\), all at the same time, and pick whichever performs best on a chosen metric — conversion rate, click-through, engagement.
The mechanics are the same as an A/B test with more buckets. Define a control, usually the current design. Build the variations. Split users randomly across all of them. Track the metric. Use a test — a z-test on proportions, a chi-square, or a Bayesian comparison — to assess prespecified comparisons. Showing a variant beats control does not show it beats every other variant. Testing button text, for instance: A “Buy Now”, B “Shop Now”, C “Get Yours Today”, D “Order Now”, with users divided four ways and conversions compared.
The appeal is obvious: several ideas tested at once rather than in sequence, a faster route to the best of a set of candidates, and a design that matches how ideas actually arrive — in batches, not pairs. The costs are usually listed as “needs more traffic” and “more risk of false positives”, which is correct and much too vague to plan with.
What each extra arm actually costs
import numpy as np
from scipy.stats import norm
base, lift = 0.05, 0.10
za, zb = norm.ppf(0.975), norm.ppf(0.80)
p2 = base * (1 + lift)
per_arm = ((za * np.sqrt(2 * base * (1 - base))
+ zb * np.sqrt(base * (1 - base) + p2 * (1 - p2))) / (p2 - base)) ** 2
"""A single A/B test at 5% baseline, 10% relative lift, 80% power."""
print(f" each extra arm is paid for twice. Baseline {base:.0%}, target lift"
f" {lift:.0%}:")
print(f"{'arms':>7}{'per arm, uncorrected':>23}{'alpha after Bonferroni':>25}"
f"{'per arm, corrected':>21}{'total traffic':>16}")
for k in (2, 3, 4, 6, 10):
comps = k - 1
a = 0.05 / comps
z = norm.ppf(1 - a / 2)
n_c = ((z * np.sqrt(2 * base * (1 - base))
+ zb * np.sqrt(base * (1 - base) + p2 * (1 - p2))) / (p2 - base)) ** 2
print(f"{k:>7}{per_arm:>23,.0f}{a:>25.4f}{n_c:>21,.0f}{k * n_c:>16,.0f}")
rng = np.random.default_rng(0)
runs, n = 200_000, 20_000
print(f"\n what happens with no real difference anywhere, {runs:,} experiments:")
print(f"{'arms':>7}{'P(any significant difference)':>28}{'with Bonferroni':>18}")
for k in (2, 3, 4, 6, 10):
x = norm.ppf(rng.random((runs, k)))
z = (x[:, 1:] - x[:, :1]) / np.sqrt(2)
p = 2 * norm.sf(np.abs(z))
print(f"{k:>7}{np.mean((p < 0.05).any(axis=1)):>28.4f}"
f"{np.mean((p < 0.05 / (k - 1)).any(axis=1)):>18.4f}")
print(f"{'arms':>7}{'true difference':>18}{'reported by the winner':>25}"
f"{'its p-value':>14}")
for k in (2, 3, 4, 6, 10):
x = norm.ppf(rng.random((runs, k)))
z = (x[:, 1:] - x[:, :1]) / np.sqrt(2)
best = z.max(axis=1)
print(f"{k:>7}{0.0:>18.4f}{best.mean():>25.4f}"
f"{np.mean(2 * norm.sf(np.abs(best))):>14.4f}")
print(f"{'users per arm':>16}{'conversions':>13}{'p vs control':>15}"
f"{'Bonferroni 0.0167':>20}")
for n_arm in (400, 1000, 2000, 5000):
pc, pt = 0.05, 0.075
s = np.sqrt(pc * (1 - pc) / n_arm + pt * (1 - pt) / n_arm)
z = (pt - pc) / s
p = 2 * norm.sf(z)
print(f"{n_arm:>16,}{n_arm * pt:>13,.0f}{p:>15.4f}"
f"{('significant' if p < 0.05 / 3 else 'not'):>20}")
# each extra arm is paid for twice. Baseline 5%, target lift 10%:
# arms per arm, uncorrected alpha after Bonferroni per arm, corrected total traffic
# 2 30,244 0.0500 30,244 60,489
# 3 30,244 0.0250 36,580 109,739
# 4 30,244 0.0167 40,266 161,064
# 6 30,244 0.0100 44,890 269,343
# 10 30,244 0.0056 50,186 501,864
#
# what happens with no real difference anywhere, 200,000 experiments:
# arms P(any significant difference) with Bonferroni
# 2 0.0496 0.0496
# 3 0.0912 0.0472
# 4 0.1241 0.0434
# 6 0.1826 0.0424
# 10 0.2703 0.0394
# arms true difference reported by the winner its p-value
# 2 0.0000 -0.0046 0.5004
# 3 0.0000 0.3996 0.4999
# 4 0.0000 0.5976 0.4744
# 6 0.0000 0.8233 0.4256
# 10 0.0000 1.0448 0.3642
# users per arm conversions p vs control Bonferroni 0.0167
# 400 30 0.1436 not
# 1,000 75 0.0208 not
# 2,000 150 0.0011 significant
# 5,000 375 0.0000 significant
The four costs, in order
The first is the one everyone expects and it is larger than the split suggests. Traffic divides by the number of arms, and the significance threshold divides by the number of comparisons, so each arm needs more users and there are more arms to fill. Going from two arms to four nearly triples the total traffic required; going to ten multiplies it by more than eight. This compares four arms with one two-arm experiment, not with three separate A/B tests. At a common per-arm requirement and correction, sharing one control uses four arm-sized samples rather than six; exact efficiency depends on allocation and correlation.
The second is the false-positive rate. Nine variants against one control show at least one two-sided significant difference on pure noise about 27% of the time at an uncorrected 5%. This includes both apparent improvements and apparent declines; it is not the probability of selecting an improved winner. The Bonferroni column holds it at or below 0.05 throughout, growing conservative as arms are added. This is the multiple-comparisons problem in its plainest form, and for comparing several variants against one control the standard tool is Dunnett’s procedure, which accounts for the fact that the comparisons share a control and is therefore less conservative than Bonferroni.
The third is rarely mentioned and matters for what happens after the test. The winning arm is the maximum of several noisy estimates, so its measured lift is biased upward by construction — with ten arms, by about one standard error even when every variant is identical to the control. The consequence is operational: a business case built on the winner’s measured lift tends to over-predict the result, and the expected shortfall grows with the number of arms tested. Any single launch can still land above or below that figure. Where the decision depends on the size rather than the identity of the winner, the honest options are a holdout, a confirmatory follow-up, or a shrinkage estimate, each of which re-measures the effect independently of the selection.
The fourth is the example everyone has seen. Four arms at 25% each, a control at 5% and a best variant at 7.5% — a 50% relative lift, which is large. It takes about 2,000 users per arm to call that significant once the three comparisons are accounted for. At 1,000 per arm it clears an uncorrected 0.05 and not the corrected threshold, which is exactly the situation the correction exists for. A write-up that says “version C is statistically better” without the sample size has not said which side of that line it is on.
When it is the right design
Use it when there are several genuinely distinct alternatives worth trying, when the traffic exists to split, and when the question really is winner-takes-all — several headlines, several hero images, several layouts. Decide the primary metric and the correction before launching, because both become negotiable once the numbers are visible.
Against its neighbors: an A/B test compares two versions and needs the least traffic, giving one clean comparison. An A/B/n test compares several alternative designs and estimates specified comparisons, at the traffic cost measured above. A multivariate test crosses several elements and estimates which elements and which combinations matter, at a much higher traffic cost again — it answers a question about interactions that an A/B/n test cannot, since its arms are whole designs rather than element combinations.
One practical habit closes the gap between the design and the decision. If the goal is to find the best of several candidates and then ship it, an A/B/n test with a correction and a follow-up on the winner is the honest sequence. If the goal is to maximize conversions during the test rather than to measure them, a bandit does that better — and requires allocation-aware inference to report a valid effect estimate, which is the same trade seen from the other side.
References
- SciPy documentation,
scipy.stats.norm. docs.scipy.org
Discover more from Insightful Data Lab
Subscribe to get the latest posts sent to your email.
