Statistics - Calculate probability of occurrence from small number of tests I'm sure this is basic statistics, but I'm not even sure of the right words for the concepts I'm dealing with.  I took statistics in college but it was ... well ... a few years ago.
Let's say there's an event that happens randomly every X% of the time.  If I run my test Y times, there's a nice bell curve I can generate that shows the likelihood of the event happening 1, 2, ... Y times during my Y tests.
I'm actually working on the inverse of this - let's say I don't know X%, but I know I ran my test Y times and the event happened W times.  I can't say for sure what X% is, but it seems like I should be able to say "there's a 90% likelihood that X is in the range X1 to X2" or something like that.
 A: Suppose you see your 'event' happen $X = 35$ times in $n = 100$ independent performances of your procedure. (Jargon: 35 "Successes" in $n$ trials.)
Then $\hat p = X/n = 0.35$ is the estimate of the probability of occurrence. A traditional 'Wald 95% confidence interval' for the true (population) value of $p$ is of the form
$$\hat p \pm 1.96\sqrt{\frac{\hat p(1-\hat p)}{n}}.$$
In my example: this computes to $0.35 \pm 0.0935$ or $(0.2565, 0.4435).$
This interval is based on two assumptions (1) that $n$ is large enough for binomial proportion $\hat p$ to be nearly normal (your "nice bell-shaped" distribution) and (2) that $\hat p$ is reasonably close to $p$. 
The latter assumption says it is OK to use $\hat p$ instead of  $p$ in the term with the square root. Experience has shown that the
combination of these two assumptions often results
in confidence intervals that do not really cover (include) the true value of $p$ 95% of the time.
An improved style of confidence interval due to Agresti and Coull. Essentially to avoid the second assumption, it uses $\check p = (X+2)/(n+4)$ and
$\check n = n+4$ to make the more accurate 95% interval
$$\check p \pm 1.96\sqrt{\frac{\check p(1-\check p)}{\check n}}.$$
If $n$ exceeds a few hundred, this adjustment (in effect, appending two successes and two failures to the data) is usually too small to be of practical consequence.
In my example, the resulting 95% confidence interval is: $0.3558 \pm 0.0920$ or
$(0.2638. 0.4478).$
Notes: (1) If you want a confidence level other than 95%, use an appropriate replacement for 1.96 [1.96 cuts 2.5% of the probability from the upper tail of a standard normal distribution.]
(2) On this site or on the Internet you can get more background and details by searching for
'binomial confidence interval', 'Wald confidence interval', and 'Agresti-Coull confidence interval'. Here is one possibly interesting link.
