Skip to content
Back to formatted view

Raw Message

Message-ID: <x2r9sfdqbf.fsf@blueberry.kubism.ku.dk>
Date: 1999-01-28T21:45:40Z
From: Peter Dalgaard
Subject: bug in the ctest package: binom.test
In-Reply-To: Mai Zhou's message of Thu, 28 Jan 1999 14:45:16 -0500 (EST)

Mai Zhou <mai at ms.uky.edu> writes:

> R 0630 for windows
> 
> > library(ctest)
> > binom.test(7,10,p=0.3, alternative="two.sided")
> 
> returns a p-value of =< 2.2e-016 and a warning
> 
> In Splus 3.4 
> 
> > binom.test(7,10,p=0.3, alternative="two.sided")
> 
> returns a p-value of 0.0106
> 
> 
> I think it is the 
> 
> max(v[v<=(1+eps)*PVAL])       causing the problem...
> 
> max() of an empty vector.......
> 

Exactly. And conspiring with the lack of a sanity check in format.pval
causing it to print -Inf as < 2.2e-016...

The fix is as simple as max(0,v[v<=(1+eps)*PVAL])
                            ^^
-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._