HyLown Power and Sample Size Calculators

Good News! These calculators have earned their own website! We'll leave these calculators here for now, but for our latest calculators please visit

PowerAndSampleSize.com.

For either a non-inferiority (when $\delta>0$) or a superiority (when $\delta<0$) test, where

$H_0:p_0-p_1\le\delta$ versus $H_1:p_0-p_1>\delta$

where $\delta$ is the superiority or non-inferiority margin and the ratio between the sample sizes of the two groups is
$$\kappa=\frac{n_1}{n_2}$$

Sample Size

Power

X-axis

min

max

This sample size calculator uses the following formula: $$ n_1=\kappa n_2 \;\text{ and }\; n_2=\left(\frac{p_0(1-p_0)}{\kappa}+p_1(1-p_1)\right) \left(\frac{\Phi^{-1}(\alpha)+\Phi^{-1}(\beta)}{p_0-p_1-\delta}\right)^2$$ where

  • $n$ is sample size
  • $p_1$ is the rate, proportion, or probability to be tested
  • $p_0$ is the comparison value
  • $\kappa=n_1/n_2$ is the matching ratio
  • $\Phi^{-1}$ is the standard Normal quantile function
  • $\alpha$ is Type I error
  • $\beta$ is Type II error, meaning $1-\beta$ is power
  • $\delta$ is the testing margin

R code to implement this function:

p0=0.85
p1=0.65
delta=-0.10
kappa=1
alpha=0.05
beta=0.20
(n=ceiling((p0*(1-p0)/kappa+p1*(1-p1))*((qnorm(alpha)+qnorm(beta))/(p0-p1-delta))^2)) # 25

Reference: Chow, page 90