Sample Size, $n$

Power, $1-\beta$

Type I error rate, $\alpha$

X-axis

min

max

Documentation
Test 1 Mean
Compare 2 Means
Compare k Means
Test 1 Proportion
Compare 2 Proportions
Compare Paired Proportions
Compare k Proportions
Test Time-To-Event Data
Test Odds Ratio
Test Relative Incidence in Self Controlled Case Series Studies
Other

## Calculate Sample Size Needed to Test 1 Proportion: 1-Sample Equivalence

This calculator is useful when we wish to test whether a proportion, $p$, is different from a gold standard reference value, $p_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:|p-p_0|\ge\delta$
$H_1:|p-p_0|<\delta$
.

### Formulas

This calculator uses the following formulas to compute sample size and power, respectively: $$n=p(1-p)\left(\frac{z_{1-\alpha}+z_{1-\beta/2}}{|p-p_0|-\delta}\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{|p-p_0|-\delta}{\sqrt{\frac{p(1-p)}{n}}}$$
where

### R Code

R code to implement these functions:

p=0.6
p0=0.6
delta=0.2
alpha=0.05
beta=0.20
(n=p*(1-p)*((qnorm(1-alpha)+qnorm(1-beta/2))/(abs(p-p0)-delta))^2)
ceiling(n) # 52
z=(abs(p-p0)-delta)/sqrt(p*(1-p)/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 87.