# Confidence intervals for proportions

for a statistics exam I'm taking, there are questions involving hypothesis tests for proportions. A previous question was something along the lines of:

1000 shoppers at shop A are asked if they are satisfied with their shopping experience. 665 say yes. The shop claims that 70% of customers are satisfied. Carry out a hypothesis test at the 5% level of significance for this claim.

Null hypothesis: 70% of shoppers are satisfied Alternative hypothesis: It is not the case that 70% of shoppers are satisfied.

When I answered this question, I used the formula for the standard error for a proportion, i.e. $\sqrt{\frac{(p)(1-p)}{n}}$

My reasoning was that to test the null hypothesis, I would go to +/- 1.96 times this value to give the confidence interval around .7. If .665 was outside it, it would indicate that, if null hypothesis were true, our result of .665 would be more extreme than we would expect (at the 5% level of significance).

However, when I checked the answer, the instead of using $\sqrt{\frac{(p)(1-p)}{n}}$ , the marking scheme just used $\frac{1}{\sqrt{n}}$.

I'm confused as to when I should use $\sqrt{\frac{(p)(1-p)}{n}}$ and when I should use $\frac{1}{\sqrt{n}}$. Can anyone help?

• Franz, welcome to this site! A great place to learn. I think you need to use the tag "self-study" for your question. – Antoni Parellada Nov 22 '15 at 23:56

If we want to test whether a one sample proportion $p$ is consistent with a population parameter $p_o$ the score test statistic is:

$\text {test statistic} =\Large \frac{\hat p - p_o}{\sqrt{\frac{p_o\,(1\,-\,p_o)}{n}}}$, which follows a normal distribution, $N\sim(0,1)$. In your case it is not clear to me if you want to perform a one or a two-tailed test, which will determine whether the cutoff point is qnorm(0.975,lower.tail = F)[1] -1.959964 ($\small H_a: \hat p <p_o$), or qnorm(0.975) [1] 1.959964 ($H_a: \hat p \neq p_o$) for your alpha risk of 5%.

Notice that since we are testing under the $H_o$ how likely it is to get the $p$ we obtained, we use the population proportion $p_o$ to calculate the standard error, as opposed to the sample proportion we would use to build the confidence interval with a Wald interval:

$\large \hat p \pm Z_{1-\alpha/2} * \sqrt{\frac{\hat p\,(1\,-\,\hat p)}{n}}$

Alternatively, we can just run an exact binomial test, which doesn’t need to rely on the normal approximation:

$p(counts \leq 665)= \displaystyle \sum_{1}^{665} {1000\choose X} \,0.7^X\, 0.3^{1000-X}$

• It is interesting to note that for $\alpha=0.05$, $Z_{1-\alpha/2}$ is very close to $2$ and the worst possible standard error for a proportion is $\frac{1}{2}\cdot\frac{1}{\sqrt{n}}$, so that $\frac{1}{\sqrt{n}}$ is a simple upper bound on $Z_{1-\alpha/2}\sqrt{\frac{p(1-p)}{n}}$. I do wonder whether that's what was in their mind. – Glen_b Nov 23 '15 at 6:02
• Makes sense. My answer is boilerplate and dull - it doesn't address the issue. If we got more specific info, your idea could provide for an elegant answer. – Antoni Parellada Nov 23 '15 at 6:07
• I don't think there's really any problem with your answer. In any case it's very hard to guess what the true reason for the answer given might be -- without seeing a clearly explained reason for their answer it could be simply a mistake. We're left to either explain how things work (which I think you did), or to guess at their intent. – Glen_b Nov 23 '15 at 7:29