Binomial Test

Suppose you have a (fair) coin and toss it for fifty times. How many heads will you get?

binom50_0r5
Figure 1. Coin Toss (50 times, p=0.5)

The answer is shown in Fig. 1. You are most likely to have twenty-five heads with the probability of 0.1122752. You are very unlikely to have, say, fourteen heads, because the probability of happening this is only 0.0008329743, which is less than one in thousand times.

binom50_0r2
Figure 2. Coin Toss (50 times, p=0.2)

If you somehow have a coin that gives you a head with the probability of 0.2, then you will have the results shown in Fig. 2. This time you are most likely to have ten heads with the probability of 0.139819.

binom50_0r1
Figure 3. Coin Toss (50 times, p=0.1)

binom50_0r02
Figure 4. Coin Toss (50 times, p=0.02)

With the head probabilities of either 0.1 or 0.02, the results are shown in Figures 3 and 4, respectively. In the latter case, you are most likely to have only one head, and the probabilites of having 0, 1, 2, 3 or 4 heads are 0.364169680, 0.371601714, 0.185800857, 0.060669668, 0.014548339, respectively.

Question 1:

You have a fake coin with the words “p=0.02” engraved on the head, and toss it fifty times. If you happen to have 3 heads insted of only one, do you say that your “fake” coin is a fake?

Answer 1:

No, you can’t. The binomial test for this case is;

>  binom.test(3,50,0.02)

	Exact binomial test

data:  3 and 50
number of successes = 3, number of trials = 50, p-value = 0.07843
alternative hypothesis: true probability of success is not equal to 0.02
95 percent confidence interval:
 0.01254859 0.16548195
sample estimates:
probability of success
                  0.06

The p-value is 0.07843, which is not less than the significance level of 0.05, and we can not reject the null hypothesis that the probability having a head is 0.02.

> dbinom(0:2,50,0.02)
[1] 0.3641697 0.3716017 0.1858009
> sum(dbinom(0:2,50,0.02))
[1] 0.9215723
> 1-sum(dbinom(0:2,50,0.02))
[1] 0.07842775

In other words, the probability of having either 0, 1 or 2 heads is 92.15723%, and the probability of having more than or equal to 3 heads is 7.842775%, which is more than 5% and can not be considered to be “very unlikely”.

Question 2:

In the year 2012, you observed 47 XYZ patients in Alpha_district (population 490,000), and 3 XYZ patients in Bravo_district (population 10,000). The incidence rates for the two districts are 0.96e-04 and 3.0e-04, respectively. Do you say that the people in Bravo_district is more prone to XYZ?

Answer 2:

The same as Answer 1.