Categorical › Contingency / proportions

Binomial test

The exact binomial test compares an observed proportion against a hypothesised value π₀.

What is Binomial test?

The exact binomial computes P(X ≥ k) under H₀: π = π₀ from the Binomial(n, π₀) distribution directly, without any normal approximation. For small n or π₀ near 0 or 1, this is the only test whose nominal α you can trust.

The companion CI is Clopper-Pearson (exact). For larger n, normal-approximation CIs like Wilson or Agresti-Coull are tighter and less conservative — but they sit in the `summary_one_prop` test, not here.

When should I use Binomial test?

  • Single proportion vs a fixed reference rate (e.g. observed cure rate vs historical 60%).
  • Small samples where the normal approximation isn't trusted.
  • Goodness-of-fit on a single binary outcome.

What data does it need?

One categorical column (a 'success' label is chosen) + π₀ + alternative.

What does it report?

Exact p-value and Clopper-Pearson 95% CI for the observed proportion.

What does it assume?

  • Independent Bernoulli trials with constant success probability π.

Formula

P(X ≥ k | H₀) = Σᵢ≥ₖ C(n, i) · π₀ⁱ · (1 − π₀)ⁿ⁻ⁱ

How do I interpret the result?

The Clopper-Pearson CI is intentionally conservative — actual coverage often exceeds 95%. For tighter CIs at large n switch to Wilson; for very small n stick with Clopper-Pearson.

See also