UK-based online statistics and data analysis support for USA, UK, and international clients. No exams, no impersonation, no fabricated data.

Exact one-sample inference for a binary proportion

Binomial Test: Formula, Calculator, Example, Python, R, SPSS and Excel Guide

Binomial Test is an exact hypothesis test for deciding whether an observed binary proportion is compatible with a specified population probability. This complete guide explains the Binomial Test formula, assumptions, calculator logic, one-tailed and two-tailed alternatives, exact confidence intervals, APA reporting, eight cross-software Python and R charts, SPSS output, Excel formulas and a worked example with 649 students.

649 valid observations
549 successes
Observed proportion 0.8459
Exact p = 5.997 × 10−76

Binomial Test Model Overview

What the method is: the Binomial Test, also called the exact binomial test, evaluates a simple hypothesis about the probability of success in a sequence of binary trials. It compares the observed number of successes, x, with the distribution expected when the population success probability equals a hypothesized value, p0.

Definition of a Binomial Test

A Binomial Test is a one-sample proportion test. Every observation is classified into one of two categories, such as success/failure, yes/no, present/absent or pass/fail. The word success is only a coding label; it does not have to represent a desirable outcome. If the assumptions are satisfied, the total number of successes follows a binomial distribution under the null hypothesis.

X ~ Binomial(n, p0) under H0

The observed test information is the number of successes x, the fixed number of trials n, the hypothesized success probability p0, and the selected alternative. The exact p-value is calculated directly from binomial probabilities rather than from a continuous large-sample reference distribution.

Research Question in the Worked Example

The source variable is G3, the final grade. A student is coded as a success when G3 is at least 10 and as a failure when G3 is below 10. The Binomial Test asks whether the population proportion meeting this threshold differs from 0.50.

H0: p = 0.50    versus    H1: p ≠ 0.50

When the Binomial Test Is Used

Use a Binomial Test when there is one sample, one binary outcome, a fixed number of observations, independent trials, a constant success probability and a specific null proportion. The method can be used with small or large samples; exactness is not limited to small samples. With very large samples, a one-proportion z-test may give a similar decision, but the exact Binomial Test remains valid under the binomial model.

When the Binomial Test Is Not Used

Do not use a one-sample Binomial Test to compare two independent groups. A two-group question requires a two-proportion z-test, Fisher-type exact procedure or an appropriate regression model. Do not use it for paired binary observations, clustered observations, outcomes with more than two categories, a changing probability across trials or a quantitative outcome that should remain quantitative.

Binomial Test Versus a “Binomial T Test”

The search phrase binomial t test combines two different methods. A t-test evaluates a mean for a quantitative variable using a t reference distribution. A Binomial Test evaluates a probability for a binary variable using the binomial distribution. There is no standard procedure called a binomial t test.

Exact Binomial Test Versus a General Test for Binomial Distribution

A Binomial Test does not test whether an entire observed count distribution has the general shape of a binomial distribution across many repeated experiments. It tests one observed success count against one hypothesized probability. Therefore, the phrases test for binomial distribution and binomial distribution test should be interpreted carefully: the method is a test of a binomial proportion, not a general distribution-fitting procedure.

Current Worked Result

Among 649 students, 549 met the success definition and 100 did not. The observed proportion is 0.845917. Under H0, the expected counts are 324.5 successes and 324.5 failures. The exact two-sided p-value is 5.9969047562e-76, and the Clopper-Pearson 95% confidence interval is [0.815805, 0.872838].

Model-overview conclusion: the observed success proportion of 84.59% is far above the hypothesized 50%. The exact Binomial Test rejects H0, and the confidence interval remains entirely above 0.50.

Quick Answer: Binomial Test Result

Valid cases649
Successes549
Observed proportion0.8459
Exact p-value5.997 × 10−76

Hypothesis Decision

  • Success: G3 ≥ 10
  • Null proportion: p0 = 0.50
  • Alternative: two-sided
  • Alpha: .05
  • Decision: reject H0

Best Interpretation

  • 549 of 649 students met the threshold.
  • The observed rate was 84.59%.
  • The difference from 0.50 was 34.59%.
  • The exact 95% CI was [0.8158, 0.8728].
  • Cohen's h was 0.764.
Publication-ready answer: an exact two-sided Binomial Test showed that the proportion of students with G3 ≥ 10 (549/649, p̂ = 0.846) differed significantly from the hypothesized proportion of 0.50, p < .001, exact 95% CI [0.816, 0.873].
Exact numerical p-value: the software result is approximately 5.9969e-76. In ordinary APA prose, report p < .001 rather than p = .000. The full scientific-notation value can appear in a technical results table.

Table of Contents

  1. What is a Binomial Test?
  2. Binomial hypothesis test and alternatives
  3. Binomial Test assumptions
  4. Binomial Test formula and exact p-value
  5. Worked Binomial Test example
  6. Binomial Test calculator steps
  7. Complete results and effect size
  8. Exact test versus z-test and related methods
  9. Eight Python and R chart interpretations
  10. Binomial Test in Python, R, SPSS and Excel
  11. Expandable software code
  12. One-tailed, two-tailed, power and advanced topics
  13. APA reporting for the Binomial Test
  14. Common mistakes and corrections
  15. Reports and worked Excel download
  16. Related Salar Cafe guides
  17. Frequently asked questions
  18. Conclusion

What Is a Binomial Test?

