title: R: is fisher's exact test with large numbers still accurate?
body: <p>I have a 2x2 table like this and i want to do Fisher's exact test on it to test if the overlap between two sets is significant. </p>
  
  <p>As you can see, I have a very large number at 2.2e9, which exceeds the limit of the largest number a 32 bit R can handle. </p>
  
  <pre><code>    yes no
  yes 127437282   364949163
  no  188213539   2200433302
  </code></pre>
  
  <p>I got around this with bit64 package and us as.integer64(). I then run a Fisher's exact test:</p>
  
  <pre><code>    fisher&lt;-function(n1,n2,n3,n4,fname){
      library(bit64)
      n1n&lt;-as.integer(n1)
      n2n&lt;-as.integer(n2)
      n3n&lt;-as.integer(n3)
      n4n&lt;-as.integer64(n4)
      testor=rbind(c(n1n,n2n),c(n3n,n4n))
      x&lt;-fisher.test(testor)
      print("sample name")
      print(fname)
      print("data is")
      print(testor)
      print("fisher's exact test result is")
      x
  }
  fisher(f1,f2,f3,f4,f5)
  </code></pre>
  
  <p>The result is this:</p>
  
  <pre><code>          [,1]          [,2]
  [1,] 127437282  3.649492e+08
  [2,] 188213539 1.086944e-314
  [1] "fisher's exact test result is"
  
          Fisher's Exact Test for Count Data
  
  data:  
  p-value &lt; 2.2e-16
  alternative hypothesis: true odds ratio is not equal to 1
  95 percent confidence interval:
   0.0000000000 0.0001190186
  sample estimates:
  odds ratio
           0
  </code></pre>
  
  <p>Somehow, the large number 2200433302 became 1.086944e-314. Why did this happen?</p>
  
  <p>Also, the calculation took more than 5 minutes to finish, which is way too slow. I'm not sure if it makes sense to do such a calculation with large numbers? Is there some way to transform the input data and still maintain its validity?</p>
  
  <p>Thanks!</p>