# How can I calculate the confidence interval for the mean of sample proportions?

I have a process that generates a sequence of events, where each event is of a certain type (let's say $A$, $B$, and $C$). The length of each generated sequence is random.

I wish to count the number of events of each type and calculate the probability that an event is of a certain type. For example, for the sequence $\left ( A, A, B \right )$, the proportion of $A$ events would be $\frac{2}{3}$, the proporition of $B$ events would be $\frac{1}{3}$, and the proportion of $C$ events would be $\frac{0}{3} = 0$.

Now, if I repeat the process $n$ times, I can calculate the sample mean for each of the probabilities. My question is: How can I calculate a confidence interval for these means? Can I use the usual normal procedure as long as my sample is big enough? It seems that I would risk getting an interval that goes below 0 or above 1, which would be meaningless. Also, it would intuitively seem that longer sequences carry more information (better estimates of the probabilities) and should be weighted accordingly.

## 1 Answer

I will assume that the number of occurrences for A, B, C is marginally binomial for each event type. For large n the normal approximation with the continuity correction can work as an approximate confidence interval. If the true proportion is close to either 0 or 1 the normal approximation will be less accurate and could have lower endpoint negative in the case p is close to 0 and the upper bound could go above 1 when p is close to 1.

Now the Clopper-Pearson method provides a relatively fast method for calculating exact binomial confidnce intervals for any n. So I would suggest going with the exact method. For a good reference, look at Statistical Intervals by Hahn and Meeker

• The events are not really independent -- does this change anything? – Vegard Sep 20 '12 at 8:19