A Binomial Test is an exact test of a population proportion. It answers whether an observed success count is reasonably compatible with a specified success probability. The test is built from the binomial probability model and is sometimes described as a one-sample exact proportion test.

Four Pieces of Information

Number of trials, n

The fixed number of independent observations. Here, n = 649.

Number of successes, x

The count in the event category. Here, x = 549.

Null probability, p0

The population probability stated by H0. Here, p0 = 0.50.

Alternative

Two-sided, greater or less. The worked analysis is two-sided.

Observed proportion

p̂ = x/n = 0.845917.

Exact uncertainty

The result includes an exact p-value and a Clopper-Pearson interval.

Why the Test Is Called Exact

The exact Binomial Test calculates probabilities from the finite binomial distribution. It does not replace the distribution with a normal curve. This makes it valid for sparse or extreme results when the binomial assumptions hold. The word exact refers to the probability calculation, not to an absence of assumptions.

What “Success” Means

Success is the category counted by x. It can mean recovery, failure, disease, approval, a correct answer or any other binary event. In this guide, success means G3 ≥ 10. Changing the success definition changes the count, proportion, confidence interval and p-value.

Binomial Test Interpretation

A small p-value means that outcomes with probability no greater than the observed outcome have little total probability under H0. It does not measure the probability that H0 is true. The confidence interval and effect size are needed to interpret magnitude and uncertainty.

How to Tell Whether a Question Is Binomial

A suitable question has two possible outcomes per observation, independent observations, a fixed number of observations and approximately the same probability for each observation. When those conditions fail, a different model is required.

Binomial Hypothesis Test and Alternative Hypotheses

A binomial hypothesis test compares the unknown population success probability, p, with a specified null value, p0. The alternative determines which tail probabilities contribute to the p-value.

AlternativeHypothesesQuestion answeredProbability used
Two-sidedH0: p = p0
H1: p ≠ p0
Is the probability different in either direction?Probability-ordered outcomes at least as unlikely as the observed outcome.
GreaterH0: p = p0
H1: p > p0
Is the probability higher?P(X ≥ x | p0)
LessH0: p = p0
H1: p < p0
Is the probability lower?P(X ≤ x | p0)

Worked Hypotheses

H0: p = 0.50
H1: p ≠ 0.50

The two-sided alternative was selected because both a lower and a higher success proportion would contradict the 0.50 hypothesis. The direction was not chosen after inspecting the observed result.

One-Tailed Binomial Test

A one tailed binomial test is appropriate only when the research hypothesis specifies a direction in advance. For this sample, the upper-tail probability for p > 0.50 is 2.9985e-76. Because p0 = 0.50 creates a symmetric null distribution, the two-sided exact p-value is exactly twice this upper-tail probability in the present example.

Two-Tailed Binomial Test

A two tailed binomial test is not always calculated by simply doubling the smaller one-sided tail. For an asymmetric binomial distribution, standard exact software typically sums outcomes whose probability under H0 is no greater than the observed outcome's probability. This probability-ordering rule should be reproduced when calculating an exact two-sided result in Excel.

Prespecification rule: select two-sided, greater or less before examining the sample result. Changing the alternative after seeing p̂ increases the risk of a false-positive conclusion.

Binomial Test Assumptions

Required Conditions

  • The outcome is binary.
  • The number of trials is fixed.
  • Observations are independent.
  • The probability of success is constant across trials.
  • Each observation is classified once.
  • The null probability is specified before testing.

Warning Signs

  • Repeated observations from the same participant
  • Students clustered within classes or schools
  • More than two outcome categories
  • Changing exposure or probability across trials
  • Outcome misclassification near the cutpoint
  • Threshold selected after reviewing results

Binary Outcome

The analysed variable must have two categories. The original G3 variable is quantitative, so it is converted to G3 ≥ 10 and G3 < 10. The threshold should have an educational meaning; otherwise, analysing the full grade scale can be more informative.

Independence

One student's outcome should not determine another student's outcome. The Binomial Test does not correct for repeated measurements, paired observations, family clustering, classroom clustering or school-level dependence. When clustering is important, a generalized model may be needed.

Fixed Number of Trials

The model treats n as fixed. The number of observed successes changes from sample to sample, while the number of trials is set by the design or observed dataset.

Constant Probability

Every trial should have the same success probability under the simple binomial model. The school and sex charts show that observed proportions vary across subgroups. Those descriptive differences suggest that an unadjusted one-probability model may hide heterogeneity, although they do not invalidate the arithmetic of the complete-sample test by themselves.

Random Sampling and Finite Populations

Random or representative sampling supports population inference. When sampling without replacement from a finite population, independence is approximate if the sample is a small fraction of the population. If the sampling fraction is large, a hypergeometric model may better represent the design.

No Distribution-Shape Assumption for a Quantitative Variable

The Binomial Test does not require normality of G3 because the analysis uses a binary indicator. However, this does not make the test assumption-free. The relevant assumptions concern binary coding, independence, fixed n and constant probability.

Assumption summary: the Binomial Test uses a specific binomial probability model. It is often grouped with nonparametric procedures in software menus, but its validity still depends on the Bernoulli-trial assumptions.

Binomial Test Formula and Exact P-Value

Binomial Probability Formula

P(X = k) = C(n, k)p0k(1 − p0)n−k

Here, k is a possible number of successes, n is the fixed number of trials, p0 is the hypothesized success probability and C(n, k) is the number of ways to arrange k successes among n trials.

Observed Proportion

p̂ = x/n = 549/649 = 0.845916795

Expected Counts Under H0

