# This code is stored in the file # randombin.R # R and Splus have a built in function # for the Fisher exact test. # Computations are based on a C version # of the FORTRAN subroutine FEXACT which # implements a procedure developed by # Mehta and Patel (1986) and improved # by Clarkson, Fan & Joe (1993). The # FORTRAN code can be obtained from # . # This fails when the counts are too # large or there are too many rows or # columns in the table. # The p-value is always for a two-sided # or multi-sided test. fisher.test(matrix(c(9,1,5,5),ncol=2,byrow=T)) fisher.test(matrix(c(3, 6, 11, 8, 4, 8, 10, 5, 5),ncol=3,byrow=T)) fisher.test(matrix(c(3,4,5,6,7,8,9,1,2,3,4, 5,11,12,13,14,15,16,17,1,2,3,4,5), ncol=12,byrow=T))