Binomial test
When the number of trials is large, we could also use a Chi-square test or a G-test, but with small sample size, the approximation between these test break down.
binom.test {stats}
- x is the number of observed successes (defined by the context of the test
- p is the expected probability of a success. This value is determined by the type of problem in hand, it is the results of the theoretical model underlying the null Hypothesis.
- alternative indicates whether it is the bilateral or unilateral tests that are to be used.
- Finally, the conf.level defines the confidence level of the test (0.95 is typical, but other values can be used).
Binomial test
M Claereboudt
December 19, 2015
The binomial test examines whether a number of “successful” events correspond to a binomial distribution. For instance, after throwing a regular dice 232 times, we obtain 51 sixes, is this “normal” or is this too much ?. Should we suspect that the owner of the dice cheated ? On a normal dice, the probability of obtaining a 6 (success here) is 1/6.
binom.test(51,232,1/6, alternative = "greater")
##
## Exact binomial test
##
## data: 51 and 232
## number of successes = 51, number of trials = 232, p-value =
## 0.02128
## alternative hypothesis: true probability of success is greater than 0.1666667
## 95 percent confidence interval:
## 0.1758254 1.0000000
## sample estimates:
## probability of success
## 0.2198276
We used a unilateral test, because here we are interested to know the the dice was “tricked” to produce more 6 than expected by the model. If we were to be only interested in knowing if the observed results were compaticle with a “normal” dice, we would have used a bilateral test:
binom.test(51,232,1/6, alternative = "two.sided")
##
## Exact binomial test
##
## data: 51 and 232
## number of successes = 51, number of trials = 232, p-value =
## 0.03423
## alternative hypothesis: true probability of success is not equal to 0.1666667
## 95 percent confidence interval:
## 0.1682745 0.2786909
## sample estimates:
## probability of success
## 0.2198276
In both cases, we have to reject the null hypothesis: the dice is likely loaded. Note also that nearly the whole output is similar (normal), but that the p-value is different.