E(success) = np0 = 649 × 0.50 = 324.5
E(failure) = n(1 − p0) = 324.5

Probability of the Observed Count

P(X = 549 | n = 649, p0 = 0.50) = 2.4546982222e-76

This is the probability of exactly 549 successes under the null. It is not the complete two-sided p-value because the p-value also includes other outcomes that are no more probable than the observed count.

Exact Two-Sided P-Value

p = Σ P(X = k | H0) for every k with P(X = k) ≤ P(X = 549)

For the symmetric p0 = 0.50 distribution, the included counts are 0 through 100 and 549 through 649. Their combined probability is:

p = P(X ≤ 100) + P(X ≥ 549) = 5.9969047562e-76
Lower exact region

X = 0 to 100
Probability = 2.9985e-76

+
Upper exact region

X = 549 to 649
Probability = 2.9985e-76

Exact Clopper-Pearson Confidence Interval

Lower = BetaInv(α/2; x, n − x + 1)
Upper = BetaInv(1 − α/2; x + 1, n − x)

The exact 95% interval is [0.815805378, 0.872838333]. The Clopper-Pearson method guarantees at least the stated coverage under the binomial model, but it can be wider than approximate intervals.

Cohen's h for a One-Sample Proportion

h = 2arcsin(√p̂) − 2arcsin(√p0) = 0.764025

Cohen's h describes the standardized distance between the observed and null proportions. The value 0.764 lies well above the conventional medium benchmark of .50 and close to the conventional large benchmark of .80.

Worked Binomial Test Example

Step 1: Define the Binary Outcome

The source variable is G3. Values at or above 10 are coded 1, and values below 10 are coded 0. The complete dataset contains 649 valid cases.

Outcome categoryDefinitionObserved countObserved proportion
SuccessG3 ≥ 105490.845917
FailureG3 < 101000.154083
TotalAll valid cases6491.000000

Step 2: State the Null Model

Under H0, success and failure each have probability .50. Therefore, the expected counts are 324.5 and 324.5.

Step 3: Compare Observed and Expected Counts

Observed success excess = 549 − 324.5 = 224.5

The success count is 224.5 above its null expectation. The failure count is the same amount below its expectation.

Step 4: Calculate the Exact P-Value

The probability of exactly 549 successes under H0 is 2.4547e-76. The probability-ordered two-sided region adds every outcome with probability no greater than this observed probability, producing p = 5.9969e-76.

Step 5: Make the Decision

Because 5.9969e-76 is far below α = .05, reject H0. The data are not compatible with a population success probability of 0.50 under the stated binomial assumptions.

Step 6: Interpret the Confidence Interval

The exact interval [0.8158, 0.8728] indicates that plausible population success probabilities are approximately 81.58% to 87.28%. The entire interval is above 50%, supporting the test decision.

Step 7: Interpret Practical Magnitude

The observed proportion exceeds the null by 34.59%. Cohen's h = 0.764, indicating a substantial standardized departure from the hypothesized probability.

Worked-example conclusion: the success rate is not merely statistically distinguishable from 50%; it is approximately 34.59 percentage points higher.

Binomial Test Calculator: Inputs, Output and Decision

A useful binomial test calculator requires the number of successes, number of trials, expected probability and alternative hypothesis. A complete calculator should also return an exact confidence interval and explain the success category.

Calculator Inputs

InputWorked value
Successes, x549
Trials, n649
Null probability, p00.50
AlternativeTwo-sided
Confidence level95%

Calculator Output

OutputWorked result
Observed proportion0.845916795
Exact p-value5.9969047562e-76
Exact 95% CI[0.815805378, 0.872838333]
Cohen's h0.764025
DecisionReject H0

How to Use an Exact Binomial Test Calculator

  1. Define success before entering the counts.
  2. Enter x and n; confirm that 0 ≤ x ≤ n.
  3. Enter a null probability between 0 and 1.
  4. Select two-sided, greater or less before examining the p-value.
  5. Request an exact confidence interval.
  6. Read the p-value with the observed proportion and effect size.

What a Calculator Should Not Do

An exact two-sided calculator should not automatically use 2 × the smaller tail for every asymmetric binomial problem. It should reproduce the selected software's exact two-sided ordering. It should also avoid reporting p = 0 when the probability is merely extremely small.

Exact binomial test calculator result: for x = 549, n = 649, p0 = 0.50 and a two-sided alternative, the exact p-value is 5.9969e-76.

Complete Binomial Test Results

Valid n649

Complete binary outcomes

Successes549

G3 ≥ 10

Failures100

G3 < 10

Observed p̂0.845917

Successes divided by n

Exact p5.997e−76

Two-sided probability ordering

Cohen's h0.764025

Standardized proportion difference

Core Result Table

MeasureValueInterpretation
Success definitionG3 ≥ 10Binary event counted by the test
Sample size649Number of valid trials
Success count549Observed number of events
Failure count100Observed non-events
Observed success proportion0.845916795Estimated population proportion
Null proportion0.50Probability stated by H0
Observed minus null0.34591679534.59% above p0
Probability of exactly x2.4546982222e-76PMF at the observed count
Exact two-sided p-value5.9969047562e-76Probability-ordered exact tail
Exact 95% CI[0.815805378, 0.872838333]Clopper-Pearson interval
Cohen's h0.764025Substantial standardized difference
DecisionReject H0Exact p-value is below .05

Descriptive Subgroup Results

