Home > Mathematica, Mathematics > How many?

## How many?

Sample size estimation for various research objectives is a complex exercise.  In this post, I look at the usual derivation for “back of the envelope” calculations of sample size.

Consider a researcher who believes that  a chemical added to a solution will increase the height ($x$) of a plant  in some defined period by $\delta$.  The researcher assumes:

• $x$ follows a normal distribution (see figure)
• the variance of the control and treated distributions are the same (see figure)
• the desired type I error is $\alpha$
• the desired power (1 -type II error) is $1 -\beta$
The null hypothesis ($H_0$) is that the mean of the control (0) and treated  population(1) are equal:
$H_0: \mu_0=\mu_1$
The alternate hypothesis is:
$H_1: \mu_1-\mu_0=\delta$
Consider the standardised normal distributions:
$P(Z>Z_{\alpha}|H_0)=\alpha$
$P(Z>Z_{1-\beta}=-Z_{\beta}|H_1)=1-\beta$
Under the assumption of equal variances ($\sigma^2$), the variance of the difference is $2\sigma^2/n$.
The critical value on the raw scale must coincide. Back transforming the standardised variable  yields:
$x_{crit} =0 +Z_\alpha \sigma\sqrt{2/n} = \delta -Z_\beta\sigma\sqrt{2/n}$
Solving for $n$:
$n =\frac{2(Z_\alpha +Z_\beta)^2\sigma^2}{\delta^2}$
I have used a one tailed type I error, for two-tailed just substitute $\alpha/2$ for $\alpha$ from diagram to text.