Re: [R] Fast version of Fisher's Exact Test

From: Steven McKinney <smckinney_at_bccrc.ca>
Date: Fri, 08 Apr 2011 15:44:53 -0700

Do you mean a test something such as this?

> fisher.test(matrix(c(502,498,490, 510), nrow = 2))

        Fisher's Exact Test for Count Data

data: matrix(c(502, 498, 490, 510), nrow = 2) p-value = 0.6228
alternative hypothesis: true odds ratio is not equal to 1 95 percent confidence interval:
 0.8770113 1.2550998
sample estimates:
odds ratio
  1.049119

This runs quickly on my machine.

> system.time(fisher.test(matrix(c(502,498,490, 510), nrow = 2)))

   user system elapsed
  0.008 0.001 0.010
> sessionInfo()

R version 2.12.2 (2011-02-25)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] en_CA.UTF-8/en_CA.UTF-8/C/C/en_CA.UTF-8/en_CA.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached): [1] tools_2.12.2
>

Can you provide an example that is running slowly for you?

Steven McKinney



From: r-help-bounces_at_r-project.org [r-help-bounces_at_r-project.org] On Behalf Of Jim Silverton [jim.silverton_at_gmail.com] Sent: April 8, 2011 9:43 AM
To: r-help_at_r-project.org
Subject: Re: [R] Fast version of Fisher's Exact Test

Is anyone aware of a fast way of doing fisher's exact test for a series of 2 x 2 tables in R? The fisher.test is really slow if n1=1000 and n2 = 1000.

--
Thanks,
Jim.

        [[alternative HTML version deleted]]

______________________________________________
R-help_at_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.

______________________________________________
R-help_at_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.
Received on Fri 08 Apr 2011 - 22:50:26 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 08 Apr 2011 - 23:50:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive