#jsDisabledContent { display:none; } My Account | Register | Help

# Binomial test

Article Id: WHEBN0000935655
Reproduction Date:

 Title: Binomial test Author: World Heritage Encyclopedia Language: English Subject: Collection: Publisher: World Heritage Encyclopedia Publication Date:

### Binomial test

In statistics, the binomial test is an exact test of the statistical significance of deviations from a theoretically expected distribution of observations into two categories.

## Contents

• Common use 1
• Large samples 2
• Example binomial test 3
• In statistical software packages 5
• References 6

## Common use

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.

Where there are more than two categories, and an exact test is required, the multinomial test, based on the multinomial distribution, must be used instead of the binomial test.[1]

## Large samples

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.

## Example 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 dice 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 6s 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 dice 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 dice rolls too many sixes. We could also use a two-tailed test which could tell us if the dice is biased to produce either too few or too many sixes. Note that to do this we cannot simply double the one-tailed p-value unless the probability of the event is 1/2.This is because the binomial distribution becomes asymmetric as that probability deviates from 1/2. There are two methods to define the two tailed p-value. One method is to sum the probability that the total deviation in numbers of events in either direction from the expected value is either more than or less than the expected value. The probability of that occurring in our example is 0.0437. The second method involves computing the probability that the deviation from the expected value is as unlikely or more unlikely than the observed value, i.e. from a comparison of the probability density functions. This can create a subtle difference, but in this example yields the same probability of 0.0437. In both cases, the two-sided test reveals significance at the 5% level, indicating that the number of 6’s observed was significantly different for this die than the expected number at the 5% level.

## In statistical software packages

Binomial tests are available in most software used for statistical purposes. E.g.

• In R the above example could be calculated with the following code:
• ```binom.test(51,235,(1/6),alternative="greater")
```
(one-tailed test)
• ```binom.test(51,235,(1/6),alternative="two.sided")
```
(two-tailed test)
• In SAS the test is available in the Frequency procedure
```PROC FREQ DATA=DiceRoll ;
TABLES Roll / BINOMIAL (P=0.166667) ALPHA=0.05 ;
EXACT  BINOMIAL ;
WEIGHT Freq ;
RUN;
```
• In SPSS the test can be utilized through the menu Analyze > Nonparametric test > Binomial
• In Python, use SciPy:
• ```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)
• In MATLAB, use binofit:
• ```[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%.
• Alternatively, myBinomTest is available on the Central File Exchange to directly calculate the p-value for the observations given the hypothesized probability of a success.
```[pout]=myBinomTest(51, 235, 1/6)
```
• In Stata, use bitest.
• In Microsoft Excel, use Binom.Dist. The function takes parameters (Number of successes, Trials, Probability of Success, Cumulative). The "Cumulative" parameter takes a boolean True or False, with True giving the Cumulative probability of finding this many successes (a left-tailed test), and False the exact probability of finding this many successes.

## References

1. ^ Howell, D. C. (2007). Statistical Methods for Psychology (6th ed.). Belmont, CA: Thomson Higher Education.
• The binomial test
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.

Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.

By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from World eBook Library are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.