Sample size to test mean
The minimum sample size required to test the hypothesis about the population mean $\mu$ is
$$ \begin{aligned} n &= \bigg(\frac{z_{1-\alpha/2}+Z_{1-\beta}}{ES}\bigg)^2 \end{aligned} $$
where
- $ES=\dfrac{|\mu_1-\mu_0|}{\sigma}$ is the effect size,
- $\sigma$ is the population standard deviation,
- $\alpha$ is the level of significance,
- $1-\beta$ is the power of the test.
Example
A researcher wishes to test the hypothesis $H_0:\mu=94$ against $H_a:\mu=97$ at $0.05$ level of significance. The population standard deviation is $\sigma= 4.8$. How large a sample size will be to achieve the power of 80%?
Solution
Given that $\mu_0=94$, $\mu_1=97$. The population standard deviation is $\sigma =4.8$. The level of significance is $\alpha =0.05$, and power of the test is $=1-\beta = 0.8$.
The $ES$ is given by
$$ \begin{aligned} ES &= \frac{|\mu_1-\mu_0|}{\sigma}\\ &= \frac{|97-94|}{4.8}\\ &= 0.625. \end{aligned} $$
The formula for determining the sample size required to ensure that the test has a power $1-\beta= 0.8$ is
$$ \begin{aligned} n &= \bigg(\frac{Z_{1-\alpha/2}+Z_{1-\beta}}{ES}\bigg)^2\\ &= \bigg(\frac{Z_{1-0.05/2}+Z_{1-0.2}}{0.625}\bigg)^2\\ &= \bigg(\frac{Z_{0.975}+Z_{0.8}}{0.625}\bigg)^2\\ &= \bigg(\frac{1.96+0.8416}{0.625}\bigg)^2\\ &=20.0933\\ &\approx 21 \end{aligned} $$