HOME

TheInfoList



OR:

In statistics, the binomial test is an exact test of the
statistical significance In statistical hypothesis testing, a result has statistical significance when it is very unlikely to have occurred given the null hypothesis (simply by chance alone). More precisely, a study's defined significance level, denoted by \alpha, is the p ...
of deviations from a theoretically expected distribution of observations into two categories using sample data.


Usage

The binomial test is useful to test hypotheses about the probability (\pi) of success: : H_0:\pi=\pi_0 where \pi_0 is a user-defined value between 0 and 1. If in a sample of size n there are k successes, while we expect n\pi_0, the formula of the
binomial distribution In probability theory and statistics, the binomial distribution with parameters ''n'' and ''p'' is the discrete probability distribution of the number of successes in a sequence of ''n'' independent experiments, each asking a yes–no qu ...
gives the probability of finding this value: : \Pr(X=k)=\binomp^k(1-p)^ If the null hypothesis H_0 were correct, then the expected number of successes would be n\pi_0. We find our p-value for this test by considering the probability of seeing an outcome as, or more, extreme. For a one-tailed test, this is straightforward to compute. Suppose that we want to test if \pi<\pi_0. Then our p-value would be, : p = \sum_^k\Pr(X=i)=\sum_^k\binom\pi_0^i(1-\pi_0)^ An analogous computation can be done if we're testing if \pi>\pi_0 using the summation of the range from k to n instead. Calculating a p-value for a two-tailed test is slightly more complicated, since a binomial distribution isn't symmetric if \pi_0\neq 0.5. This means that we can't just double the p-value from the one-tailed test. Recall that we want to consider events that are as, or more, extreme than the one we've seen, so we should consider the probability that we would see an event that is as, or less, likely than X=k. Let \mathcal=\ denote all such events. Then the two-tailed p-value is calculated as, : p = \sum_\Pr(X=i)=\sum_\binom\pi_0^i(1-\pi_0)^


Common use

One common use of the binomial test is in the case where the
null hypothesis In scientific research, the null hypothesis (often denoted ''H''0) is the claim that no difference or relationship exists between two sets of data or variables being analyzed. The null hypothesis is that any experimentally observed difference is d ...
is that two categories are equally likely to occur (such as a coin toss), implying a null hypothesis H_0:\pi=0.5. 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. When there are more than two categories, and an exact test is required, the multinomial test, based on the
multinomial distribution In probability theory, the multinomial distribution is a generalization of the binomial distribution. For example, it models the probability of counts for each side of a ''k''-sided dice rolled ''n'' times. For ''n'' independent trials each of w ...
, must be used instead of the binomial test.


Large samples

