Menu

Inputs

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, μ0\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.
H0:μμ0δH1:μμ0<δH_0: |\mu - \mu_0| \geq \delta \\ H_1: |\mu - \mu_0| < \delta

Formulas

This calculator uses the following formulas to compute sample size and power, respectively:
n=(σz1α+z1β/2δμμ0)2n = \left(\sigma\frac{z_{1-\alpha} + z_{1-\beta/2}}{\delta - |\mu - \mu_0|}\right)^2
1β=2[Φ(zz1α)+Φ(zz1α)]1,z=μμ0δσ/n1-\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: nn is sample size σ\sigma is standard deviation Φ\Phi is the standard Normal distribution function Φ1\Phi^{-1} is the standard Normal quantile function α\alpha is Type I error β\beta is Type II error, meaning 1β1-\beta is power δ\delta is the testing margin

R Code

1muA=5
2muB=4
3delta=5
4kappa=1
5sd=10
6alpha=0.05
7beta=0.20
8(nB=(1+1/kappa)*(sd*(qnorm(1-alpha)+qnorm(1-beta/2))/(abs(muA-muB)-delta))^2)
9ceiling(nB) # 108
10z=(abs(muA-muB)-delta)/(sd*sqrt((1+1/kappa)/nB))
11(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.