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
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.
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)
[0.4572, 0.8811]
45.72% to 88.11%
[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.
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 Test | Data Type | Sample Size Requirement | Primary Purpose |
|---|---|---|---|
| Exact Binomial Test | Single Binary Variable | Any size (ideal for small n < 30) | Compare observed proportion to fixed theoretical rate p₀ without approximation error. |
| One-Sample Z-Test for Proportions | Single Binary Variable | Large samples (np ≥ 5, n(1-p) ≥ 5) | Fast asymptotic Z approximation for large survey or polling datasets. |
| Chi-Square Goodness of Fit | Categorical (2 or more bins) | Expected count ≥ 5 per cell | Compare observed frequency distributions across 2 or more discrete categories. |
| One-Sample T-Test | Continuous Numerical | Small to moderate (normally distributed) | Compare a numeric sample mean to a target population mean when σ is unknown. |
Assumptions of the Binomial Test
Dichotomous (Binary) Outcomes
Each observation must fall into exactly one of two mutually exclusive categories (e.g., heads/tails, pass/fail, yes/no).
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.
Constant Probability of Success
The underlying hypothesized benchmark probability p₀ must remain identical across all n trials throughout the study.
Real-World Worked Examples
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.
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 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.1153from 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.1153Frequently Asked Questions
Related Calculators
Created by William Davis
Last updated: October 14, 2026