1.000 people attempted a task and 30 succeeded. Given this information, we can say that the success rate was 3%.

But what if I want to estimate from this sample a confidence interval for the success rate in the population? For example, given that previous data, the success rate is between let's say 1% and 5% in 95% of cases.

How can I calculate that interval with a 95% certainty? is there any tool online?

Thank you, Luca


If you have a binomial with $n=1000$ and $p=0.03$ the outcome of one sampling of this distribution is $k$. You're looking for the interval from $k-\Delta$ to $k+\Delta$ which contains 95% of the probability of this distribution. Defining $F(x) = P(X \leq x)$ then you need to solve the following equation for $\Delta$:

$$F(k+\Delta) - F(k-\Delta) = 0.95$$

Given that the expression for $F$ is awkward, I'm imagining this that to be done numerically.

| cite | improve this answer | |
  • $\begingroup$ The problem isn't awkwardness: it's that you don't even know $F$! $\endgroup$ – whuber Mar 27 '18 at 20:23
  • $\begingroup$ What do you mean? If the PMF is binomial, the CDF is just a finite sum. Awkward, but totally known. $\endgroup$ – oneloop Mar 27 '18 at 20:40
  • $\begingroup$ On the contrary, the entire point to a CI is that you do not know the underlying distribution. If you know $F$ then you know $p$ and there's nothing to estimate. $\endgroup$ – whuber Mar 27 '18 at 21:34
  • $\begingroup$ There's at least two ways to interpret the original question. One is "1000 people attempted task and 30 succeeded, what's the underlying distribution?". That's not how interpreted it. I interpreted it as: "we know we have a binomial with p=0.03, what's the interval of likely outcomes." If you look at the original LucaP question, he says "But what if I want to know what the success rate actually is?", which is a lot more ambiguous than rolando2's edited version. $\endgroup$ – oneloop Mar 28 '18 at 7:53
  • $\begingroup$ In other words, if you take rolando2's edited version as ground truth, then I agree with you that this is an inference problem, the distribution isn't known, and therefore my response doesn't apply. If you take LucaP's original version as ground truth, I would say it's ambiguous, but I can also see how you can read it as being a question about inference. $\endgroup$ – oneloop Mar 28 '18 at 10:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.