fisher.test FEXACT memory bug "should not occur" (PR#1662)

ripley@stats.ox.ac.uk ripley@stats.ox.ac.uk
Thu, 13 Jun 2002 13:16:34 +0200 (MET DST)


This occurred because integer overflow was giving negative keys.

Append the following line at line 1083 of fexact.c

      if (ipn < 1) ipn += ldst; /* because key might be negative */


> fisher.test(d4)

      Fisher's Exact Test for Count Data

data:  d4
p-value = < 2.2e-16
alternative hypothesis: two.sided



On Thu, 13 Jun 2002 maechler@stat.math.ethz.ch wrote:

> This is a bad bug as reported by Robin Hankin,
> it is still in "R-patched" ...
>
> ##- From: Robin Hankin <r.hankin@auckland.ac.nz>
> ##- To: r-help@stat.math.ethz.ch
> ##- Subject: [R] possum sleeping: thanks and fisher.test() FEXACT error
> ##- Date: Thu, 13 Jun 2002 16:46:26 +1200
>
> ## .....
>
> ## Example slighlty modified (MM)
>
> d4 <- matrix(c(0, 0, 0, 0, 0,  0, 3, 0, 1, 0,  0, 0, 0, 0, 0,
>                1, 0, 0, 0, 0,  1, 0, 0, 2, 0,  0, 0, 1, 0, 0,
>                0, 1, 0, 1, 0,  4, 0, 2, 0, 0,  0, 1, 0, 0, 0,  0, 0, 0, 0, 0,
>                0, 1, 0, 0, 2,  0, 0, 0, 2, 2,  0, 1, 0, 0, 0,
>                0, 0, 1, 1, 0,  0, 0, 0, 0, 0,  0, 1, 0, 0, 0,
>                1, 0, 0, 0, 2,  0, 0, 0, 3, 0,  0, 0, 0, 0, 1,  0, 0, 0, 0, 0,
>                2, 0, 0, 0, 0,  0, 0, 0, 0, 0,  0, 0, 1, 0, 1,
>                0, 0, 0, 0, 2,  0, 0, 0, 0, 8,  0, 0, 0, 3, 0,
>                0, 0, 0, 0, 0,  0, 0, 0, 0, 0,  0, 0, 0, 0, 0,  0, 0, 0, 0, 1,
>                0, 0, 1, 0, 0,  0, 0, 0, 0, 0,  2, 0, 0, 1, 0,
>                0, 2, 0, 0, 0,  0, 2, 0, 0, 1,  3, 0, 0, 0, 0,
>                0, 0, 0, 0, 0,  0, 0, 0, 0, 1,  0, 0, 1, 0, 0,  4, 0, 0, 0, 0),
>              nr=50)
>
> fisher.test(d4)
> ##- Error in fisher.test(alldata[, 2:5]) : FEXACT error 30.
> ##- Stack length exceeded in f3xact.
> ##- This problem should not occur.
>
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-devel 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-devel-request@stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._