Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am planning a study where the endpoint of the current practice is 40% successful. The null hypothesis will be rejected if the intervention produces a 60% success rate (treatment effect of interest). We are happy with a significance criterion of 0.05 and a $\beta$ 0.8. The study will be to intervention or to current treatment, randomised and blinded. What is the sample size needed?

share|cite|improve this question

I'm assuming you're taking $H_0: p_1 = p_2 = 0.4$, $H_a: p_1 < p_2$, the specific alternative $p_2 - p_1 > 0.6 - 0.4 = 0.2$, and $n_1 = n_2$. Under these assumptions, the test statistic is $$z = \frac{(\hat{p}_1 - \hat{p}_2) - (p_1 - p_2)}{\sqrt{\frac{p_1(1-p_1)}{n_1} + \frac{p_2(1-p_2)}{n_2}}}.$$

With $\alpha = 0.05$, you're saying you want $P(z \leq z^*) = 0.05$ when $p_1 = p_2 = 0.4$, which gives $z^* = -1.645$. With $\beta = 0.8$, you're saying you want $P(z \leq z') = 0.8$ when $p_2 - p_1 = 0.2$, which gives $z' = 0.84$. Based on the assumptions on $z^*$ and $z'$ we have $$z^* = \frac{(\hat{p}_1 - \hat{p}_2) - 0}{\sqrt{\frac{0.4(0.6)}{n} + \frac{0.4(0.6)}{n}}} = \frac{\hat{p}_1 - \hat{p}_2}{\sqrt{\frac{0.48}{n}}}$$ and $$z' = \frac{(\hat{p}_1 - \hat{p}_2) - (-0.2)}{\sqrt{\frac{0.4(0.6)}{n} + \frac{0.6(0.4)}{n}}} = \frac{\hat{p}_1 - \hat{p}_2 + 0.2}{\sqrt{\frac{0.48}{n}}}.$$

Thus to find $n$ we solve $$-1.645 + \frac{0.2}{\sqrt{\frac{0.48}{n}}} = 0.84,$$ which (rounding up) yields $n = n_1 = n_2 = 75$.

Incidentally, there are online tools that will do this calculation for you, such as this one. They give the sample size as $n_1 = n_2 = 77$. I'm not sure the reason for the discrepancy; maybe they are using a continuity correction or using slightly different values from the normal distribution or taking the conservative $p_1 = p_2 = 0.5$ in the $z$ score calculation.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.