-2

My table has 770,000 rows and what I did is:

mydata <- dbGetQuery(mydb, "select * from table")    
mydata$pvalue <- apply(as.matrix(mydata[, c(3,5,4,6)]), 1, function(x) fisher.test(matrix(x, nrow=2))$p.value)

to get pvalues.

But it takes so long. (It has been over 24hours and it is still running). Should I use other way to speed up Fisher exact in R?

RHA
  • 3,677
  • 4
  • 25
  • 48
dPdms
  • 173
  • 2
  • 14
  • This might be useful: http://stackoverflow.com/questions/28161801/using-data-table-to-run-100-000-fishers-exact-tests-is-slower-than-apply Furthermore, can you tell something about the maximum values in the matrix? – Heroka Mar 19 '16 at 10:52
  • 568,650,570 is the maximum value (column 6) – dPdms Mar 19 '16 at 13:13

1 Answers1

-1

The Fisher exact test is like chi-squared test.

From wikipedia:

With large samples, a chi-squared test can be used in this situation. However, the significance value it provides is only an approximation, because the sampling distribution of the test statistic that is calculated is only approximately equal to the theoretical chi-squared distribution.

user1436187
  • 3,252
  • 3
  • 26
  • 59
  • I know the fisher exact test is like chi-squared test. but I need to use Fisher exact test for my table. My question is: is there any other way (different code? or different software?) Thank you – dPdms Mar 19 '16 at 08:24