Tests for Bernoulli Populations
Context: FIT2086_MOC · Hypothesis Testing applied to binary data — rates, proportions, failure rates · no exact normal sampling distribution exists, so the test is built on the CLT · the discrete counterpart of Tests for Normal Means (z-test and t-test)
Quick Revision
- 🎯 Objective: ➔ standardise by the null’s standard error ➔ read the tail ➔ approximate -value.
- 📦 Core Components: one population ➔ built from | two populations ➔ built from the pooled .
- ⚡ Key Constraint: every -value here is approximate and requires a large sample — the normal is standing in for a discrete binomial.
📝 Core
- Why it matters ➔ the natural home of “has the rate changed?” and “is the advertised failure rate met?” — e.g. a supplier guarantees a component failure rate below and a customer tests it from a sample.
- The estimate is a mean ➔ with the number of successes ➔ being an average, it inherits asymptotic normality from the CLT.
- Single-population statistic ➔ under .
- The null supplies the variance ➔ a Bernoulli’s variance is a function of its mean, so imposing fixes the standard error at — no separate variance to estimate, unlike the normal-mean case.
- Two populations pool under the null ➔ asserts one common , so both samples estimate it: .
- Two-population statistic ➔ .
- -values ➔ same three-way rule as everywhere: two-sided · upper · lower ➔ Hypothesis Testing.
- Exact alternatives exist ➔ methods using binomial properties directly; in R
binom.test()for one sample andprop.test()for two ➔ R Toolkit (Cheatsheet).
🧮 Proof Blueprint
Theorem. For testing , the statistic is approximately under . Strategy: recognise as a sample mean, apply the CLT under the null, then standardise by the null-implied standard error.
Q.E.D. ➔ convergence is asymptotic, so the resulting -value is approximate; the discrete exact test is the reference when is small or near or .
📊 Worked Example — France vs Spain
Problem: people surveyed, prefer France. Is there a real preference () or is this chance?
Final extracted output: approximate vs exact from binom.test(x=37, n=60, p=0.5) — both grade as weak evidence against a split, but the normal approximation is optimistic by of the -value, which matters when a result sits near a threshold.
📊 Worked Example — “Guess the Coin” (Studio 5)
Problem: a friend tosses a coin times giving heads. (a) Is the coin fair? (b) After a distraction, a second sequence of gives heads — did she swap the coin?
Final extracted output: (a) — if the coin were fair, almost of -toss sequences would be at least this lopsided ( or heads); no evidence against fairness. Exact: binom.test(4,12,1/2) . (b) — a difference this large would arise by chance in about in repetitions if the coin were unchanged; moderate–strong evidence that the coin was swapped. Exact: prop.test(c(4,10),c(12,12)) , about in — weaker, because the approximation overstates the evidence at .
Sensitivity sweep — how much bias before you suspect?
| Heads in | Exact (binom.test) | Evidence grade |
|---|---|---|
| (observed) | none | |
| none | ||
| moderate — this is where suspicion starts | ||
| strong |
Reading it: by symmetry the same grades apply to , heads. At the discreteness is coarse — a single extra head moves by a factor of — which is exactly why the normal approximation cannot be trusted here.
⚠️ Common Mistakes
- 💡 Using in the single-sample standard error ➔ the denominator is built from the null , because the whole calculation is conducted assuming true; substituting is the confidence-interval move, not the testing move.
- 💡 Using separate in the two-sample standard error ➔ under there is only one population proportion, so it is estimated once by pooling all successes over all trials.
- 💡 Trusting the approximation at small or extreme ➔ the CLT justification is asymptotic; use
binom.test/prop.testand report that the normal is approximate. - 💡 Pooling by averaging the two proportions ➔ unless ; pool the counts, not the rates.
🧠 Active Recall
Why does the single-population test divide by rather than , when the normal-mean test happily substitutes ?
Answer
- Short answer: for a Bernoulli the variance is determined by the mean, so once fixes it also fixes the variance — there is nothing left to estimate. For a normal, and are separate parameters, so says nothing about and it must be estimated.
- Why: A test statistic is computed under the null ➔ using would mix sample information into a quantity the null has already pinned down, giving the wrong reference distribution.
The approximate test gives and the exact
binom.testgives . Which do you report, and does the conclusion change?Answer
- Short answer: report the exact when available; both exceed and grade as weak evidence, so the substantive conclusion — no demonstrated preference for France — is unchanged.
- Why: The normal is a continuous stand-in for a discrete law ➔ the approximation error is systematic, not random, and at it moves by enough that a result landing at could flip a naive significance verdict. This is exactly why the unit prefers grading evidence to thresholding it.