SubgroupnSuccessesFailuresSuccess proportionExact 95% CI
School GP423391320.924350[0.8949, 0.9477]
School MS226158680.699115[0.6348, 0.7582]
Female383333500.869452[0.8315, 0.9015]
Male266216500.812030[0.7598, 0.8571]

The school and sex values are descriptive subgroup summaries. The formal Binomial Test reported above uses the complete sample and tests one population probability against 0.50. Separate subgroup inferences require separate hypotheses and, when comparing groups directly, a two-sample proportion method.

Statistical Decision

The exact p-value is far below α = .05, so H0 is rejected. The sample provides overwhelming evidence that the population proportion is not 0.50 under the stated model.

Practical Interpretation

The observed success rate is 84.59%, which is 34.59% above the null value. The exact confidence interval remains well above 0.50. Cohen's h = 0.764, showing a substantial difference in addition to statistical significance.

Exact Binomial Test Versus Z-Test and Related Methods

Exact Binomial Test

One observed proportion versus a fixed p0, using exact binomial probabilities.

One-Proportion Z-Test

One observed proportion versus p0, using a normal approximation.

Two-Proportion Test

Directly compares probabilities in two independent groups.

Logistic Regression

Models a binary outcome with one or more predictors and covariates.

QuestionRecommended methodReason
Does one binary proportion equal 0.50?Binomial TestDirect exact test of one probability.
Does one large-sample proportion equal p0?Binomial Test or one-proportion z-testExact and approximate approaches answer the same basic hypothesis.
Do female and male proportions differ?Two-proportion test or exact 2 × 2 methodThe null compares two unknown group probabilities.
Does success vary by school, sex and prior grades?Binary logistic regressionCovariate adjustment and multiple predictors are required.
Are paired before/after binary outcomes different?Paired binary methodObservations are dependent, not independent Bernoulli trials.

Exact Binomial Test Versus One-Proportion Z-Test

The exact test uses the finite binomial distribution. The z-test standardizes the observed proportion using the null standard error and compares the result with the standard normal distribution. In this example, the null-standardized difference is approximately z = 17.625, so both methods would strongly reject H0.

Binomial Test Versus Chi-Square Goodness of Fit

With two categories and a fully specified expected proportion, a chi-square goodness-of-fit test can address a related question. The exact Binomial Test is preferable when an exact discrete calculation is desired, especially with small expected counts or extreme proportions.

Binomial Test Versus Sign Test

A sign test often uses a Binomial Test internally with p0 = 0.50, but its binary outcomes come from signs of paired differences. The substantive design and preprocessing are different even though the final count follows a binomial null model.

Binomial Test Versus Binary Logistic Regression

The Binomial Test estimates one overall probability. Binary logistic regression explains how probability changes with predictors. The subgroup patterns by school and sex show why an adjusted model may be useful after the one-sample question has been answered.

Eight Python and R Binomial Test Chart Interpretations

The Python and R reports use the same eight figures. Each image is shown once in four paired rows, followed by one complete interpretation that applies across both software workflows. This prevents duplicated visual sections while preserving exact values and statistical meaning.

Binomial Test chart pair 1 - Python and R
Binomial Test observed success and failure counts for G3 threshold
Observed counts after coding G3 at least 10 as success.
Binomial Test observed versus expected counts under null proportion 0.50
Observed counts are compared with equal expected counts under H0.
Pattern and Interpretation

Chart 1: Observed Success and Failure Counts

The count contrast is large: 549 students meet the threshold and 100 do not. The bar heights represent raw frequency, so the success bar is approximately 5.49 times the failure bar. This figure establishes the sample information used by every later Binomial Test calculation.

Exact values: Success = 549; failure = 100; total n = 649; success/failure ratio = 5.49.
Pattern and Interpretation

Chart 2: Observed Versus Expected Counts

Under p0 = .50, both categories have an expected count of 324.5. The observed success count is 224.5 above expectation, and the failure count is 224.5 below expectation. The symmetric deviations explain the extremely small p-value.

Exact values: Observed = (549, 100); expected = (324.5, 324.5); deviations = (+224.5, −224.5).
Binomial Test chart pair 2 - Python and R
Binomial Test observed proportion with exact Clopper Pearson confidence interval
Observed proportion, exact interval and null reference value.
Exact Binomial Test null distribution for 649 trials and probability 0.50
The complete null distribution of X under n = 649 and p0 = .50.
Pattern and Interpretation

Chart 3: Observed Proportion with Exact 95% CI

The point estimate is 0.8459. The exact interval from 0.8158 to 0.8728 lies entirely above the null line at .50. The chart therefore displays both the estimated magnitude and the uncertainty supporting rejection.

Exact values: p̂ = 0.845917; exact 95% CI = [0.815805, 0.872838]; p0 = 0.50.
Pattern and Interpretation

Chart 4: Exact Binomial Null Distribution

The distribution is centred at 324.5 with a standard deviation of 12.7377. The observed count 549 sits 17.62 null standard deviations above the mean and is visually separated from the main probability mass.

Exact values: Null mean = 324.5; null SD = 12.737739; observed x = 549; standardized distance = 17.625.
Binomial Test chart pair 3 - Python and R
Two sided exact Binomial Test probability ordered rejection region
Counts no more probable than the observed count form the two-sided exact p-value.
G3 final grade distribution with Binomial Test success cutpoint at 10
The original G3 distribution and the threshold used to create the binary outcome.
Pattern and Interpretation

Chart 5: Two-Sided Exact Probability Region

