Im confused by binom.test.
Let's say I want to test a 4/10 success pattern against p = 0.5. The value of P should be:
P (X <= 4) + P (X> = 6) or P (X <= 4) + 1-P (X <= 5)
and indeed:
>pbinom(4,10,p=0.5) + 1-pbinom(5,10,0.5)
[1] 0.7539063
or
>binom.test(4,10,p=0.5)
Exact binomial test
data: 4 and 10
number of successes = 4, number of trials = 10, p-value = 0.7539
But now I want to test sample 95/150 against p = 0.66. Here the expected value is 99, so the value of P should be
P (X <= 95) + P (X> = 103) or P (X <= 95) + 1-P (X <= 102)
which the
>pbinom(95,150,.66) + 1-pbinom(102,150,.66)
[1] 0.5464849
but
>binom.test(95,150,.66)
Exact binomial test
data: 95 and 150
number of successes = 95, number of trials = 150, p-value = 0.4914
In fact, the difference in the two values of P is exactly equal dbinom(103,150,.66). So it seems that R did not include X = 103.
The only explanation I can guess is that there is a rounding error due to an inaccurate .66 representation causing R to simply skip X = 103. Is that all, or is there something else?