[R] hypergeometric vs fisher.test

TGS cran.questions at gmail.com
Sat Aug 14 01:16:32 CEST 2010

"or an incompetent"

Such harsh words Peter. You're not making this a friendly environment for people to ask questions. Is there a less competent attribute mailing list so that some of us don't offend you with our questions?

On Aug 13, 2010, at 2:11 PM, Peter Dalgaard wrote:

Andrea Franceschini wrote:
> I ask the question also because I found this line in Wikipedia:
> "The test (see above) based on the hypergeometric distribution
> (hypergeometric test) is identical to the corresponding one-tailed
> version of Fisher's exact test".
> Is this wrong ?  May I kindly ask a friendly explanation for
> not-experts in statistics ?
> Thx a lot,

You never said you were a non-expert. A question like that might very
well have come from a student, or an incompetent claiming to have found
a bug in fisher.test...

The point was that Fisher's test takes the 2x2 table

a b
c d

and interprets the situation under the null hypothesis as taking a
sample of size a+c from an urn with a+b white balls and c+d black balls.

Once you read the docs for phyper properly (it _is_ tricky to get it
right), you arrive at

> phyper(16,17+181,449+19551,17+449, lower.tail=FALSE)
[1] 3.693347e-06

Peter Dalgaard
Center for Statistics, Copenhagen Business School
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com

R-help at r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list