The included outcomes are the far lower and upper probability regions. Because p0 = .50 is symmetric, counts from 0 through 100 match counts from 549 through 649. For an asymmetric null probability, the included two-sided outcomes do not have to be equal-distance tails.

Exact values: Included counts = 0–100 and 549–649; each tail = 2.9985e-76; combined p = 5.9969e-76.
Pattern and Interpretation

Chart 6: G3 Distribution and Success Cutpoint

The threshold at 10 divides the quantitative grade distribution into 100 values below the cutpoint and 549 at or above it. The most frequent grades are 11, 10, 13, 12 and 14. The chart makes the information loss from dichotomization visible.

Exact values: G3 = 10 has 97 cases; G3 = 11 has 104; below 10 = 100; at least 10 = 549; observed range = 0–19.
Binomial Test chart pair 4 - Python and R
Binomial Test descriptive success proportion by school with null line
Descriptive success proportions for GP and MS schools.
Binomial Test descriptive success proportion by sex with null line
Descriptive success proportions for female and male students.
Pattern and Interpretation

Chart 7: Success Proportion by School

GP has a success proportion of 0.9243, while MS has 0.6991. Both exceed .50, but the school difference is 0.2252, or 22.52%. This is a descriptive subgroup comparison, not the formal one-sample test.

Exact values: GP = 391/423 (92.43%); MS = 158/226 (69.91%).
Pattern and Interpretation

Chart 8: Success Proportion by Sex

Female students have a success proportion of 0.8695, and male students have 0.8120. The difference is 0.0574, or 5.74%. Both subgroup rates remain above the .50 null reference.

Exact values: Female = 333/383 (86.95%); male = 216/266 (81.20%).

Binomial Test in Python, R, SPSS and Excel

Binomial Test in Python

  • Use scipy.stats.binomtest.
  • Supply k = 549, n = 649, p = 0.50.
  • Select alternative="two-sided".
  • Request the exact proportion interval from the result object.
  • Report p̂, p-value, confidence interval and effect size.

Expected result: p̂ = 0.845917, p = 5.9969e-76, exact 95% CI [0.815805, 0.872838].

Binomial Test in R

  • Use binom.test() from the base stats package.
  • Enter x, n, p, alternative and confidence level.
  • R returns the success count, trials, exact p-value and Clopper-Pearson interval.
  • The two-sided calculation uses an exact discrete probability rule.
  • Use the printed estimate as the observed success proportion.

Expected result: x = 549, n = 649, p-value = 5.9969e-76, estimate = 0.845917.

Binomial Test in SPSS

  • Create a numeric binary variable: 1 = G3 ≥ 10, 0 = G3 < 10.
  • Use Analyze > Nonparametric Tests > One Sample or the Binomial legacy dialog.
  • Set the hypothesized proportion to 0.50.
  • Identify 1 as the success category.
  • Request a Clopper-Pearson interval when available.

The SPSS hypothesis summary rounds the significance to .000 and rejects H0. Report this as p < .001, not p = .000. The full exact numerical probability is available from Python, R and the worked Excel calculation.

Binomial Test in Excel

  • Use BINOM.DIST for exact point and cumulative probabilities.
  • Enumerate all counts from 0 through n for a general two-sided exact p-value.
  • Include probabilities no greater than the observed count's probability.
  • Use BETA.INV for Clopper-Pearson limits.
  • Use the downloadable workbook for a formula-driven complete analysis.

Important: 2*MIN(lower tail, upper tail) is not a universal replacement for the probability-ordered exact two-sided calculation.

Cross-Software Result Reconciliation

SoftwarePrimary function or procedureWorked resultReporting note
Pythonscipy.stats.binomtestp = 5.9969e-76Exact p and exact confidence interval
Rbinom.testp = 5.9969e-76Exact test with Clopper-Pearson interval
SPSSOne-Sample Binomial TestSig. displayed as .000Write p < .001; verify significance type in the selected procedure
ExcelBINOM.DIST + probability-ordering tablep = 5.9969e-76Formula-driven reconstruction of all possible counts

Expandable Binomial Test Code

Python exact Binomial Test and exact confidence interval
from scipy.stats import binomtest
import math

successes = 549
trials = 649
null_proportion = 0.50

result = binomtest(
    k=successes,
    n=trials,
    p=null_proportion,
    alternative="two-sided",
)

exact_ci = result.proportion_ci(
    confidence_level=0.95,
    method="exact",
)

observed_proportion = successes / trials
cohens_h = (
    2 * math.asin(math.sqrt(observed_proportion))
    - 2 * math.asin(math.sqrt(null_proportion))
)

print("Observed proportion:", observed_proportion)
print("Exact p-value:", result.pvalue)
print("Exact 95% CI:", exact_ci.low, exact_ci.high)
print("Cohen's h:", cohens_h)
Python subgroup summaries used in Charts 7 and 8
import pandas as pd
from scipy.stats import binomtest

df = pd.read_csv("dataset.csv")
df["success"] = (df["G3"] >= 10).astype(int)

for variable in ["school", "sex"]:
    summary = (
        df.groupby(variable)["success"]
          .agg(["sum", "count", "mean"])
          .rename(columns={"sum": "successes", "count": "n", "mean": "proportion"})
    )

    intervals = []
    for _, row in summary.iterrows():
        ci = binomtest(
            int(row["successes"]),
            int(row["n"]),
        ).proportion_ci(method="exact")
        intervals.append((ci.low, ci.high))

    summary["exact_ci"] = intervals
    print(variable)
    print(summary)
