From Wikipedia, the free encyclopedia - View original article
One common use of the binomial test is in the case where the null hypothesis is that two categories are equally likely to occur (such as a coin toss). Tables are widely available to give the significance observed numbers of observations in the categories for this case. However, as the example below shows, the binomial test is not restricted to this case.
For large samples such as the example below, the binomial distribution is well approximated by convenient continuous distributions, and these are used as the basis for alternative tests that are much quicker to compute, Pearson's chi-squared test and the G-test. However, for small samples these approximations break down, and there is no alternative to the binomial test.
Suppose we have a board game that depends on the roll of a dice and attaches special importance to rolling a 6. In a particular game, the die is rolled 235 times, and 6 comes up 51 times. If the die is fair, we would expect 6 to come up 235/6 = 39.17 times. Is the proportion of 6's significantly higher than would be expected by chance, on the null hypothesis of a fair die?
To find an answer to this question using the binomial test, we use the binomial distribution B(235,1/6) to calculate the probability of 51 or more sixes in a sample of 235 if the true probability of rolling a 6 on each trial is 1/6. This is done by adding up the probability of getting exactly 51 sixes, exactly 52 sixes, and so on up to 235.
In this case, the probability of getting 51 or more sixes on a fair die is 0.027. If we were looking for significance at the 5% level, this result indicates that the die is loaded to give many 6's (one-tailed test).
The above test looks at whether the die rolls too many sixes. We could also use a two-tailed test which could tell us if the die is biased to produce either too few or too many sixes. Then the same result of 0.027 is beyond the 0.025 limit corresponding to a two-tailed test at the 5% level; thus this result would not indicate that the die is unfair.
|Wikiversity has learning materials about Binomial test|
Binomial tests are available in most software used for statistical purposes. E.g.
PROC FREQ DATA=DiceRoll ; TABLES Roll / BINOMIAL (P=0.166667) ALPHA=0.05 ; EXACT BINOMIAL ; WEIGHT Freq ; RUN;
scipy.stats.binom.sf(51-1, 235, 1.0/6) # -1 is there to include 51 as well ;-)(one-tailed test)
scipy.stats.binom_test(51, 235, 1.0/6)(two-tailed test)
[phat,pci]=binofit(51, 235,0.05)(generally two-tailed, one-tailed for the extreme cases "0 out of n" and "n out of n"). You will get back the probability for the dice to roll a six (phat) as well as the confidence interval (pci) for the confidence level of 95% = (1-0.05), respectively a significance of 5%.