Solved – Calculate sample size from margin of error and confidence level

sample-size

I need to calculate the sample size for the data I have. I am given a margin of error5% with a confidence level 95% .

Which formula can I use to get the sample size value if the total population size is X?
Sorry, I searched the internet but couldn't find a formula for this purpose.

https://www.statisticshowto.com/probability-and-statistics/find-sample-size/#Cochran

Any help is appreciated.

Best Answer

If you are estimating a binomial proportion near to $p\approx 1/2$ based on a sample of size $n,$ then a 95% CI is of the form $\hat p \pm 1.96\sqrt{\hat p(1-\hat p)/n}.$ for which the margin of error is $$M = 1.96\sqrt{\hat p(1-\hat p)/n} \approx 1.96\sqrt{(1/2)(1/2)/n}\\ = 1.96\sqrt{1/4n} \approx 1/\sqrt{n}.$$

So, if $M = 0.05 = 5\%.$ then $n \approx 1/M^2 = 1/(.05)^2 = 400.$

You do not give many details about the parameter being estimated or the kind of confidence being used. My computations above are based on estimating binomial success probability $p \approx 1/2,$ as in some election polling situations. This is the only elementary application I know about where your information is sufficient.

If this is not the application you have in mind, then you will need to give more information: for example, the approximate value of $p$ for a binomial CI or an estimate of population variance $\sigma^2$ if you are trying to estimate the mean $\mu$ of a normal population. Other applications of confidence intervals may require various additional information.