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 kk treatment users per control user, the control needs

nC=(z1−α/2+z1−β)2Δ2(σC2+σT2k)n_C = \frac{(z_{1-\alpha/2} + z_{1-\beta})^2}{\Delta^2} \left(\sigma_C^2 + \frac{\sigma_T^2}{k}\right)

and the treatment gets nT=k nCn_T = k\,n_C, where σC2\sigma_C^2 and σT2\sigma_T^2 are each arm's p(1−p)p(1-p).

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")
Predict

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