# Derivation for the confidence interval for a population proportion

I am having a conceptual hard time understanding where this formula came from. It does not seem to make any sense to me. Could someone shed some light on this:

The natural estimator of $p$ is $\hat p = \frac{X}{n}$, the same fraction of success. Since $\hat p$ is just $X$ multiplied by a constant, $\hat p$ has an approximately normal distribution. $E(\hat p) = p$ and $\sigma_{\hat p} = \sqrt{\frac{p(1-p)}{n}}$. Standardizing, this implies that:

$$P\left(-z_{\alpha/2} \lt \frac{\hat p- p}{\sqrt{p(1-p)/n}} \lt z_{\alpha/2}\right) \approx 1 - \alpha$$

Could someone derive this equation so that it makes sense to someone who's never seen this before?

-
Sure! Are you uncertain about the last formula or the lines before it as well. I.e., are you familiar with the binomial distribution, normal distribution and the central limit theorem? –  MånsT Apr 13 '12 at 5:49

The binomial distribution $B(n,p)$ is just the sum of of Bernoulli variables with sucess probability p. Therefore the Central Limit Theorem applies and if n is "large enough" you can approximate the binomial distribution by a normal distribution with the same mean np and the same variance $np(1-p)$. This means $\frac{X}{n}$ can be approximated by a normal distribution with mean $p$ and variance $p(1-p)$. The corresponding standard deviation is given by $\frac{\sqrt{np(1-p)}}{n}$ = $\sqrt{\frac{p(1-p)}{n}}$ .

The question then becomes when is n "large enough" and there are always lots of discussions about that. One of the shortcomings of the normal approximation is that it is always symmetrical and the binomial distribution is not for $p != 0$. This in turn has the effect that the confidence interval above may include values larger than 1 or smaller than 0, which obviously does not make sense. More seriously, it does not only include values that do not sense but it also does not have the stated coverage of $\alpha$.

There are other lots of discussion when the normal approximation makes sense, which depends not only on n but also on p. This Wikipedia Article http://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval is a very good starting, which also discusses better alternatives. The normal approximation is still widely in use, because it usually does a decent jobs and because it requires little calculations, which was important in times before computers.

-
This is an immediate consequence of the normal approximation to the sampling distribution of the mean (proportion). Note that if $Z$ were a standard normal RV (with mean 0 and sd 1), then we would have:
$$\mbox{P}\left( -z_{\alpha/2} < Z < z_{\alpha/2} \right) \approx 1-\alpha.$$
$$Z = \frac{\hat{p} - p}{\sqrt{p(1-p)/n}}$$