Exact Binomial Test Calculator

Evaluate success counts against a hypothesised probability using the exact binomial test. This tool reports two-sided and tail-specific p-values, mid-p adjustments, and Clopper-Pearson confidence intervals, making it ideal for small samples and extreme proportions.

1. Provide Test Inputs

Small sample friendly

Model snapshot

Test \(H_0: p = p_0\) against your chosen alternative. The exact p-value sums binomial probabilities \(\binom{n}{k} p_0^k (1 - p_0)^{n-k}\) over outcomes as or more extreme than the observed count.

\[ P(X = k) = \binom{n}{k} p_0^k (1 - p_0)^{n - k} \]

Two-sided p-values follow the “probability ordering” rule used by R's binom.test.

Alternative hypothesis

Formula Reference

Binomial Probability

\\[ P(X = k) = \binom{n}{k} p_0^{k} (1 - p_0)^{n-k} \\]

The exact test sums these probabilities across outcomes as or more extreme than the observed count.

Two-sided & Mid-p

\\[ p_{\text{two-sided}} = \sum_{P(k) \le P(x)} P(k), \quad p_{\text{mid}} = p_{\text{two-sided}} - \tfrac{1}{2} P(x) \\]

The probability ordering rule mirrors the behaviour of R's binom.test.

One-sided Tails

\\[ p_{\text{right}} = \sum_{k=x}^{n} \binom{n}{k} p_0^{k} (1 - p_0)^{n-k}, \quad p_{\text{left}} = \sum_{k=0}^{x} \binom{n}{k} p_0^{k} (1 - p_0)^{n-k} \\]

Select the right tail when testing \(p > p_0\) and the left tail when testing \(p < p_0\).

Clopper-Pearson Interval

\\[ \text{Lower} = B^{-1}\!\left(\tfrac{\alpha}{2}; x, n - x + 1\right), \quad \text{Upper} = B^{-1}\!\left(1 - \tfrac{\alpha}{2}; x + 1, n - x\right) \\]

Here \(B^{-1}\) denotes the inverse beta CDF evaluated at the specified quantile.

Step-by-Step Guide

  1. Count the number of observed successes \(x\) out of \(n\) identical and independent trials.
  2. Specify the null proportion \(p_0\) and the alternative direction (two-sided, right, or left).
  3. Sum binomial probabilities under \(p_0\) across the appropriate tail to obtain the exact p-value.
  4. Compare the p-value with the chosen alpha level to decide whether to reject \(H_0\).
  5. Construct the Clopper-Pearson confidence interval to report the plausible range for the true proportion.

References

  • Clopper, C. J., & Pearson, E. S. (1934). The use of confidence or fiducial limits illustrated in the case of the binomial. Biometrika, 26(4), 404-413.
  • Casella, G., & Berger, R. L. (2002). Statistical Inference (2nd ed.). Duxbury.
  • Mehta, C. R., & Hilton, J. F. (1993). Exact power of conditional tests in 2x2 tables. Journal of the American Statistical Association, 88(421), 10-20.