# ::Free Statistics and Forecasting Software::

v1.2.1

### :: Minimum Sample Size - Testing Mean - Free Statistics Software (Calculator) ::

All rights reserved. The non-commercial (academic) use of this software is free of charge. The only thing that is asked in return is to cite this software when results are used in publications.

This free online software (calculator) computes the minimum sample size that is required to test a mean. The computation takes into account: a margin of error (allowable deviation), the percentage of confidence, the population size (use a large number for infinite populations), the population variance, and the power (default is 50%).
In addition, the minimum sample size is computed for the case where the population variance is unknown (the specified population variance is used as a starting value in the t-distribution).

 Send output to: Browser Blue - Charts White Browser Black/White CSV Population size (?) Margin of Error (?) Confidence Population Variance Power (?) Chart options Width: Height:

 Source code of R module par1 <- as.numeric(par1) par2 <- as.numeric(par2) par3 <- as.numeric(par3) par4 <- as.numeric(par4) par5 <- as.numeric(par5) (z <- abs(qnorm((1-par3)/2)) + abs(qnorm(1-par5))) (z1 <- abs(qnorm(1-par3)) + abs(qnorm(1-par5))) z2 <- z*z z2one <- z1*z1 z24 <- z2 * par4 z24one <- z2one * par4 npop <- array(NA, 200) ppop <- array(NA, 200) for (i in 1:200) { ppop[i] <- i * 100 npop[i] <- ppop[i] * z24 / (z24 + (ppop[i] - 1) * par2*par2) } bitmap(file="pic1.png") plot(ppop,npop, xlab="population size", ylab="sample size (2 sided test)", main = paste("Minimum Required Sample Size (Confidence =",round(par3*100,2),"%)")) dumtext <- paste("Margin of error = ",par2) dumtext <- paste(dumtext," Population Var. = ") dumtext <- paste(dumtext, par4) mtext(dumtext) grid() dev.off() par2sq <- par2 * par2 num <- par1 * z24 denom <- z24 + (par1 - 1) * par2sq (n <- num/denom) num1 <- par1 * z24one denom1 <- z24one + (par1 - 1) * par2sq (n1 <- num1/denom1) load(file="createtable") a<-table.start() a<-table.row.start(a) a<-table.element(a,"Minimum Sample Size",2,TRUE) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Population Size",header=TRUE) a<-table.element(a,par1) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Margin of Error",header=TRUE) a<-table.element(a,par2) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Confidence",header=TRUE) a<-table.element(a,par3) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Power",header=TRUE) a<-table.element(a,par5) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Population Variance",header=TRUE) a<-table.element(a,par4) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"z(alpha/2) + z(beta)",header=TRUE) a<-table.element(a,z) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"z(alpha) + z(beta)",header=TRUE) a<-table.element(a,z1) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Minimum Sample Size (2 sided test)",header=TRUE) a<-table.element(a,n) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Minimum Sample Size (1 sided test)",header=TRUE) a<-table.element(a,n1) a<-table.row.end(a) a<-table.end(a) table.save(a,file="mytable.tab") (ni <- z24 / (par2sq)) (ni1 <- z24one / (par2sq)) a<-table.start() a<-table.row.start(a) a<-table.element(a,"Minimum Sample Size (for Infinite Populations)",2,TRUE) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Population Size",header=TRUE) a<-table.element(a,"infinite") a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Margin of Error",header=TRUE) a<-table.element(a,par2) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Confidence",header=TRUE) a<-table.element(a,par3) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Power",header=TRUE) a<-table.element(a,par5) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Population Variance",header=TRUE) a<-table.element(a,par4) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"z(alpha/2) + z(beta)",header=TRUE) a<-table.element(a,z) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"z(alpha) + z(beta)",header=TRUE) a<-table.element(a,z1) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Minimum Sample Size (2 sided test)",header=TRUE) a<-table.element(a,ni) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Minimum Sample Size (1 sided test)",header=TRUE) a<-table.element(a,ni1) a<-table.row.end(a) a<-table.end(a) table.save(a,file="mytable.tab") (z <- abs(qt((1-par3)/2,n-1)) + abs(qt(1-par5,n-1))) (z1 <- abs(qt(1-par3,n1-1)) + abs(qt(1-par5,n1-1))) z2 <- z*z z2one <- z1*z1 z24 <- z2 * par4 z24one <- z2one * par4 par2sq <- par2 * par2 num <- par1 * z24 denom <- z24 + (par1 - 1) * par2sq (n <- num/denom) num1 <- par1 * z24one denom1 <- z24one + (par1 - 1) * par2sq (n1 <- num1/denom1) a<-table.start() a<-table.row.start(a) a<-table.element(a,"Minimum Sample Size (Unknown Population Variance)",2,TRUE) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Population Size",header=TRUE) a<-table.element(a,par1) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Margin of Error",header=TRUE) a<-table.element(a,par2) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Confidence",header=TRUE) a<-table.element(a,par3) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Power",header=TRUE) a<-table.element(a,par5) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Population Variance",header=TRUE) a<-table.element(a,"unknown") a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"t(alpha/2) + t(beta)",header=TRUE) a<-table.element(a,z) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"t(alpha) + t(beta)",header=TRUE) a<-table.element(a,z1) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Minimum Sample Size (2 sided test)",header=TRUE) a<-table.element(a,n) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Minimum Sample Size (1 sided test)",header=TRUE) a<-table.element(a,n1) a<-table.row.end(a) a<-table.end(a) table.save(a,file="mytable.tab") (z <- abs(qt((1-par3)/2,ni-1)) + abs(qt(1-par5,ni-1))) (z1 <- abs(qt(1-par3,ni1-1)) + abs(qt(1-par5,ni1-1))) z2 <- z*z z2one <- z1*z1 z24 <- z2 * par4 z24one <- z2one * par4 (ni <- z24 / (par2sq)) (ni1 <- z24one / (par2sq)) a<-table.start() a<-table.row.start(a) a<-table.element(a,"Minimum Sample Size
