Binomial Test Calculator

Perform an exact one-sample binomial test to determine if the observed proportion of successes differs significantly from a hypothesized benchmark. Includes exact p-values, Clopper-Pearson confidence intervals, and step-by-step mathematical proofs.

Test Parameters

Enter sample counts and hypothesis

Total sample observations

Events of interest observed

50.0%
Chips:
Fail to Reject H₀

Fail to Reject H₀ (p = 0.1153 > α = 0.05)

The observed success rate of 70.00% does not significantly deviate from the hypothesized rate of 50.00% under α = 0.05.

Exact P-Value0.1153p = 0.1153

Sample Proportion (p̂)

0.7000

70.00%

Expected (E[X])

10.00

n · p₀

Standard Dev (σ)

2.2361

Var = 5.00

Normal Approx Z

1.565

p ≈ 0.1175

95% Confidence Intervals for True Proportion (p)

Clopper-Pearson (Exact)Gold Standard

[0.4572, 0.8811]

45.72% to 88.11%

Wilson Score IntervalRecommended for Samples

[0.4810, 0.8545]

48.10% to 85.45%

Binomial Distribution Under H₀ (p₀ = 0.5)

Visual probability mass function P(X = x). Hover over bars to inspect details.

Observed (k=14)Critical TailNull Mass
01234567891011121314151617181920

Showing binomial probability mass around expected mean μ = 10.0 with observed k = 14 highlighted in emerald green.

Step-by-Step Mathematical Solution

Full derivation of the exact binomial hypothesis test

1State the Hypotheses

The binomial test evaluates whether the underlying probability of success p equals the hypothesized rate p₀ = 0.5.

Null Hypothesis (H₀): p = 0.5 (The probability of success matches the benchmark)

Alternative Hypothesis (H₁): p ≠ 0.5 (Two-tailed: probability is different)

2Calculate Sample Statistics & Expected Values

Sample Proportion (p̂)

p̂ = k / n = 14 / 20 = 0.7000

Expected Mean Under H₀

μ = n · p₀ = 20 × 0.5 = 10.00

Null Standard Deviation

σ = √(n·p₀·(1-p₀)) = 2.2361

3Exact Binomial PMF for Observed Successes

The probability of observing exactly k = 14 successes in n = 20 independent Bernoulli trials under H₀ is:

P(X = k) = C(n, k) · p₀^k · (1 - p₀)^(n - k)

P(X = 14) = C(20, 14) · (0.5)^14 · (0.5)^6 = 0.0370

4Calculate Exact P-Value via Cumulative Tails

For a two-tailed test (R/SciPy standard), sum all outcomes whose probability under H₀ is less than or equal to P(X = k):

p = ∑ P(X = x) for all x where P(X = x) ≤ P(X = 14) = 0.1153

(Alternate doubling method: 2 × min(P(X ≤ 14), P(X ≥ 14)) = 0.1153)

5Compare with α = 0.05 & Conclusion

Because the p-value p = 0.1153 is greater than α = 0.05:

Decision: Fail to Reject the Null Hypothesis (H₀).

The test indicates the observed deviation could reasonably occur due to random sampling variance under H₀. There is insufficient evidence to claim the true proportion differs from 0.5.

What is an Exact Binomial Test?

An exact binomial test is a non-parametric statistical hypothesis test used to compare the observed proportion of binary outcomes (success vs. failure, yes vs. no, defective vs. non-defective) against a known or theoretical benchmark probability.

Unlike the one-sample Z-test for proportions, which relies on the Central Limit Theorem and normal approximations, the binomial test calculates exact combinatorial probabilities directly from the binomial distribution. As a result, it is valid for any sample size, including very small samples (such as n = 10 or n = 15) where normal approximation formulas fail.

Binomial Test vs. Other Statistical Tests

Selecting the right statistical test ensures your conclusions remain mathematically valid and compliant with research standards:

Statistical TestData TypeSample Size RequirementPrimary Purpose
Exact Binomial TestSingle Binary VariableAny size (ideal for small n < 30)Compare observed proportion to fixed theoretical rate p₀ without approximation error.
One-Sample Z-Test for ProportionsSingle Binary VariableLarge samples (np ≥ 5, n(1-p) ≥ 5)Fast asymptotic Z approximation for large survey or polling datasets.
Chi-Square Goodness of FitCategorical (2 or more bins)Expected count ≥ 5 per cellCompare observed frequency distributions across 2 or more discrete categories.
One-Sample T-TestContinuous NumericalSmall to moderate (normally distributed)Compare a numeric sample mean to a target population mean when σ is unknown.

Assumptions of the Binomial Test

1

Dichotomous (Binary) Outcomes

Each observation must fall into exactly one of two mutually exclusive categories (e.g., heads/tails, pass/fail, yes/no).

2

Mutually Independent Trials

The outcome of any trial cannot influence or depend on the outcome of another trial. Sampling must be with replacement or from an infinite population.

3

Constant Probability of Success

The underlying hypothesized benchmark probability p₀ must remain identical across all n trials throughout the study.

Real-World Worked Examples

Case Study 1: Coin Toss Fairness CheckTwo-Tailed Test

Is a referee's coin truly balanced?

A sports league flips a coin 20 times and records 15 heads. Under the null hypothesis of a fair coin, the expected probability of heads is p₀ = 0.50.

  • Trials: n = 20, Successes: k = 15
  • Hypotheses: H₀: p = 0.50 vs. H₁: p ≠ 0.50 (two-tailed)
  • Exact Two-Tailed P-Value: p = 0.0414
  • Decision at α = 0.05: Reject H₀ (0.0414 ≤ 0.05). There is sufficient evidence that the coin is biased.
Case Study 2: Manufacturing Quality ControlRight-Tailed Test

Has the defect rate exceeded the tolerance threshold?

A microchip factory requires the defect rate to remain at or below 5% (p₀ = 0.05). In a random audit of 100 chips, 9 defective chips are discovered.

  • Trials: n = 100, Defects: k = 9
  • Hypotheses: H₀: p ≤ 0.05 vs. H₁: p > 0.05 (right-tailed)
  • Exact Right-Tailed P-Value: P(X ≥ 9) = 0.0631
  • Decision at α = 0.05: Fail to reject H₀ (0.0631 > 0.05). While the observed rate (9%) exceeds the 5% target, the sample does not provide conclusive proof beyond sampling fluctuation at the 5% significance level.

Verifying Results in R, Python, and SPSS

Our calculator produces exact results that match the standard scientific computing packages:

R (stats::binom.test)Standard
# R syntax for 14 successes in 20 trials (p0 = 0.5)
result <- binom.test(x = 14, n = 20, p = 0.5,
                     alternative = "two.sided",
                     conf.level = 0.95)
print(result)
# Output: p-value = 0.1153
Python (scipy.stats.binomtest)SciPy 1.7+
from scipy.stats import binomtest

res = binomtest(k=14, n=20, p=0.5, alternative='two-sided')
print("P-value:", res.pvalue)
print("95% CI:", res.proportion_ci(confidence_level=0.95))
# Output: P-value: 0.1153

Frequently Asked Questions

William Davis

Created by William Davis

Last updated: October 14, 2026

Add to Google Preferred