# Statistics

## Sample Size

We can calculate the required sample size to reach a certain confidence level.

For the confidence level, the value we add/subtract to the mean is called the sampling error, E. Thus, the confidence intervals could be expressed as

$\mu \approx \bar{x} \pm E$

where

$E=z_{\alpha/2}\left(\frac{\sigma}{\sqrt{n}}\right)$

We can rearrange E to solve for the sample size required to reach a specific confidence level.

 Determining the Sample Size for a Confidence Interval for $$\mu$$. $n=\frac{(z_{\alpha/2})^2\sigma^2}{E^2}$ when you do not have $$\sigma$$ and the sample size is expected to be small. $n=\frac{(t_{\alpha/2})^2\sigma^2}{E^2}$
 Determining the Sample Size for a Confidence Interval for Proportions, $$p$$. $E=z_{\alpha/2}\sqrt{\frac{pq}{n}}$ $n=\frac{(z_{\alpha/2})^2 pq}{E^2}$

Example: Suppose you wish to estimate a population mean correct to within 0.15 with a confidence level of 0.90. $$\sigma^2$$ is approximately equal to 5.4. Find the sample size required.

Solution:

The population variance is 5.4, so we know we can use the z-statistic a 90% confidence level. $$z_{0.10/2}=1.645, E=0.15$$

$n=\frac{(1.645)^2(5.4)}{(0.15)^2}=649.446$

You need more than 649 data points, so we round up to a sample size 650 to obtain a 90% confidence interval with a sampling error within 0.15.