[Rd] negative p-value from fisher.test() (PR#7064)

maechler at stat.math.ethz.ch maechler at stat.math.ethz.ch
Wed Jul 7 17:52:33 CEST 2004

>>>>> "anja" == anja von heydebreck <anja.von.heydebreck at merck.de>
>>>>>     on Wed,  7 Jul 2004 17:19:01 +0200 (CEST) writes:

    anja> Full_Name: Anja von Heydebreck Version: 1.9.1 OS:
    anja> Linux Submission from: (NULL) (

    anja> I obtained a negative p-value from the fisher.test()
    anja> function:

    >> fisher.test(matrix(c(14576,3023,89,68),2),
    >> alternative="g")$p.value
    anja> [1] -8.426593e-13

[I do get a slightly different negative P-value here].

    anja> With R 1.8.1, I got a p-value of -6.239231e-12 for
    anja> this example.

(which is slightly worse ;-)

    anja> Anja von Heydebreck

Thank you, Anja!

Note that this is the  2x2 case which does not resort to the
(in)famous FEXACT routine.  The rounding / precision problem is
rather from  dhyper() and/or phyper().

Now, as bug report PR#6772   "phyper accuracy and efficiency",
Morten Welinder
had proposed a new algorithm for phyper().
I'm about to try that and see if it cures this example.

Best regards,
Martin Maechler

More information about the R-devel mailing list