For large samples such as the example below, the
binomial distribution In probability theory and statistics, the binomial distribution with parameters ''n'' and ''p'' is the discrete probability distribution of the number of successes in a sequence of ''n'' independent experiments, each asking a yes–no qu ...
is well approximated by convenient continuous distributions, and these are used as the basis for alternative tests that are much quicker to compute, such as
Pearson's chi-squared test Pearson's chi-squared test (\chi^2) is a statistical test applied to sets of categorical data to evaluate how likely it is that any observed difference between the sets arose by chance. It is the most widely used of many chi-squared tests (e.g ...
and the G-test. However, for small samples these approximations break down, and there is no alternative to the binomial test. The most usual (and easiest) approximation is through the standard normal distribution, in which a z-test is performed of the test statistic Z, given by : Z=\frac where k is the number of successes observed in a sample of size n and \pi is the probability of success according to the null hypothesis. An improvement on this approximation is possible by introducing a continuity correction: : Z=\frac For very large n, this continuity correction will be unimportant, but for intermediate values, where the exact binomial test doesn't work, it will yield a substantially more accurate result. In notation in terms of a measured sample proportion \hat, null hypothesis for the proportion p_0, and sample size n, where \hat=k/n and p_0=\pi, one may rearrange and write the z-test above as : Z=\frac by dividing by n in both numerator and denominator, which is a form that may be more familiar to some readers.


Example

Suppose we have a
board game Board games are tabletop games that typically use . These pieces are moved or placed on a pre-marked board (playing surface) and often include elements of table, card, role-playing, and miniatures games as well. Many board games feature a ...
that depends on the roll of one die 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\times1/6 = 39.17 times. We have now observed that the number of 6s is higher than what we would expect on average by pure chance had the die been a fair one. But, is the number significantly high enough for us to conclude anything about the fairness of the die? This question can be answered by the binomial test. Our
null hypothesis In scientific research, the null hypothesis (often denoted ''H''0) is the claim that no difference or relationship exists between two sets of data or variables being analyzed. The null hypothesis is that any experimentally observed difference is d ...
would be that the die is fair (probability of each number coming up on the die is 1/6). To find an answer to this question using the binomial test, we use the
binomial distribution In probability theory and statistics, the binomial distribution with parameters ''n'' and ''p'' is the discrete probability distribution of the number of successes in a sequence of ''n'' independent experiments, each asking a yes–no qu ...
: B(N=235, p=1/6) with pmf f(k,n,p) = \Pr(k;n,p) = \Pr(X = k) = \binomp^k(1-p)^ . As we have observed a value greater than the expected value, we could consider the probability of observing 51 6s or higher under the null, which would constitute a one-tailed test (here we are basically testing whether this die is biased towards generating more 6s than expected). In order to calculate the probability of 51 or more 6s in a sample of 235 under the null hypothesis we add up the probabilities of getting exactly 51 6s, exactly 52 6s, and so on up to probability of getting exactly 235 6s: : \sum_^ p^i(1-p)^ = 0.02654 If we have a significance level of 5%, then this result (0.02654 < 5%) indicates that we have evidence that is significant enough to reject the null hypothesis that the die is fair. Normally, when we are testing for fairness of a die, we are also interested if the die is biased towards generating fewer 6s than expected, and not only more 6s as we considered in the one-tailed test above. In order to consider both the biases, we use a two-tailed test. 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-tailed test reveals significance at the 5% level, indicating that the number of 6s 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 = "less") (one-tailed test) ** binom.test(51, 235, 1/6, alternative = "greater") (one-tailed test) ** binom.test(51, 235, 1/6, alternative = "two.sided") (two-tailed test) * In
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mo ...
using the
Apache Commons The Apache Commons is a project of the Apache Software Foundation, formerly under the Jakarta Project. The purpose of the Commons is to provide reusable, open source Java software. The Commons is composed of three parts: proper, sandbox, and dorma ...
library: ** new BinomialTest().binomialTest(235, 51, 1.0 / 6, AlternativeHypothesis.LESS_THAN) (one-tailed test) ** new BinomialTest().binomialTest(235, 51, 1.0 / 6, AlternativeHypothesis.GREATER_THAN) (one-tailed test) ** new BinomialTest().binomialTest(235, 51, 1.0 / 6, AlternativeHypothesis.TWO_SIDED) (two-tailed test) * In
SAS SAS or Sas may refer to: Arts, entertainment, and media * ''SAS'' (novel series), a French book series by Gérard de Villiers * ''Shimmer and Shine'', an American animated children's television series * Southern All Stars, a Japanese rock ba ...
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'' npar tests /binomial (.5) = node1 node2. * In Python, use SciPy'
binomtest
** scipy.stats.binomtest(51, 235, 1.0/6, alternative='greater') (one-tailed test) ** scipy.stats.binomtest(51, 235, 1.0/6, alternative='two-sided') (two-tailed test) * In
MATLAB MATLAB (an abbreviation of "MATrix LABoratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementa ...
, us
myBinomTest
which is available via Mathworks' community File Exchange website. myBinomTest will directly calculate the p-value for the observations given the hypothesized probability of a success.
out Out may refer to: Arts, entertainment, and media Films * ''Out'' (1957 film), a documentary short about the Hungarian Revolution of 1956 * ''Out'' (1982 film), an American film directed by Eli Hollander * ''Out'' (2002 film), a Japanese film ba ...
myBinomTest(51, 235, 1/6)
(generally two-tailed, but can optionally perform a one-tailed test). * In Stata, use bitest. * In
Microsoft Excel Microsoft Excel is a spreadsheet developed by Microsoft for Windows, macOS, Android and iOS. It features calculation or computation capabilities, graphing tools, pivot tables, and a macro programming language called Visual Basic for ...
, 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.


See also

* ''p''-value * Lady tasting tea experiment


References

* {{cite web, title=The binomial test, url=http://www.graphpad.com/guides/prism/6/statistics/index.htm?stat_binomial.htm, website=www.graphpad.com


External links


Binomial Probability Calculator
Statistical tests Articles with example R code Articles with example Python (programming language) code Articles with example MATLAB/Octave code Articles with example Java code