# What am I doing wrong in finding the confidence interval?

Question:

In a certain bio-engineering experiment, a successful outcome was achieved 60 times out of 125 attempts.

Construct a 95% confidence interval for the probability, p, of success in a single trial.

My Attempt

We know that the confidence interval is:

$$(p-ks,p+ks)$$ Where s is the standard error.

I found the k value using Matlab code:

k=norminv(0.975)=1.9600

Also:

$$p=60/125=0.48$$

Standard Error:

$$s=\sqrt{\frac{p(1-p)}{n}}=\sqrt{\frac{0.48\cdot0.52}{125}}=0.04469$$

We get the Confidence Interval:

$$(0.392,0.568)$$

But my answer is wrong. Is there anything I'm missing out here?

In the next part:

The researchers expected a successful outcome 70% of the time. Is the data consistent with this hypothesis?

Obviously, 0.7 doesn't lie in the Confidence Interval which I calculated (which is wrong). So, how do we approach such a problem?

• You should compute the Clopper Pearson interval. You take the binomial density and take 2.5% (at most) in each tail. – user83346 Mar 28 '16 at 8:26
• @fcop Do you mean Binomial proportion confidence level? Isn't that what I have done? Thanks. – The Artist Mar 28 '16 at 8:32
• @fcop After reading a bit of it on Wikipedia, I found that I have never done such a thing. So I can't/don't know how to use it. – The Artist Mar 28 '16 at 8:34
• How do you know the confidence interval is wrong? What is the right interval? – Greenparker Mar 28 '16 at 12:33
• What types of confidence intervals for a proportion did you learn? – Michael M Mar 28 '16 at 14:14

## 2 Answers

From what I can see, there are no errors in your method. It is possible that you made rounding error in your calculations. Doing this in R

> prop.test(60, 125, correct = FALSE)

1-sample proportions test without continuity correction

data:  60 out of 125, null probability 0.5
X-squared = 0.2, df = 1, p-value = 0.6547
alternative hypothesis: true p is not equal to 0.5
95 percent confidence interval:
0.3943277 0.5668649
sample estimates:
p
0.48


Thus, the confidence interval is $(.394, .567)$. Since $.70$ is not in this interval, at $\alpha = .05$, you can conclude that you will reject the null hypothesis that $H_0: p = .70$ against the alternative that $H_0: p\ne .70$.

Here are my results for calculating the probability of success, p value and confidence intervals. Besides the slight rounding differences, it looks likes 70% was the p value, which is the percent by which the results can be explained by the null hypothesis.

data:  60 and 125
number of successes = 60, number of trials = 125, p-value = 0.7207
alternative hypothesis: true probability of success is not equal to 0.5
95 percent confidence interval:
0.3898361 0.5711333
sample estimates:
probability of success
0.48