R exact Binomial Test
successes <- 549
trials <- 649
null_proportion <- 0.50

result <- binom.test(
  x = successes,
  n = trials,
  p = null_proportion,
  alternative = "two.sided",
  conf.level = 0.95
)

print(result)
print(result$estimate)
print(result$conf.int)
print(result$p.value)

observed_proportion <- successes / trials
cohens_h <- 2 * asin(sqrt(observed_proportion)) -
             2 * asin(sqrt(null_proportion))
print(cohens_h)
SPSS one-sample Binomial Test syntax
* Create the binary outcome.
COMPUTE binomial_success = (G3 >= 10).
VALUE LABELS binomial_success
  0 "Failure: G3 below 10"
  1 "Success: G3 at least 10".
EXECUTE.

* Modern one-sample nonparametric workflow.
NPTESTS
  /ONESAMPLE TEST (binomial_success)
    BINOMIAL(
      TESTVALUE=0.50
      SUCCESSCATEGORICAL=LIST(1)
      CLOPPERPEARSON
    )
  /MISSING SCOPE=ANALYSIS USERMISSING=EXCLUDE
  /CRITERIA ALPHA=0.05 CILEVEL=95.

* Legacy Binomial Test; p=.50 gives a two-tailed probability.
NPAR TESTS
  /BINOMIAL(.50)=binomial_success(0,1).

Read the output footnote to determine whether the selected SPSS procedure displays an exact or asymptotic significance value. Never write p = .000.

Excel formulas for the worked Binomial Test
Assume:
B4 = success cutpoint
B5 = null proportion
B6 = alpha
B7 = confidence level

Data sheet:
G2 = --(B2 >= Inputs!$B$4)
Fill G2 downward for all cases.

Summary formulas:
n = COUNT(Data!G2:G650)
x = SUM(Data!G2:G650)
Failures = n-x
Observed proportion = x/n
Expected successes = n*p0
Expected failures = n*(1-p0)
Observed probability = BINOM.DIST(x,n,p0,FALSE)

Exact Clopper-Pearson lower limit:
=IF(x=0,0,BETA.INV(alpha/2,x,n-x+1))

Exact Clopper-Pearson upper limit:
=IF(x=n,1,BETA.INV(1-alpha/2,x+1,n-x))

Cohen's h:
=2*ASIN(SQRT(x/n))-2*ASIN(SQRT(p0))

General exact two-sided p-value:
1. List k = 0,1,...,n.
2. Calculate BINOM.DIST(k,n,p0,FALSE) for each k.
3. Calculate the observed probability at x.
4. Flag each k whose probability is <= observed probability.
5. Sum the flagged probabilities.

Advanced Binomial Testing Topics

Why the exact two-sided p-value is not always twice one tail

The binomial distribution is discrete and can be asymmetric when p0 differs from .50. Doubling the smaller tail can select a different set of outcomes from the probability-ordering rule used by common exact software. State the software or exact definition in reproducible work.

Exact confidence interval and conservatism

The Clopper-Pearson interval is obtained by inverting equal-tailed binomial tests. Its coverage is at least the requested confidence level, which can make it wider than Wilson or likelihood-based intervals. “Exact” does not mean shortest or perfectly centred around p̂.

Does the Binomial Test have a test statistic?

The essential observed information is x and p̂. R labels the success count as the statistic, while SciPy returns the observed proportion as the result statistic. Unlike the one-proportion z-test, the exact calculation does not require a normal-reference z statistic.

Normal approximation for the current sample

Under H0, np0 and n(1−p0) both equal 324.5, so the normal approximation is numerically reasonable. The standardized difference is z ≈ 17.625. The exact Binomial Test is still preferred here because the complete exact probability is readily available.

Power of a Binomial Test

Power depends on n, p0, the true alternative probability, alpha and the alternative direction. Exact power is the sum of alternative-distribution probabilities for counts in the rejection region. See Statistical Power before planning a study.

Sample size for a Binomial Test

Sample-size planning should specify the smallest meaningful difference from p0, target power, alpha and one-sided or two-sided testing. A larger n narrows the confidence interval and allows smaller departures from p0 to be detected.

Multiple Binomial Tests

Running a separate test for many outcomes, subgroups or thresholds increases the familywise false-positive risk. Prespecify the primary outcome and apply a multiplicity strategy when many hypotheses are tested.

Equivalence and noninferiority

Failure to reject p = p0 does not establish that the probability is practically equivalent to p0. Equivalence requires prespecified margins and tests designed to show that the difference is sufficiently small.

Constant probability and observed subgroup differences

The complete-sample Binomial Test treats the sample as one set of trials with one probability. The school proportions 0.924 and 0.699 suggest heterogeneity. If explaining that heterogeneity is the goal, use stratified analysis or logistic regression.

Dichotomization of G3

The threshold analysis discards differences within each side of the cutpoint. A grade of 10 and a grade of 19 both count as success. The binary analysis should be justified by the research question and can be supplemented with analysis of the original G3 scale.

Mid-p Binomial Test

A mid-p procedure subtracts half the probability of the observed count from a conventional exact tail. It can reduce conservatism but does not provide the same exact size guarantee. Label a mid-p result explicitly and do not mix it with the full exact p-value.

Bayesian alternative

A Bayesian one-sample binomial analysis combines a prior distribution with the observed successes and failures to obtain a posterior distribution for p. It answers probability statements about p rather than a frequentist tail-probability question.

