# C.I. for $Bin(n,p)$ using pivots

Problem: Let $X$ be $Bin(n,p)$ and $\hat p = X/n$, and $$Z=\frac{\hat p - p}{\sqrt{p(1-p)/n}}$$ We see that $Z$ is asymptotically $N(0,1)$. Find a $1-\alpha$ confidence interval for $p$. Note that this is very different from the regular $$\frac{\hat p - p}{\sqrt{\hat p(1-\hat p)/n}}$$

Attempt: I think I should use a Wald (or perhaps a Score) interval to solve this. I have found this document that describes how it's done, but I don't know if it's the right approach. Furthermore, it's an undergrad course in probability so we don't know very much.

• Search 'Wilson binomial confidence interval' on this site (already essentially answered by me and others) and also on the Internet. The Wald interval is 'not the droid your looking for', Bootstrapping can be a valuable tool for finding CIs for parameters of various distributions, but bootstrapping the binomial success probability is essentially equivalent to mindless simulation. Oct 16, 2015 at 7:02
• Oct 16, 2015 at 8:00
• So I would get $$\frac{1}{1 + \frac{1}{n} z_{\alpha/2}^2} \left[ \hat p + \frac{1}{2n} z_{\alpha/2}^2 \pm z_{\alpha/2} \sqrt{ \frac{1}{n}\hat p \left(1 - \hat p\right) + \frac{1}{4n^2}z_{\alpha/2}^2 } \right]$$ Oct 16, 2015 at 8:01
• Yes. That's what you get when you 'pivot' or 'invert the test' for $H_0: p = p_0$ vs $\ne$ (essentially getting an interval of 'acceptable' $p_o$'s).This involves solving a moderately messy quadratic inequality. The 'Agresti' style 95% CI, comes directly from this by conflating $z_{.025} = 1.96$ with $2$, doing some cancellation and ignoring a term that is tiny for even moderate $n$. Oct 16, 2015 at 15:11

We can use the formula $$\frac{1}{1 + \frac{1}{n} z_{\alpha/2}^2} \left[ \hat p + \frac{1}{2n} z_{\alpha/2}^2 \pm z_{\alpha/2} \sqrt{ \frac{1}{n}\hat p \left(1 - \hat p\right) + \frac{1}{4n^2}z_{\alpha/2}^2 } \right]$$