Menu

Inputs

Calculate Sample Size Needed to Other: 1-Sample Normal

This calculator is useful for tests concerning whether a mean, μ\mu, is equal to a reference value, μ0\mu_0. The Null and Alternative hypotheses are
H0:μ=μ0H_0:\mu=\mu_0
H1:μμ0H_1:\mu\neq\mu_0

Formulas

This calculator uses the following formulas to compute sample size and power, respectively:
n=(σz1α/2+z1βμμ0)2n=\left(\sigma\frac{z_{1-\alpha/2}+z_{1-\beta}}{\mu-\mu_0}\right)^2
1β=Φ(μμ0σ/nz1α/2)+Φ(μμ0σ/nz1α/2)1-\beta=\Phi\left(\frac{\mu-\mu_0}{\sigma/\sqrt{n}}-z_{1-\alpha/2}\right)+\Phi\left(-\frac{\mu-\mu_0}{\sigma/\sqrt{n}}-z_{1-\alpha/2}\right)
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

R Code

1mu=2
2mu0=1.5
3sd=1
4alpha=0.05
5beta=0.20
6(n=(sd*(qnorm(1-alpha/2)+qnorm(1-beta))/(mu-mu0))^2)
7ceiling(n)# 32
8z=(mu-mu0)/sd*sqrt(n)
9(Power=pnorm(z-qnorm(1-alpha/2))+pnorm(-z-qnorm(1-alpha/2)))

References

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

Rosner B. 2010. Fundamentals of Biostatistics. 7th Ed. Brooks/Cole. page 232.