Binomial test

Definition taught in Hypothesis tests, part of Statistical inference

Binomial test

Type Definition
Taught in Hypothesis tests
Part Statistical inference
Worked examples 3

For X\sim\operatorname{Bin}(n,p) and H_0:p=p_0, the test statistic is X, with null distribution \operatorname{Bin}(n,p_0). At level \alpha, against p>p_0 reject when X\ge c, with c the smallest integer such that \mathbb{P}_{H_0}(X\ge c)\le\alpha. Against p<p_0 reject when X\le c, with c the largest integer such that \mathbb{P}_{H_0}(X\le c)\le\alpha. Against p\neq p_0, use both tails at \alpha/2 each.

Examples

A gene in lake fish

Worked example from Hypothesis tests

A gene occurs in 15% of a fish population. In a sample of 100 fish from one lake, 10 carry it.

Question. Is there evidence that the lake population differs?

Solution. (1) Let X be the number of carriers among 100, X\sim\operatorname{Bin}(100,p). (2) H_0:p=0.15 against H_1:p\neq0.15; the alternative is the claim that the lake is different. (3) The statistic is X. (4) Under H_0, X\sim\operatorname{Bin}(100,0.15). (5) x=10. (6) The two-sided p-value is 2\mathbb{P}_{H_0}(X\le10)=2\times0.0994=0.199. The normal approximation \operatorname{N}(15,12.75) gives 2\Phi\{(10-15)/\sqrt{12.75}\}=2\Phi(-1.40)=0.161, and with the continuity correction, 2\Phi\{(10.5-15)/\sqrt{12.75}\}=0.208, close to the exact value. (7) The p-value is large, so H_0 is not rejected. (8) There is no evidence that the proportion of carriers in the lake differs from 15%.

A biased coin

Worked example from Estimation examples

A coin is tossed 1000 times and shows 570 heads.

Question. Estimate the probability of heads, and say whether p=0.5 is plausible.

Solution. Model the count as X\sim\operatorname{Bin}(1000,p) with p unknown. The probability p will never be known; the data give an estimate, \widehat p=570/1000=0.570. Its standard error is \sqrt{0.57\times0.43/1000}=0.0157, and the approximate 95% interval is

0.570\pm1.96\times0.0157=(0.539,\ 0.601).

R’s exact binomial interval agrees to three decimal places:

binom.test(570, 1000)$conf.int     # 0.5386 0.6009

The interval excludes 0.5, so a fair coin is not a plausible explanation of 570 heads.

A new sweetener

Worked example from Testing examples

Ten people each taste two yoghurts, one with an old sweetener and one with a new one. Eight prefer the new one.

Question. Test whether the new sweetener is preferred, exactly and by the normal approximation.

Solution. Let X\sim\operatorname{Bin}(10,p) be the number preferring the new yoghurt, and test H_0:p=0.5 against H_1:p>0.5. The exact binomial test has p-value \mathbb{P}(X\ge8)=0.0547:

binom.test(x = 8, n = 10, p = 0.5, alternative = "greater")
# number of successes = 8, number of trials = 10, p-value = 0.05469

The normal approximation uses z=(0.8-0.5)/\sqrt{0.5\times0.5/10}=1.897, with p-value 0.0289:

prop.test(x = 8, n = 10, p = 0.5, alternative = "greater", correct = FALSE)$p.value
# 0.02889

The two p-values differ by a factor of two, and they fall on opposite sides of 0.05. Ten observations are too few for the central limit theorem, so the exact test is the one to report. For small samples use binom.test.

Used in

See also

Sign test · Null and alternative hypotheses · Critical region · p-value · Type I and type II errors · Neyman–Pearson approach · Power function · One-sample t test

Glossary and index