Skip to content
Prev 312581 / 398506 Next

Getting all possible contingency tables

I think R *can* do this (thanks to Robin Hankin):

  library(partitions)
  str(parts(36))
 'partition' int [1:36, 1:17977] 36 0 0 0 0 0 0 0 0 0 ...

I'm not quite clear on how you're going to take these results
and turn them into possible tables, but I guess you do ...
You might also be interested in the simulate.p.value option to
chisq.test and the randomizer (which preserves row and column
totals): from the code of chisq.test,

           tmp <- .Call(C_chisq_sim, sr, sc, B, E)