[R] p-value > 1 in fisher.test()

(Ted Harding) Ted.Harding at nessie.mcc.ac.uk
Sat Jun 4 01:33:17 CEST 2005


On 03-Jun-05 Ted Harding wrote:
> And on mine
> 
> (A: PII, Red Had 9, R-1.8.0):
> 
>  ff <- c(0,10,250,5000); dim(ff) <- c(2,2);
> 
>  1-fisher.test(ff)$p.value
>  [1] 1.268219e-11
> 
> (B: PIII, SuSE 7.2, R-2.1.0beta):
> 
>  ff <- c(0,10,250,5000); dim(ff) <- c(2,2);
> 
>  1-fisher.test(ff)$p.value
>  [1] -1.384892e-12

I have a suggestion (maybe it should also go to R-devel).

There are many functions in R whose designated purpose is
to return the value of a probability (or a probability
density). This designated purpose is in the mind of the
person who has coded the function, and is implicit in its
usage.

Therefore I suggest that every such function should have
a built-in internal check that no probability should be
less than 0 (and if the primary computation yields such
a value then the function should set it exactly to zero),
and should not exceed 1 (in which case the function should
set it exactly to 1). [And, in view of recent echanges,
I would suggest exactly +0, not -0!]

Similar for any attempts to return a negative probability
density; while of course a positive value can be allowed
to be anything.

All probabilities would then be guaranteed to be "clean"
and issues like the Fisher exact test above would no longer
be even a tiny problem.

Implementing this in the possibly many cases where it is
not already present is no doubt a long-term (and tedious)
project.

Meanwhile, people who encounter problems due to its absence
can carry out their own checks and adjustments!

Best wishes to all,
Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 04-Jun-05                                       Time: 00:02:32
------------------------------ XFMail ------------------------------




More information about the R-help mailing list