Skip to content

How can I create all possible contigency tables if the total count and number of rows and columns are fixed?

1 message · RLearner

#
Dear all

It sounds an easy task, but I got stuck with creating all possible
contigency tables if the total count is fixed. For example, if the total
count is 2, and number of cells in the table is 4 (nrow=2,ncol=2), there
should be 10 possible tables:
0 0     0 0    0 0     0 1     0 1      0 2      1 0     1 0     1 1     2 0
0 2     1 1    2 0     0 1     1 0      0 0      0 1     1 0     0 0     0 0

And, are there any suggestions on creating hash and inverse hash function
such that whenever we know the index integer, we can find the corresponding
table?

Please let me know if you have any thoughts. Thanks a lot!