Why Put an Interval Around a Simulated Probability?
Suppose a simulation estimates the probability of an event by generating many independent trials and counting how often the event occurs. The observed proportion is an estimate, not the event's known probability. A confidence interval summarizes the sampling uncertainty in that estimate: it gives a range of probability values compatible with the simulation result under a stated procedure.
This tutorial considers three intervals for a probability estimated from independent Bernoulli trials: the Wald interval, the Wilson score interval, and the exact binomial interval. They use the same trial data but can give noticeably different endpoints, especially with few events or an estimated probability near 0 or 1. The methods are aligned with the SOA Exam ASTAM (Advanced Short-Term Actuarial Mathematics) syllabus.
The equal-probability assumption means that each trial estimates the same target probability. For example, independent simulations of identically specified hypothetical claim-generating scenarios may estimate the probability that a simulated annual loss exceeds a specified threshold. If trials are dependent, or if their event probabilities differ, the binomial interval formulas below need not be valid.
A \(100(1-\alpha)\%\) confidence procedure is designed so that, over repeated samples under its assumptions, its intervals contain the fixed probability \(p\) at the stated rate (or at least that rate for a conservative procedure). After observing one interval, it is not correct to say that the fixed \(p\) has probability \(1-\alpha\) of being inside it. The interval is random before the simulation; \(p\) is fixed.
The Wald Interval
The Wald interval uses the estimated standard error of the simulated proportion and a normal approximation. For a two-sided confidence level \(1-\alpha\), let \(z_{1-\alpha/2}\) be the \(1-\alpha/2\) quantile of the standard normal distribution. The interval is
The estimated standard error follows from the binomial variance. Since \(K\) is a sum of independent Bernoulli variables, \(\operatorname{Var}(K)=np(1-p)\), so \(\operatorname{Var}(\hat p)=p(1-p)/n\). Replacing the unknown \(p\) by \(\hat p\) gives the estimated standard error in the formula. The normal approximation is most defensible when the event and non-event counts are both sufficiently large; it can behave poorly near the boundaries.
Worked Example: Wald Interval for a Simulated Exceedance Probability
A hypothetical annual-loss model is simulated independently \(100\) times. In \(25\) trials, the annual loss exceeds a specified threshold. Find a two-sided 95% Wald interval for the exceedance probability. The model is the same on each trial; there is no interest-rate or mortality assumption in this event-probability calculation.
Step 1: Estimate the probability. Here \(n=100\), \(K=25\), and
Step 2: Calculate the estimated standard error.
Step 3: Calculate the margin and endpoints. For a 95% interval, use \(z_{0.975}=1.96\). The margin is \(1.96(0.0433013)=0.0848705\). Thus the unrounded endpoints are \(0.25-0.0848705=0.1651295\) and \(0.25+0.0848705=0.3348705\).
Rounded to four decimal places, the Wald interval is \([0.1651,0.3349]\). The method used is the normal-approximation Wald procedure. The observed counts, 25 events and 75 non-events, are not near zero, although the interval's accuracy still depends on the approximation.
The Wilson Score Interval
The Wilson interval avoids simply centering a normal interval at \(\hat p\). Instead, it inverts the score test for each candidate probability \(p\). For a two-sided confidence level \(1-\alpha\), write \(z=z_{1-\alpha/2}\). The Wilson endpoints are
The “plus or minus” in this expression gives the lower and upper endpoints, respectively. The resulting interval remains within \([0,1]\) and usually behaves better than the Wald interval when the event count is small or the estimate is close to a boundary.
Multiplying through by \(p(1-p)/n\) and collecting terms gives a quadratic inequality in \(p\):
The roots of this quadratic are the boundary values that satisfy equality. Applying the quadratic formula and dividing the numerator and denominator by \(2n\) gives the Wilson endpoints above. Thus the interval is obtained by inverting a test, rather than by attaching a symmetric margin directly to \(\hat p\).
Worked Example: Wilson Interval With a Moderate Event Count
In \(40\) independent trials of a hypothetical aggregate-loss model, \(8\) trials produce a loss above a specified threshold. Find a two-sided 90% Wilson interval for the probability of exceeding that threshold. The trials share the same model and event definition.
Step 1: Identify the inputs. The estimate is \(\hat p=8/40=0.2\). For a 90% interval, \(z=z_{0.95}=1.644854\) and \(z^2=2.705543\).
Step 2: Calculate the denominator and center.
Step 3: Calculate the half-width.
Step 4: Form the interval. The endpoints are \(C-H=0.219006-0.102459=0.116547\) and \(C+H=0.219006+0.102459=0.321465\). Rounded to four decimal places, the Wilson interval is \([0.1165,0.3215]\). The method uses the score-test inversion and avoids assuming the interval must be symmetric around the observed proportion.
The Exact Binomial Interval
The exact binomial interval, also called the Clopper–Pearson interval, uses the binomial distribution directly rather than a normal approximation. For observed count \(K=k\), a two-sided interval assigns tail probability \(\alpha/2\) to each side. For \(0<k<n\), its lower endpoint \(p_L\) and upper endpoint \(p_U\) solve
These equations are solved numerically in general. The tails are discrete, so the procedure is conservative: its actual coverage is at least the nominal confidence level, but can exceed it. At a boundary, the missing tail is handled by setting the corresponding endpoint to 0 or 1. In particular, if \(k=0\), the lower endpoint is 0 and the upper endpoint solves
Worked Example: Exact Interval With No Simulated Events
A hypothetical event is recorded in \(0\) of \(40\) independent simulation trials. Find the two-sided 95% exact binomial interval for its probability. Assume all trials use the same event definition and have the same probability \(p\).
Step 1: Set the observed count and tail probability. Here \(k=0\), \(n=40\), and \(\alpha=0.05\), so \(\alpha/2=0.025\). The lower endpoint is 0 because no observed event count can provide a positive lower endpoint under this boundary construction.
Step 2: Solve for the upper endpoint. The probability of observing zero events if the true probability is \(p\) is \((1-p)^{40}\). Set this equal to \(0.025\):
The exact 95% interval is \([0,0.0881]\), rounded to four decimal places. Zero observed events do not establish that the true probability is zero. The upper endpoint quantifies how large \(p\) could be while remaining consistent with seeing no events this often under the specified exact procedure.
Choosing and Interpreting an Interval
| Method | Construction | Important feature |
|---|---|---|
| Wald | Normal approximation centered at \(\hat p\) | Simple, but can perform poorly near 0 or 1 and can extend outside \([0,1]\) |
| Wilson score | Inverts a binomial score test | Usually more reliable than Wald near boundaries; remains within \([0,1]\) |
| Exact binomial | Inverts binomial tail probabilities | At least nominal coverage under the binomial model; often conservative and wider |
The interval describes simulation error in estimating the event probability, conditional on the simulation model and its assumptions. It does not account for uncertainty about whether the model itself is appropriate, uncertainty in parameters supplied to the model, or uncertainty in the underlying real-world process. Those are distinct sources of uncertainty.
A frequent exam trap is to treat “no events observed” as evidence that \(p=0\), or to apply a Wald formula mechanically when \(\hat p\) is 0 or 1. If \(\hat p=0\), the Wald standard error is zero, which incorrectly produces the degenerate interval \([0,0]\). The exact boundary calculation above instead gives a positive upper endpoint. The Wilson interval also has a positive upper endpoint at this boundary.
Common Calculation Trap
For the Wald example with \(25\) events in \(100\) trials, a tempting but incorrect result is \([0.1653,0.3347]\). That pair corresponds to a margin of \(0.0847\), which is not the margin obtained from the stated standard error. The correct calculation is
so the endpoints are \(0.25-0.0848705=0.1651295\) and \(0.25+0.0848705=0.3348705\), or \([0.1651,0.3349]\) to four decimal places. Keep enough digits in the standard error and margin, and round only the final endpoints.
- Use the actual number of independent trials \(n\), not the number of events, as the denominator in \(\hat p=K/n\).
- Use \(z_{1-\alpha/2}\) for a two-sided interval; for a 95% interval this is approximately \(1.96\).
- Check that endpoints are between 0 and 1. An out-of-range Wald endpoint is a warning about that approximation, not a valid probability.
- Interpret a confidence level as a repeated-sampling property of a procedure, not as a probability statement about a fixed \(p\) after observing the interval.
Check Your Understanding
For each problem, assume the simulation trials are independent and have a common event probability unless stated otherwise. Answers are rounded to four decimal places where appropriate.
- A hypothetical claim model has \(18\) threshold exceedances in \(120\) independent trials. Calculate the two-sided 95% Wald interval. (Answer: \([0.0861,0.2139]\))
- A simulated event occurs \(3\) times in \(30\) independent trials. Calculate the two-sided 95% Wilson interval using \(z=1.96\). (Answer: \([0.0346,0.2562]\))
- No events occur in \(25\) independent trials. Find the upper endpoint of the two-sided 90% exact binomial interval and state the full interval. (Answer: \([0,0.1129]\))
- A model produces \(50\) events in \(100\) independent trials. Calculate the two-sided 95% Wald interval. (Answer: \([0.4020,0.5980]\))
- All \(40\) independent trials produce the event. Find the two-sided 95% exact binomial interval. (Answer: \([0.9119,1]\))