Minimum sample size

\(\begin{aligned} \textrm{Sample size(n)} =\left(\frac{z}{\textrm{Margin of error}( \pm \%)} \right )^{2}\times p\left ( 1-p \right ).\;p=0.5 \end{aligned}\)

\(\begin{aligned} \textrm{Standard normal distribution:}\;z\sim \textrm{N}\left(μ=0,\;σ=1\right ) \end{aligned}\)

confidenceLevel <- c(99.9999,99.999,99.99,99.9,99,seq(95,50,by=-5)) # Unit:%
z <- round(qnorm((100-confidenceLevel)/2/100,mean=0,sd=1,lower.tail=F),3)
marginError <- c(0.01,0.1,0.5,1,2,3,4,5,10) # Unit:%
sampleSize <- c(10,20,50,100,500,1000,10000,50000,100000)
p <- 0.5
buf <- format(sapply(marginError,function(x){p*(1-p)*(z/(x/100))^2}),scientific = T)
resultTable <- data.frame(confidenceLevel,z,buf,stringsAsFactors = F)
Minimum required sample size from confidence level and margin of error.
Confidence level(%) z Error of margin
0.01(±%)
Error of margin
0.1(±%)
Error of margin
0.5(±%)
Error of margin
1(±%)
Error of margin
2(±%)
Error of margin
3(±%)
Error of margin
4(±%)
Error of margin
5(±%)
Error of margin
10(±%)
99.9999 4.892 5.982916e+08 5.982916e+06 2.393166e+05 5.982916e+04 1.495729e+04 6.647684e+03 3.739323e+03 2.393166e+03 5.982916e+02
99.999 4.417 4.877472e+08 4.877472e+06 1.950989e+05 4.877472e+04 1.219368e+04 5.419414e+03 3.048420e+03 1.950989e+03 4.877472e+02
99.99 3.891 3.784970e+08 3.784970e+06 1.513988e+05 3.784970e+04 9.462426e+03 4.205523e+03 2.365606e+03 1.513988e+03 3.784970e+02
99.9 3.291 2.707670e+08 2.707670e+06 1.083068e+05 2.707670e+04 6.769176e+03 3.008523e+03 1.692294e+03 1.083068e+03 2.707670e+02
99 2.576 1.658944e+08 1.658944e+06 6.635776e+04 1.658944e+04 4.147360e+03 1.843271e+03 1.036840e+03 6.635776e+02 1.658944e+02
95 1.96 9.604000e+07 9.604000e+05 3.841600e+04 9.604000e+03 2.401000e+03 1.067111e+03 6.002500e+02 3.841600e+02 9.604000e+01
90 1.645 6.765063e+07 6.765063e+05 2.706025e+04 6.765063e+03 1.691266e+03 7.516736e+02 4.228164e+02 2.706025e+02 6.765062e+01
85 1.44 5.184000e+07 5.184000e+05 2.073600e+04 5.184000e+03 1.296000e+03 5.760000e+02 3.240000e+02 2.073600e+02 5.184000e+01
80 1.282 4.108810e+07 4.108810e+05 1.643524e+04 4.108810e+03 1.027202e+03 4.565344e+02 2.568006e+02 1.643524e+02 4.108810e+01
75 1.15 3.306250e+07 3.306250e+05 1.322500e+04 3.306250e+03 8.265625e+02 3.673611e+02 2.066406e+02 1.322500e+02 3.306250e+01
70 1.036 2.683240e+07 2.683240e+05 1.073296e+04 2.683240e+03 6.708100e+02 2.981378e+02 1.677025e+02 1.073296e+02 2.683240e+01
65 0.935 2.185563e+07 2.185563e+05 8.742250e+03 2.185563e+03 5.463906e+02 2.428403e+02 1.365977e+02 8.742250e+01 2.185562e+01
60 0.842 1.772410e+07 1.772410e+05 7.089640e+03 1.772410e+03 4.431025e+02 1.969344e+02 1.107756e+02 7.089640e+01 1.772410e+01
55 0.755 1.425063e+07 1.425063e+05 5.700250e+03 1.425063e+03 3.562656e+02 1.583403e+02 8.906641e+01 5.700250e+01 1.425062e+01
50 0.674 1.135690e+07 1.135690e+05 4.542760e+03 1.135690e+03 2.839225e+02 1.261878e+02 7.098063e+01 4.542760e+01 1.135690e+01
  • e.g.:The minimum required sample size where the target accuracy of a survey is set to confidence level as 95% and margin of error(margin of sampling error) as ± 5% is 385.
  • The minimum sample size required for the population parameter(e.g. average) to be within the margin of error(±%) of the sample parameter with a confidence level.
  • Premise: Central limit theorem

Margin of error

