[R] phyper returning zero

2013-03-15 Thread elliott harrison
Hi,
I am attempting to use phyper to test the significance of two overlapping 
lists. I keep getting a zero and wondered if that was determining 
non-significance of my overlap or a p-value too small to calculate?

overlap = 524
lista = 2784
totalpop = 54675
listb = 1296

phyper(overlap, lista, totalpop, listb,lower.tail = FALSE, log.p=F)
[1] 0

If I plug in some different values I get a p-value but since zero is actually 
lower is the overlap significant, or more likely have I made a mistake in using 
the function?
phyper(10, 100, 2, 100,lower.tail = FALSE, log.p=F)
[1] 2.582795e-12


Thanks

Elliott



This message has been scanned for malware by Websense. www.websense.com

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] phyper returning zero

2013-03-15 Thread R. Michael Weylandt
On Fri, Mar 15, 2013 at 8:52 AM, elliott harrison
e.harri...@epistem.co.uk wrote:
 Hi,
 I am attempting to use phyper to test the significance of two overlapping 
 lists. I keep getting a zero and wondered if that was determining 
 non-significance of my overlap or a p-value too small to calculate?

 overlap = 524
 lista = 2784
 totalpop = 54675
 listb = 1296

 phyper(overlap, lista, totalpop, listb,lower.tail = FALSE, log.p=F)
 [1] 0

If you set log.p = T, you see that the _log_ of the desired value is
-800, so it's likely simply too small to fit in a IEEE double.

In sort, for all and any practical purposes, your p-value is zero.

Cheers,
MW

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] phyper returning zero

2013-03-15 Thread elliott harrison
Thanks Michael I assumed as much but we know what that did.

Thanks again.

Elliott

-Original Message-
From: R. Michael Weylandt [mailto:michael.weyla...@gmail.com] 
Sent: 15 March 2013 09:29
To: elliott harrison
Cc: r-help@r-project.org
Subject: Re: [R] phyper returning zero

On Fri, Mar 15, 2013 at 8:52 AM, elliott harrison e.harri...@epistem.co.uk 
wrote:
 Hi,
 I am attempting to use phyper to test the significance of two overlapping 
 lists. I keep getting a zero and wondered if that was determining 
 non-significance of my overlap or a p-value too small to calculate?

 overlap = 524
 lista = 2784
 totalpop = 54675
 listb = 1296

 phyper(overlap, lista, totalpop, listb,lower.tail = FALSE, log.p=F) 
 [1] 0

If you set log.p = T, you see that the _log_ of the desired value is -800, so 
it's likely simply too small to fit in a IEEE double.

In sort, for all and any practical purposes, your p-value is zero.

Cheers,
MW


This message has been scanned for malware by Websense. www.websense.com

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] phyper returning zero

2013-03-15 Thread Martin Maechler
 eh == elliott harrison e.harri...@epistem.co.uk
 on Fri, 15 Mar 2013 08:52:36 + writes:

eh Hi,
eh I am attempting to use phyper to test the significance
eh of two overlapping lists. I keep getting a zero and
eh wondered if that was determining non-significance of my
eh overlap or a p-value too small to calculate?

well what do you guess?  (:-)

eh overlap = 524
eh lista = 2784
eh totalpop = 54675
eh listb = 1296

eh phyper(overlap, lista, totalpop, listb,lower.tail = FALSE, log.p=F)
eh [1] 0

Well, just *do* use  log.p=TRUE :

   phyper(overlap, lista, totalpop, listb,lower.tail = FALSE, log.p=TRUE)
  [1] -800.0408

so, indeed   P = exp(-800)  which is smaller than the smallest
positive number in double precision,
which by the way is available in R as

  .Machine$double.xmin
 [1] 2.225074e-308

I'm pretty sure that I cannot think of a situation where it is
important to know that the more exact probability is around  
10^(-347.45)

   phyper(overlap, lista, totalpop, listb,lower.tail = FALSE, 
   log.p=TRUE) / log(10)
 [1] -347.4533

rather than to know that it is very very very small.
Martin

 
eh If I plug in some different values I get a p-value but since zero is 
actually lower is the overlap significant, or more likely have I made a mistake 
in using the function?
eh phyper(10, 100, 2, 100,lower.tail = FALSE, log.p=F)
eh [1] 2.582795e-12


eh Thanks
eh Elliott

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.