(Infinite Population, Unknown Population Variance)",2,TRUE) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Population Size",header=TRUE) a<-table.element(a,"infinite") a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Margin of Error",header=TRUE) a<-table.element(a,par2) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Confidence",header=TRUE) a<-table.element(a,par3) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Power",header=TRUE) a<-table.element(a,par5) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Population Variance",header=TRUE) a<-table.element(a,"unknown") a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"t(alpha/2) + t(beta)",header=TRUE) a<-table.element(a,z) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"t(alpha) + t(beta)",header=TRUE) a<-table.element(a,z1) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Minimum Sample Size (2 sided test)",header=TRUE) a<-table.element(a,ni) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Minimum Sample Size (1 sided test)",header=TRUE) a<-table.element(a,ni1) a<-table.row.end(a) a<-table.end(a) table.save(a,file="mytable.tab")
 Top | Output | Charts | References

 Cite this software as: Wessa P., (2018), Minimum Sample Size (Testing Mean) (v1.0.3) in Free Statistics Software (v1.2.1), Office for Research Development and Education, URL http://www.wessa.net/rwasp_samplenorm.wasp/ The R code is based on : NIST/SEMATECH e-Handbook of Statistical Methods, http://www.itl.nist.gov/div898/handbook/, 2006-11-12.
 Top | Output | Charts | References
 To cite Wessa.net in publications use:Wessa, P. (2019), Free Statistics Software, Office for Research Development and Education, version 1.2.1, URL https://www.wessa.net/ © All rights reserved. Academic license for non-commercial use only. The free use of the scientific content, services, and applications in this website is granted for non commercial use only. In any case, the source (url) should always be clearly displayed. Under no circumstances are you allowed to reproduce, copy or redistribute the design, layout, or any content of this website (for commercial use) including any materials contained herein without the express written permission. Information provided on this web site is provided "AS IS" without warranty of any kind, either express or implied, including, without limitation, warranties of merchantability, fitness for a particular purpose, and noninfringement. We use reasonable efforts to include accurate and timely information and periodically update the information, and software without notice. We make no warranties or representations as to the accuracy or completeness of such information (or software), and it assumes no liability or responsibility for errors or omissions in the content of this web site, or any software bugs in online applications. Your use of this web site is AT YOUR OWN RISK. Under no circumstances and under no legal theory shall we be liable to you or any other person for any direct, indirect, special, incidental, exemplary, or consequential damages arising from your access to, or use of, this web site. Software Version : 1.2.1Algorithms & Software : Patrick Wessa, PhDServer : www.wessa.net
 © Wessa.Net 2002-2019