buf <- format(sapply(sampleSize,function(x){100*z/(x/(p*(1-p)))^0.5}),scientific = T)
resultTable <- data.frame(confidenceLevel,z,buf,stringsAsFactors = F)
Margin of error from sample size and confidence level.
Confidence level(%) z Sample size
10
Sample size
20
Sample size
50
Sample size
100
Sample size
500
Sample size
1000
Sample size
10000
Sample size
50000
Sample size
1e+05
99.9999 4.892 7.734931e+01 5.469422e+01 3.459166e+01 2.446000e+01 1.093884e+01 7.734931e+00 2.446000e+00 1.093884e+00 7.734931e-01
99.999 4.417 6.983890e+01 4.938356e+01 3.123291e+01 2.208500e+01 9.876712e+00 6.983890e+00 2.208500e+00 9.876712e-01 6.983890e-01
99.99 3.891 6.152211e+01 4.350270e+01 2.751352e+01 1.945500e+01 8.700541e+00 6.152211e+00 1.945500e+00 8.700541e-01 6.152211e-01
99.9 3.291 5.203528e+01 3.679450e+01 2.327088e+01 1.645500e+01 7.358900e+00 5.203528e+00 1.645500e+00 7.358900e-01 5.203528e-01
99 2.576 4.073014e+01 2.880056e+01 1.821507e+01 1.288000e+01 5.760111e+00 4.073014e+00 1.288000e+00 5.760111e-01 4.073014e-01
95 1.96 3.099032e+01 2.191347e+01 1.385929e+01 9.800000e+00 4.382693e+00 3.099032e+00 9.800000e-01 4.382693e-01 3.099032e-01
90 1.645 2.600973e+01 1.839166e+01 1.163191e+01 8.225000e+00 3.678332e+00 2.600973e+00 8.225000e-01 3.678332e-01 2.600973e-01
85 1.44 2.276840e+01 1.609969e+01 1.018234e+01 7.200000e+00 3.219938e+00 2.276840e+00 7.200000e-01 3.219938e-01 2.276840e-01
80 1.282 2.027020e+01 1.433320e+01 9.065109e+00 6.410000e+00 2.866639e+00 2.027020e+00 6.410000e-01 2.866639e-01 2.027020e-01
75 1.15 1.818310e+01 1.285739e+01 8.131728e+00 5.750000e+00 2.571478e+00 1.818310e+00 5.750000e-01 2.571478e-01 1.818310e-01
70 1.036 1.638060e+01 1.158283e+01 7.325626e+00 5.180000e+00 2.316566e+00 1.638060e+00 5.180000e-01 2.316566e-01 1.638060e-01
65 0.935 1.478365e+01 1.045362e+01 6.611448e+00 4.675000e+00 2.090724e+00 1.478365e+00 4.675000e-01 2.090724e-01 1.478365e-01
60 0.842 1.331319e+01 9.413846e+00 5.953839e+00 4.210000e+00 1.882769e+00 1.331319e+00 4.210000e-01 1.882769e-01 1.331319e-01
55 0.755 1.193760e+01 8.441157e+00 5.338656e+00 3.775000e+00 1.688231e+00 1.193760e+00 3.775000e-01 1.688231e-01 1.193760e-01
50 0.674 1.065688e+01 7.535549e+00 4.765900e+00 3.370000e+00 1.507110e+00 1.065688e+00 3.370000e-01 1.507110e-01 1.065688e-01
  • e.g.:Margin of error where confidence level as 95% and sample size as 500 is ± 4.38%.
  • Premise: Central limit theorem

Confidence level

buf <- format(sapply(sampleSize,function(x){z <- marginError/100*(x/(p*(1-p)))^0.5;100-pnorm(z,mean=0,sd=1,lower.tail=F)*2*100}),scientific = T)
resultTable <- data.frame(marginError,buf,stringsAsFactors = F)
Confidence level from margin of error and sample size.
Margin of error(±%) Sample size
10
Sample size
20
Sample size
50
Sample size
100
Sample size
500
Sample size
1000
Sample size
10000
Sample size
50000
Sample size
1e+05
0.01 5.046265e-02 7.136496e-02 1.128379e-01 1.595768e-01 3.568236e-01 5.046231e-01 1.595663e+00 3.567059e+00 5.042903e+00
0.1 5.046231e-01 7.136401e-01 1.128342e+00 1.595663e+00 3.567059e+00 5.042903e+00 1.585194e+01 3.452792e+01 4.729107e+01
0.5 2.522712e+00 3.567059e+00 5.637198e+00 7.965567e+00 1.769367e+01 2.481704e+01 6.826895e+01 9.746527e+01 9.984346e+01
1 5.042903e+00 7.126993e+00 1.124629e+01 1.585194e+01 3.452792e+01 4.729107e+01 9.544997e+01 9.999923e+01 1.000000e+02
2 1.006568e+01 1.419723e+01 2.227026e+01 3.108435e+01 6.289066e+01 7.940968e+01 9.999367e+01 1.000000e+02 1.000000e+02
3 1.504845e+01 2.115533e+01 3.286268e+01 4.514938e+01 8.202875e+01 9.422204e+01 1.000000e+02 1.000000e+02 1.000000e+02
4 1.997180e+01 2.794852e+01 4.283924e+01 5.762892e+01 9.263617e+01 9.885880e+01 1.000000e+02 1.000000e+02 1.000000e+02
5 2.481704e+01 3.452792e+01 5.204999e+01 6.826895e+01 9.746527e+01 9.984346e+01 1.000000e+02 1.000000e+02 1.000000e+02
10 4.729107e+01 6.289066e+01 8.427008e+01 9.544997e+01 9.999923e+01 1.000000e+02 1.000000e+02 1.000000e+02 1.000000e+02
  • e.g.:Confidence level where margin of error as ±5% and sample size as 500 is ± 97.5%.
  • Caution: There are cells in which the confidence level is displayed as 100%(originally less than 100).
  • Premise: Central limit theorem