Solved – Confidence interval for the population mean

confidence intervalnormal distributionsample

I learned that we can use $[\hat{\mu} – 1.96 \hat{\sigma}/\sqrt{n}, \hat{\mu} + 1.96 \hat{\sigma}/\sqrt{n}]$ as a confidence interval for the population mean, given a sample from the population, where $\hat{\mu}$ is the sample mean and $\hat{\sigma}$ is the sample SD and $n$ is the size of the sample.

However, I have a doubt about whether this is valid. I understand that the sample SD $\hat{\sigma}$ can be used as an estimator for the population SD $\sigma$, and that we can use the CLT to approximate the distribution of the sample mean as approximately normal. However, it seems that this confidence interval doesn't take into account the uncertainty in the population SD from drawing a sample (the population SD might be a bit larger or smaller than the sample SD), so intuitively, it seems like this formula might give me a confidence interval that is too narrow. So, is the formula above actually valid, and if so, why? Or is it not valid?

I prefer to avoid assuming that the population distribution is normal, though I'm also interested in the special case where the population is normally distributed.

Best Answer

The 95% confidence interval $\bar X \pm 1.96\frac{\sigma}{\sqrt{n}}$ for unknown $\mu$ is correct for normal data when the population standard deviation $\sigma$ is known. It is approximately correct for moderately large $n,$ when $\sigma$ is estimated by the sample standard deviation $S.$

However, you are correct to doubt this so-called 'z-interval' when $\sigma$ is estimated by $S$ and the sample size is small. Then the exact 95% CI for $\mu$ is given by $\bar X \pm t^*\frac{S}{\sqrt{n}},$ where $\pm t^*$ cut probability $0.025 = 2.5\%$ from the upper and lower tails, respectively, of Student's t distribution with $\nu = n-1$ degrees of freedom. [For example, if $n = 10,$ then $t^* = 2.262;$ computation in R.]

qt(.975, 9))
[1] 2.262157

At the 95% level in particular, $t^* \approx 2$ when $n \ge 30,$ so the z-interval gives pretty good results for $n \ge 30.$

qnorm(.975);  qt(.975,33)
[1] 1.959964
[1] 2.034515

More generally, for confidence level $(1 - \alpha)\%.$ there are other sample sizes $n$ at which $t^*$ is sufficiently near the $z^*$ that cuts probability $\alpha/2$ from the upper tail of the (symmetrical) standard normal distribution.

[For example, depending on ones degree of fussiness, something like $n=400$ might be large enough for a 98% CI; something like $n=12$ might be large enough for an 80% CI. But it is simpler just to use 't-intervals' whenever $\sigma$ is unknown and estimate by $S.]$

qnorm(.99);  qt(.99,400)
[1] 2.326348
[1] 2.335706

qnorm(.90);  qt(.90,11)
[1] 1.281552
[1] 1.36343

Note: You may sometimes see $n = 30$ given as a large enough sample size to pretend that the z-interval may be used even for non-normal data, and this can be very bad advice depending on the actual population distribution.

Related Question