Skip to content
Prev 169437 / 398506 Next

Incorrect p value for binom.test?

Michael Grant wrote:
Yes. Or maybe, it is a matter of definition. The problem is that

 > (0:25)[dbinom(0:25,25,.061) <= dbinom(10,25,.061)]
  [1] 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

so with R's definition of "more extreme", all such values are in the 
upper tail.

Actually, if you look at the actual distribution, I think you'll agree 
that it is rather difficult to define a lower tail with positive 
probability that corresponds to X >= 10.

 > round(dbinom(0:25,25,.061),6)
  [1] 0.207319 0.336701 0.262476 0.130726 0.046708 0.012744
  [7] 0.002760 0.000487 0.000071 0.000009 0.000001 0.000000
[13] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
[19] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
[25] 0.000000 0.000000

In any case, you would be hard pressed to find a subset of 0:25 that has 
the probability that SAS and your textbook claims as the p value.