[R] binom.test & p-value

Rui Barradas ru|pb@rr@d@@ @end|ng |rom @@po@pt
Sun Apr 3 20:19:15 CEST 2022


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
>



More information about the R-help mailing list