## Sample size required to test proportions $p_1-p_2$

The formula for determining the sample size required in each group t ensure that the test has a specified power is

`$$ n_i =2\bigg(\frac{Z_{1-\alpha/2}+Z_{1-\beta}}{ES}\bigg)^2; i=1,2. $$`

where

- $\alpha$ is the selected level of significance,
- $1-\beta$ is the selected power and
- $ES$ is the effect size.

The $ES$ is defined as

`$$ ES=\frac{|p_1-p_2|}{\sqrt{p*(1-p)}} $$`

where

- $p_1$ is the proportion for first group,
- $p_2$ is the proportion for second group,
- $p$ is the overall proportion, based on pooling the data from the two comparison groups, that is $p=\frac{p_1+p_2}{2}$.