Binomial test
Encyclopedia
In statistics
Statistics
Statistics is the study of the collection, organization, analysis, and interpretation of data. It deals with all aspects of this, including the planning of data collection in terms of the design of surveys and experiments....

, the binomial test is an exact test
Exact test
In statistics, an exact test is a test where all assumptions upon which the derivation of the distribution of the test statistic is based are met, as opposed to an approximate test, in which the approximation may be made as close as desired by making the sample size big enough...

 of the statistical significance
Statistical significance
In statistics, a result is called statistically significant if it is unlikely to have occurred by chance. The phrase test of significance was coined by Ronald Fisher....

 of deviations from a theoretically expected distribution of observations into two categories.

Common use

The most 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
Multinomial test
In statistics, the multinomial test is the test of the null hypothesis that the parameters of a multinomial distribution equal specified values. It is used for categorical data; see Read and Cressie....

, based on the multinomial distribution, must be used instead of the binomial test.

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
Pearson's chi-squared test
Pearson's chi-squared test is the best-known of several chi-squared tests – statistical procedures whose results are evaluated by reference to the chi-squared distribution. Its properties were first investigated by Karl Pearson in 1900...

 and the G-test
G-test
In statistics, G-tests are likelihood-ratio or maximum likelihood statistical significance tests that are increasingly being used in situations where chi-squared tests were previously recommended....

. 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
Board game
A board game is a game which involves counters or pieces being moved on a pre-marked surface or "board", according to a set of rules. Games may be based on pure strategy, chance or a mixture of the two, and usually have a goal which a player aims to achieve...

 that depends on the roll of a dice
Dice
A die is a small throwable object with multiple resting positions, used for generating random numbers...

, and special importance attaches to rolling a 6. In a particular game, the dice is rolled 235 times, and 6 comes up 51 times. If the dice 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
Null hypothesis
The practice of science involves formulating and testing hypotheses, assertions that are capable of being proven false using a test of observed data. The null hypothesis typically corresponds to a general or default position...

 of a fair dice?

To find an answer to this question using the binomial test, we consult the binomial distribution B(235,1/6) to find out what the probability is of finding exactly 51 sixes in a sample of 235 if the true probability of a 6 on each trial is 1/6. We then find the probability of finding exactly 52, exactly 53, and so on up to 235, and add all these probabilities together. In this way, we obtain the probability of obtaining the observed result (51 6s) or a more extreme result (>51 6s) and in this example, the result is 0.0265443, which is unlikely (significant at the 5% level) to come from a dice that is not loaded to give many 6s (one-tailed test).

Clearly a dice could roll too few sixes as easily as too many and we would be just as suspicious, so we should use the two-tailed test
Two-tailed test
The two-tailed test is a statistical test used in inference, in which a given statistical hypothesis, H0 , will be rejected when the value of the test statistic is either sufficiently small or sufficiently large...

 which considers the probability of having a particular effect size either above or below expectation. Here the effect size is 11.83, since that is how many more sixes there were than expected, with 51 found vs. 39.17 expected. So now we have to find the probability that the dice would roll a six 27 times or less (39.17 expected - 11.83 equal effect size) [arguable, see discussion]. Summing over all the probabilities (< 28 6s) yields .0172037. When we add this to the first result, we get .0437480, which is significant at the 5% significance level. If the cost of a false accusation was too high, we might have a more stringent requirement, like 1% significance level, in which case we could not reject the null hypothesis of a fair dice with sufficient certainty.

In statistical software packages

Binomial tests are available in most software used for statistical purposes. E.g.
  • In R
    R (programming language)
    R is a programming language and software environment for statistical computing and graphics. The R language is widely used among statisticians for developing statistical software, and R is widely used for statistical software development and data analysis....

     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 SPSS
    SPSS
    SPSS is a computer program used for survey authoring and deployment , data mining , text analytics, statistical analysis, and collaboration and deployment ....

     the test can be utilized through the menu Analyze > Nonparametric test > Binomial
  • In Python
    Python (programming language)
    Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Python claims to "[combine] remarkable power with very clear syntax", and its standard library is large and comprehensive...

    , use SciPy
    SciPy
    SciPy is an open source library of algorithms and mathematical tools for the Python programming language.SciPy contains modules for optimization, linear algebra, integration, interpolation, special functions, FFT, signal and image processing, ODE solvers and other tasks common in science and...

    :
    • 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)
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK