[R] binom.test & p-value

Sigbert Klinke @|gbert @end|ng |rom w|w|@hu-ber||n@de
Mon Apr 4 08:38:56 CEST 2022


Hi,

the lower critical value is zero since:

 > cbind(0:2, pbinom(0:2, 26, 0.1))

      [,1]       [,2]

[1,]    0 0.06461082

[2,]    1 0.25126430

[3,]    2 0.51050524

the upper critical value c_u=6 since:

 > cbind(5:7, pbinom((5:7), 26, 0.1))

      [,1]      [,2]

[1,]    5 0.9601407

[2,]    6 0.9881313

[3,]    7 0.9970172

with F(c_u)>=0.975 and F(c_u-1)<0.975 .

Thus,

* x=6 is in [0,6] => can not reject null
* p-value 0.03985 < 0.05 => reject null

Am 03.04.22 um 20:19 schrieb Rui Barradas:
> Hello,
> 
> Can you post your computations? Assuming a two-sided test, mine are
> 
> 
> x <- 6
> n <- 26
> p <- 0.1
> 
> cmb <- sapply(x:n, \(i) choose(n, i))
> sum(cmb * p^(x:n) * (1 - p)^(n - (x:n)))
> #[1] 0.03985931
> 
> binom.test(x=6, n=26, p=0.1)$p.value
> #[1] 0.03985931
> 
> 
> The result are equal to one another.
> 
> Às 19:00 de 03/04/2022, Sigbert Klinke escreveu:
>> Hi,
>>
>> for the specific example binom.test(x=6, n=26, p=0.1) I get as p-value 
>> 0.03986. The default approach to decide whether I can reject the null 
>> or or not is to compare the p-value with the given significance level. 
>> Using a significance level of 0.05 this will lead to reject the null 
>> hypothesis.
>>
>> However, computing things by hand it turned out that the critical 
>> values are 0 and 6. Since the test statistic is also 6 I can not 
>> reject the null hypothesis.
>>
>> I found the discussion under 
>> https://stat.ethz.ch/pipermail/r-help/2009-February/380341.html and I 
>> understand that a p-value is not well defined if we have a asymmmetric 
>> (discrete) distribution under the null.
>>
>> At least I would have expected some hint in the documentation for 
>> binom.test.
>>
>> Sigbert
>>


-- 
https://hu.berlin/sk
https://www.stat.de/faqs
https://hu.berlin/mmstat
https://hu.berlin/mmstat-int
https://hu.berlin/mmstat-ar



More information about the R-help mailing list