Sample Size, $n$

Power, $1-\beta$

Type I error rate, $\alpha$



X-axis

min

max


Calculate Sample Size Needed to Test 1 Mean: 1-Sample Equivalence


This calculator is useful when we wish to test whether a mean, $\mu$, is different from a gold standard reference value, $\mu_0$. For example, we may wish to test whether a new product is equivalent to an existing, industry standard product. Here, the 'burden of proof', so to speak, falls on the new product; that is, equivalence is actually represented by the alternative, rather than the null hypothesis.

$H_0:|\mu-\mu_0|\ge\delta$
$H_1:|\mu-\mu_0|<\delta$
.

Formulas

This calculator uses the following formulas to compute sample size and power, respectively: $$n=\left(\sigma\frac{z_{1-\alpha}+z_{1-\beta/2}}{\delta-|\mu-\mu_0|}\right)^2$$
$$1-\beta=2\left[\Phi\left(z-z_{1-\alpha}\right)+\Phi\left(-z-z_{1-\alpha}\right)\right]-1 \quad ,\quad z=\frac{|\mu-\mu_0|-\delta}{\sigma/\sqrt{n}}$$
where

R Code

R code to implement these functions:

mu=2
mu0=2
delta=0.05
sd=0.10
alpha=0.05
beta=0.20
(n=(sd*(qnorm(1-alpha)+qnorm(1-beta/2))/(delta-abs(mu-mu0)))^2)
ceiling(n) # 35
z=(abs(mu-mu0)-delta)/sd*sqrt(n)
(Power=2*(pnorm(z-qnorm(1-alpha))+pnorm(-z-qnorm(1-alpha)))-1)

References

Chow S, Shao J, Wang H. 2008. Sample Size Calculations in Clinical Research. 2nd Ed. Chapman & Hall/CRC Biostatistics Series. page 54.