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

From: Ted Harding <Ted.Harding_at_nessie.mcc.ac.uk>
Date: Sat 04 Jun 2005 - 09:33:17 EST


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@nessie.mcc.ac.uk> Fax-to-email: +44 (0)870 094 0861
Date: 04-Jun-05                                       Time: 00:02:32
------------------------------ XFMail ------------------------------

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Jun 04 09:43:59 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:22 EST