This calculator is useful for tests concerning whether a mean, $\mu$, is equal to a reference value, $\mu_0$.
The Null and Alternative hypotheses is either
This calculator uses the following formulas to compute sample size and power, respectively: $$n=\left(\sigma\frac{z_{1-\alpha}+z_{1-\beta}}{\mu-\mu_0}\right)^2$$ $$1-\beta=\Phi\left(\frac{|\mu-\mu_0|}{\sigma/\sqrt{n}}-z_{1-\alpha}\right)$$ where
R code to implement these functions:
mu=115 mu0=120 sd=24 alpha=0.05 beta=0.20 (n=(sd*(qnorm(1-alpha)+qnorm(1-beta))/(mu-mu0))^2) ceiling(n)# 143 z=(mu-mu0)/sd*sqrt(n) (Power=pnorm(abs(z)-qnorm(1-alpha)))
Rosner B. 2010. Fundamentals of Biostatistics. 7th Ed. Brooks/Cole. page 224 and 230.