The uniform distribution on matrices with specified row and column sums is often a natural choice of null model when testing for structure in two-way tables (binary or nonnegative integer). Due to the difficulty of sampling from this distribution, many approximate methods have been developed. We will show that by exploiting certain symmetries, exact sampling and counting is in fact possible in many nontrivial real-world cases. We illustrate with real datasets including ecological co-occurrence matrices and contingency tables.
"Exact sampling and counting for fixed-margin matrices." Ann. Statist. 41 (3) 1569 - 1592, June 2013. https://doi.org/10.1214/13-AOS1131