We present a computational approach for generating Markov bases for multi-way contingency tables whose cells counts might be constrained by fixed marginals and by lower and upper bounds. Our framework includes tables with structural zeros as a particular case. In- stead of computing the entire Markov basis in an initial step, our framework finds sets of local moves that connect each table in the reference set with a set of neighbor tables. We construct a Markov chain on the reference set of tables that requires only a set of local moves at each iteration. The union of these sets of local moves forms a dynamic Markov basis. We illustrate the practicality of our algorithms in the estimation of exact p-values for a three-way table with structural zeros and a sparse eight-way table. Computer code implementing the methods de- scribed in the article as well as the two datasets used in the numerical examples are available as supplemental material.
View on arXiv