The binomial test
Is a coin fair? Do more than half of customers prefer the new design? Is a defect rate above the 5% target? Questions about a single proportion are answered by the binomial test, built directly on the binomial distribution.
How it works
Assuming the true proportion is p₀, the binomial distribution gives the probability of every possible count. The two-sided p-value adds up the probabilities of all outcomes as unlikely as, or less likely than, the one observed.
Worked example: are manual and automatic cars equally common?
Of the 32 cars in R’s mtcars data, 13 have manual transmissions. Is that consistent with a 50:50 split?
Category tested: 1 Other categories: 0 Count: 13 N: 32 Observed proportion: 0.4062 Test proportion: 0.5 Proportion CI (95%): [0.2370, 0.5936] P-value: 0.3771 Rows excluded for missing values: 0 of 32
> binom.test(13, 32, p = 0.5)
Exact binomial test
data: 13 and 32
number of successes = 13, number of trials = 32, p-value = 0.3771
alternative hypothesis: true probability of success is not equal to 0.5
95 percent confidence interval:
0.2369841 0.5935508
sample estimates:
probability of success
0.40625The p-value and exact confidence interval match R.
Interpretation
- Observed proportion 40.6%, 95% CI [23.7%, 59.4%].
- p = .377: no evidence that the split differs from 50:50. The interval includes 50%, but it’s wide, because 32 cars is a small sample.
APA write-up
Thirteen of 32 cars (41%, 95% CI [24%, 59%]) had manual transmissions. An exact binomial test found no evidence that this proportion differed from .50, p = .377.
When to use other tests
- Large samples: a z-test for a proportion gives nearly the same answer, but the exact test is always valid.
- More than two categories: the chi-square goodness-of-fit test.
- Comparing two groups’ proportions: chi-square or Fisher’s exact test.
- The same people on two occasions: McNemar’s test.
How to run it
- SPSS: Analyze → Nonparametric Tests → Legacy Dialogs → Binomial.
- R:
binom.test(successes, n, p = 0.5) - Python:
scipy.stats.binomtest(successes, n, p=0.5) - Analytika: ask, for example, “is the share of manual cars different from 50%?”.
More in Categorical data
Run this on your own data
Upload a dataset and ask your question in plain English. Analytika checks the assumptions, picks the test, runs it, and writes the results up in APA format.