Premium problem127. How Many Users Does the Test Need?

Hard Locked

Return the required sample size per group to detect an absolute lift of mde over a baseline conversion rate, at significance alpha and statistical power, for a two-sided test.

n=(z1−α/2+zpower)2(p1(1−p1)+p2(1−p2))mde2n = \frac{\bigl(z_{1-\alpha/2} + z_{\text{power}}\bigr)^2\bigl(p_1(1-p_1) + p_2(1-p_2)\bigr)}{\text{mde}^2}

Round up. The mde2\text{mde}^2 in the denominator is the thing worth internalising: halving the effect you want to detect costs four times the traffic.

Input

baseline = 0.1
mde = 0.02
alpha = 0.05
power = 0.8

Output

3839

Premium problem

This one's part of Premium. Unlock the full Probability track plus every other premium problem on the site.

Implement solve(...)