Exact sampling and counting for fixed-margin matrices

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, social networks, and contingency tables, and we apply our method to finding the Ehrhart polynomials of the Birkhoff polytope. Further, we demonstrate how the method can be used to assess the accuracy of certain approximate samplers, by finding the total variation distance to the uniform distribution.
View on arXiv