Solved – How to calculate a confidence interval for a series of Bernoulli Trials

bernoulli-processconfidence intervalhypothesis testingprobabilityrange

I have to test if a event have a p probability of happening. I can run this event as much times I like (given it can be run by a computer). So I was searching a way to test if the probability of this event is in an acceptable range for my case.

How can I compute, given $n$ Bernoulli Trials with probability $p$ ($P(\text{Success}) = p$ and $P(\text{Failure}) = 1-p$), the probability of ($\text{no. of successes}/n$) be within a range of $[p-a, p+a]$? [1]

Example: given 100 events, whats the probability of the proportion of successes to be greater than 45% but lesser than 55% of the total number of events?

(Apologize my lack of formalization, I have little background in statistics, only studied it in my graduation, but you can point me to the concepts and theories that I need to study to solve this problem).

Edit:

Seeing now the answers I see that I poorly asked my question.

This [1] was just a way that I thought I could achieve what I want, which is:

I have an event that I expect it to have a probability $p$ of yielding success and $1-p$ probability of yielding failure. By observing this event $n$ times, I can infer the $p'$ observed probability of that event succeeding ($\text{no of success}/n$). So I want to compare $p$ against $p'$ and check if my initial guess (which is $p$) is correct, in other words, I want to be able to claim that my event has a 99% chance of having a $p \pm \alpha$ probability of succeeding.

I thought on doing a Hypothesis Test but I couldn't quite fit my problem into it.

Best Answer

Contrary to the other answer, you don't need approximations in here. If $x$ is the number of success and $n$ is the number of trials, then you are looking for

$$ \Pr\{p-a \le \tfrac{x}{n} \le p+a\} = \Pr\{np-na \le x \le np+na\} $$

The sum of $n$ independent Bernoulli trials, each with probability of success $p$, follows binomial distribution. Knowing this, you can calculate things like

$$ \Pr\{x \le np+na\} = F_X(np+na) $$

where $F_X$ is the binomial cumulative distribution function, and use it to calculate the probability of interest.