23/36
Part 5 of 6 · Fewer usersLearn and do
In an uneven split, the small arm sets the precision
Teams split traffic unevenly for real reasons, like ramping a risky change up slowly or keeping a small holdout. It costs time, because the small arm sets the precision. With treatment users per control user, the control needs
and the treatment gets , where and are each arm's .
def sample_size_split(p_control, mde, treat_share, alpha=0.05, power=0.8):
p_treat = p_control + mde
z = NormalDist().inv_cdf(1 - alpha / 2) + NormalDist().inv_cdf(power)
# treatment users per control user
k = treat_share / (1 - treat_share)
var_c, var_t = p_control * (1 - p_control), p_treat * (1 - p_treat)
n_control = ceil(z ** 2 * (var_c + var_t / k) / mde ** 2)
return n_control, ceil(k * n_control)
print("split control treatment total vs 50/50")
for treat_share in [0.5, 0.2, 0.1, 0.01]:
control, treatment = sample_size_split(0.10, 0.02, treat_share)
split = f"{round(100 * (1 - treat_share))}/{round(100 * treat_share)}"
total = control + treatment
print(f"{split:>5} {control:>8,} {treatment:>10,} {total:>8,} {total / 7678:>8.2f}x")
The same 10% to 12% test on a 90/10 split. About how many users in all, against 7,678 at 50/50?
Pick one to see what it prints.
Pick an answer above to see the rest