Finite population sampling

When a large fraction of a finite population is sampled without replacement, the Bernoulli trials are dependent. A hypergeometric model or finite-population correction may be more appropriate than the ordinary Binomial Test.

APA Reporting for the Binomial Test

The APA reporting section should state the success definition, number of successes, total sample size, observed proportion, null proportion, alternative, exact p-value, exact confidence interval and substantive interpretation. The exact p-value is extremely small in this example, so the main prose uses p < .001 while the technical table retains the scientific-notation value.

Full APA-Style Result for the Worked Example

An exact two-sided Binomial Test showed that the proportion of students with G3 ≥ 10 (549/649, p̂ = 0.846) was significantly different from the hypothesized proportion of 0.50, p < .001, exact 95% CI [0.816, 0.873]. The observed proportion was 34.59% above the null value, and Cohen's h was 0.764, indicating a substantial standardized difference.

Concise APA-Style Result

The G3 ≥ 10 proportion was 0.846 (549/649), which differed from .50, exact p < .001, 95% CI [0.816, 0.873].

APA-Style Methods Sentence

A two-sided exact Binomial Test was used to compare the observed proportion of students with G3 ≥ 10 with a hypothesized population proportion of .50. Exact Clopper-Pearson confidence limits were calculated at the 95% level.

APA-Style Results Table

MeasureValueAPA presentation
Success definitionG3 ≥ 10State in text or table note
Successes / total549 / 649549/649
Observed proportion0.845916795.846
Null proportion0.50.50
Exact p-value5.9969047562e-76< .001 in prose
Exact 95% CI[0.815805378, 0.872838333][.816, .873]
Cohen's h0.764025.764

Reusable APA Templates for the Binomial Test

Significant

Significant Two-Sided Binomial Test

Sample

An exact two-sided Binomial Test evaluated whether the outcome proportion differed from p0. The outcome occurred in x of n observations (p̂ = observed proportion).

Test result

The observed proportion differed significantly from the null proportion, exact p = p-value.

Uncertainty

The exact 95% confidence interval was [lower, upper], and the effect size was Cohen's h = h.

Use the exact numerical p-value when it is readable; use p < .001 when the value is extremely small.

Nonsignificant

Nonsignificant Two-Sided Binomial Test

Sample

An exact two-sided Binomial Test compared the observed outcome proportion (x/n, p̂ = proportion) with p0.

Test result

The result was not statistically significant, exact p = p-value.

Meaning

The analysis did not provide sufficient evidence that the population proportion differed from p0; it did not prove that the two values were identical.

Always include the confidence interval so readers can see which population proportions remain plausible.

One-Sided

Prespecified Directional Binomial Test

Hypothesis

A one-sided exact Binomial Test evaluated the prespecified hypothesis that the outcome probability was greater than / less than p0.

Test result

The result was statistically significant / not statistically significant, exact p = p-value.

Estimate

The observed proportion was proportion, based on x successes in n trials.

Use directional wording only when the alternative was selected before examining the data.

APA Rounding and Language

AvoidUse insteadReason
p = .000p < .001The probability is extremely small, not zero.
The Binomial Test proved p ≠ .50The test provided evidence that p differed from .50Hypothesis tests do not prove a population statement.
The result was important because it was significantThe result was significant and the observed difference was 34.59 percentage pointsMagnitude and significance are separate.
The null was acceptedThe null was not rejectedNonsignificance does not establish equality.
The success rate was 0.846%The success rate was 84.6%Proportion-to-percentage conversion must multiply by 100.
Best final report: state 549/649, p̂ = .846, p0 = .50, exact p < .001, exact 95% CI [.816, .873], and Cohen's h = .764.

Common Binomial Test Mistakes and How to Correct Them

Common mistakeWhy it is wrongCorrect approach
Calling the method a binomial t testA t-test evaluates means, not one binary probability.Use “Binomial Test” or “exact Binomial Test.”
Using the test to compare two groupsA one-sample Binomial Test compares one p with a fixed p0.Use a two-proportion or exact 2 × 2 method.
Doubling the smaller tail automaticallyThis can disagree with probability-ordering for asymmetric discrete distributions.Use the exact definition implemented by the selected software.
Reporting p = .000The probability is not exactly zero.Report p < .001 or the scientific-notation value.
Ignoring the success definitionReaders cannot reproduce x or interpret direction.State the event category and cutpoint.
Assuming exact means assumption-freeThe binomial model still requires binary, independent, constant-probability trials.Assess the design assumptions directly.
Selecting one-sided after seeing the resultThis inflates false-positive risk.Prespecify the alternative.
Using separate subgroup bars as a group-comparison testDescriptive proportions do not test equality between groups.Use a direct two-group method.
Reporting only the p-valueMagnitude and uncertainty are missing.Report p̂, exact CI and an effect measure.
Ignoring dichotomizationThe binary threshold discards information in G3.Justify the cutpoint and consider a full-scale analysis.
Using a normal approximation with tiny expected countsThe z reference can be inaccurate.Use the exact Binomial Test.
Interpreting nonsignificance as equalityFailure to reject is not proof of no difference.Interpret the interval and consider equivalence methods.
Best practice: define success, verify the binomial assumptions, select the alternative before analysis, reproduce the exact p-value and report the effect with an exact confidence interval.

Binomial Test Reports and Worked Excel Download

Workbook controls: the Excel file allows the success cutpoint, null proportion, alpha and confidence level to be changed while formulas recalculate the complete analysis.

