# 95% confidence interval using standard error of a proportion

#### throughstream2

##### New Member
Hi, firstly apologies my stats knowledge is limited.

I am looking at linear binomial regression.

I have a study that has a yes or no output so binomial. Out of 50 cases I get a yes rate of 49 so a probability of success (p) value of 98%. I want to work out the 95% confidence of this probability of success. My tutor has stated that I should use the standard error of a proportion:

Using this formula gives me a standard error rate of 0.019799

I believe I then add the p value to the standard error rate to work out the confidence interval which in this case = 96-100%

However is that at a 95% confidence interval, I read that doing the above calculation give 68% CI and I need to multiple the SE by 1.96. However it doing so the confidence intervals would be higher than 100% which is impossible?

Any help would be most appreciated.

#### throughstream2

##### New Member
Hi thank you so much for getting back to me:

I wondered if you could help me with a worked example.

I presume you are referring to the following formulae when you suggest using beta distribution confidence interval:

From the original information:

Alpha = 0.05
K= 49
n=50
Betainv = not sure how you know/calculate this?
I'm guessing the (,) indicate to multiple.

Again thank you so much for your help.

#### checkthebias

##### New Member
Betainv is the cumulative distribution function.
Beta distribution has two shape parameters (alfa and beta), so you need to calculate the cumulative distribution function Betainv(0.975, alfa, beta).

#### obh

##### Active Member
Hi,

I think that the sample size of 50 is small enough to use the binomial distribution instead of any other approximation distribution.
Since the distribution is discrete the confidence level won't be exactly the required level.

On the other hand, maybe sample size of 50 is big enough to use the normal distribution even with a high ratio??
It would be interesting to run a simulation to check.

#### throughstream2

##### New Member
Betainv is the cumulative distribution function.
Beta distribution has two shape parameters (alfa and beta), so you need to calculate the cumulative distribution function Betainv(0.975, alfa, beta).
Hi thank you, sorry this is still a bit beyond me can I just check so for calculating Betainv is α = # of successes in n trials and β = # of failures in n trials.
Which is straight forward to calculate in excel.

So where does this formulae come into play?

Last edited:

#### EdGr

##### Member
I would recommend using the exact method. Do it in Excel.

=1-BINOM.DIST(48,50,0.90,TRUE)

This formula calculates the probability of getting from 0 to 48 successes in 50 trials if the probability on each trial is 0.9. This is then subtracted from 1 to give the probability of getting *more* that 48 successes (since you had more, namely 49).

You then fool around with the 0.90 proportion until you find a value that gives exactly 0.05 probability of getting greater than 48/50. That value of p is your lower bound 95% one-tailed CI. I would do this one-tailed -- the upper bound is basically 1.

For example, using 0.9 I get 0.033. So, if the true proportion was 0.9, I would get more than 48 only 3.3% of the time. If the true proportion was 0.9, you would get an observed value of 48 or less 1 - 0.033 or 96.7% of the time. By definition, 0.9 is the lower bound of a one-tailed 0.967 CI.

You want a value such that the observed data would occur only 5% of the time or more, thus you can be (sort of) 95% sure the true value is no bigger than it. That's how we interpret CI (it isn't technically correct, of course).

But of course, you want a 0.95 CI. Somewhere around 0.91. Play with it!

#### throughstream2

##### New Member
Hi, I've had a chance to look through your comment and again it's really helpful.

Within this test I agree that with 48 successes out of 50 the upper bound is basically 1 however if I had a similar test which has say 38 success out of 50 how do I go about finding the upper bound?

Can you explain a bit more why this is only "sort of 95% sure" and "technically not correct".

Last edited: