Menu
Inputs
Calculate Sample Size Needed to Test 1 Mean: 1-Sample, 1-Sided
This calculator is useful for tests concerning whether a mean, , is equal to a reference value, . The Null and Alternative hypotheses are either:
or
Formulas
This calculator uses the following formulas to compute sample size and power, respectively:
where:
is sample size
is standard deviation
is the standard Normal distribution function
is the standard Normal quantile function
is Type I error
is Type II error, meaning is power
R Code
1mu=115
2mu0=120
3sd=24
4alpha=0.05
5beta=0.20
6(n=(sd*(qnorm(1-alpha)+qnorm(1-beta))/(mu-mu0))^2)
7ceiling(n)# 143
8z=(mu-mu0)/sd*sqrt(n)
9(Power=pnorm(abs(z)-qnorm(1-alpha)))References
Rosner B. 2010. Fundamentals of Biostatistics. 7th Ed. Brooks/Cole. page 224 and 230.