EXACT is a software package for exact counting and exact sampling of binary or non-negative integer matrices with specified row and column sums. (Download version 0.3 here.) Note: This program is only applicable for matrices of moderate size — smaller than 40x40 or so — or very sparse larger matrices. The program can be very memory intensive, so if you give it a problem that is too difficult, it will probably allocate all of your available RAM and then get bogged down (so you might want to keep an eye on how much RAM it's using).
For larger matrices, we provide a sequential importance sampling algorithm that is very efficient and often is very close to exact. A Matlab implementation of this is available in the folder \examples\total variation distance of the EXACT package.
Features- A fast C implementation
- Wrappers for Matlab, Python, and R
- Python implementation (binary matrices only)
- Example code and demonstrations for several applications
- Null model analysis of ecological matrices
- Conditional volume test for contingency tables with small margins
- Social network analysis (for small networks)
- Computing the Ehrhart polynomials
- Assessing the accuracy of approximate sampling methods for such matrices
Exact sampling and counting for fixed-margin matrices, J. W. Miller and M. T. Harrison, The Annals of Statistics, Vol. 41, No. 3, 2013, pp. 1569-1592. (pub) (pdf) (arXiv)
Importance sampling for weighted binary random matrices with specified margins, M. T. Harrison and J. W. Miller, (In preparation). (pdf) (arXiv)