Frequently Asked Questions About the Binomial Test

The Binomial Test questions below address assumptions, formula, calculator use, exact probability, software, interpretation and APA reporting without repeating the full worked sections above.

What is a Binomial Test?

A Binomial Test is an exact one-sample test of whether a binary outcome probability equals a specified value.

What are the Binomial Test hypotheses?

The null is p = p0. The alternative can be p ≠ p0, p > p0 or p < p0.

When should a Binomial Test be used?

Use it for one sample of binary, independent, constant-probability observations with a fixed n and a prespecified null probability.

What are the Binomial Test assumptions?

The outcome is binary, trials are independent, n is fixed, the success probability is constant and the null probability is specified.

Is the Binomial Test only for small samples?

No. It is exact for any sample size under the binomial model. Approximate methods become more accurate as n grows.

What is the exact Binomial Test formula?

It uses P(X=k)=C(n,k)p0^k(1-p0)^(n-k) and sums the probabilities in the selected exact tail region.

How is a two-sided exact p-value calculated?

Common software sums probabilities of outcomes no more probable than the observed outcome under H0.

Can I always double a one-sided p-value?

No. That shortcut can disagree with probability-ordering when the null binomial distribution is asymmetric.

What is a one tailed Binomial Test?

It tests whether p is specifically greater than or less than p0 and should be selected before viewing the result.

What is a two tailed Binomial Test?

It tests whether p differs from p0 in either direction.

What is the observed proportion in this example?

The observed proportion is 549/649 = 0.845917, or 84.59%.

What is the exact p-value in this example?

The exact two-sided p-value is approximately 5.9969e-76.

What is the exact confidence interval?

The Clopper-Pearson 95% interval is [0.815805, 0.872838].

What does Cohen's h mean?

Cohen's h standardizes the difference between p-hat and p0. Here h = 0.764, close to the conventional large benchmark.

Does the Binomial Test have a test statistic?

R reports the success count, while SciPy reports the observed proportion. The exact test does not need a normal-reference z statistic.

What is a binomial t test?

It is usually a mistaken phrase. Use a t-test for a quantitative mean and a Binomial Test for a binary probability.

Is a Binomial Test nonparametric?

Software may place it among nonparametric tests, but it still assumes a specific binomial probability model.

Can a Binomial Test compare two groups?

Not directly. Use a two-proportion test or a suitable exact 2 x 2 method.

Can a Binomial Test adjust for covariates?

No. Use binary logistic regression when predictors or adjustment variables are required.

How do I run a Binomial Test in Python?

Use scipy.stats.binomtest with k, n, p and an alternative.

How do I run a Binomial Test in R?

Use binom.test(x, n, p, alternative, conf.level).

How do I run a Binomial Test in SPSS?

Create or select a dichotomous variable, set the test proportion and identify the success category in the one-sample nonparametric procedure.

How do I run a Binomial Test in Excel?

Use BINOM.DIST for each possible count, sum probability-ordered outcomes and use BETA.INV for exact confidence limits.

Why does SPSS display .000?

SPSS rounds very small significance values. Report p < .001 rather than p = .000.

What is the difference between exact and approximate tests?

The exact test uses the finite binomial distribution; an approximate z-test uses a normal reference.

Does the Binomial Test require normality?

No. The binary count follows a binomial model, not a normal outcome distribution.

Why is the school chart descriptive?

The formal test uses the complete sample. Comparing school proportions directly requires a two-group test.

Why can subgroup probabilities differ?

The simple one-sample model averages across subgroup heterogeneity. Different predictors may be related to the outcome.

What is the success cutpoint in this example?

Success is defined as G3 at least 10.

How should the result be reported in APA style?

Report 549/649, p-hat = .846, p0 = .50, exact p < .001, exact 95% CI [.816, .873] and Cohen's h = .764.

What is the main conclusion?

The observed success rate of 84.59% is substantially higher than the hypothesized 50% rate.

Binomial Test Conclusion

The Binomial Test is an exact one-sample method for evaluating a binary population proportion. It is appropriate when the outcome is binary, the trials are independent, the number of trials is fixed and the probability is constant under the simple model.

In the worked example, 549 of 649 students had G3 ≥ 10, giving an observed proportion of 0.845917. The exact two-sided p-value was 5.9969e-76, and the exact 95% confidence interval was [0.8158, 0.8728]. The null proportion of .50 was rejected.

The difference was also substantial in magnitude: the observed proportion was 34.59% above the null, and Cohen's h was 0.764. The final report should include the success definition, x, n, p̂, p0, exact p-value, exact confidence interval and effect size.

Final reporting line: an exact two-sided Binomial Test showed that the G3 ≥ 10 proportion (549/649, p̂ = .846) was greater than expected under p0 = .50, p < .001, exact 95% CI [.816, .873], Cohen's h = .764.

Back to top

Need help applying this to your own data?

Salar Cafe can help interpret output, clean datasets, review assumptions, build dashboards and explain statistical results ethically.

Need help interpreting your data analysis results?

Contact Salar Cafe
Engr. Muhammad Yar Saqib author profile photo

Engr. Muhammad Yar Saqib

Engr. Muhammad Yar Saqib is an electrical engineer educated at the University of Bradford, United Kingdom, a writer and poet, and an Assistant Education Officer in the School Education Department, Punjab, serving since July 2017. He writes practical guides on statistics, SPSS, data analysis, mathematics and educational technology, with an emphasis on transparent methods, reproducible calculations and ethical learning support.