Abstract
In 1952, von Neumann introduced the rejection method for random variate generation. We revisit this algorithm when we have a source of perfect bits at our disposal. In this random bit model, there are universal lower bounds for generating a random variate with a given density to within an accuracy \(\epsilon \) derived by Knuth and Yao, and refined by the authors. In general, von Neumann’s method fails in this model. We propose a modification that insures proper behavior for all Riemann-integrable densities on compact sets, and show that the expected number of random bits needed behaves optimally with respect to universal lower bounds. In particular, we introduce the notion of an oracle that evaluates the supremum and infimum of a function on any rectangle of \({\mathbb {R}}^{d}\), and develop a quadtree-style extension of the classical rejection method.
Similar content being viewed by others
References
Brassard, G., Devroye, L., Gravel, C.: Exact classical simulation of the quantum-mechanical GHZ distribution. IEEE Trans. Info. Theory 62, 876–890 (2016)
Cover, T.M., Thomas, J.A.: Elements of Information Theory. Wiley, New-York (1991)
Csiszár, I.: Some remarks on the dimension and entropy of random variables. Acta Math. Acad. Sci. Hung. 12, 399–408 (1961)
Devroye, L., Gravel, C.: Sampling with arbitrary precision. http://arxiv.org/abs/1502.02539 (2015)
Devroye, L.: Non-Uniform Random Variate Generation. Springer, New York (1986)
Gravel, C.: Échantillonnage de distributions non uniformes en précision arbitraire et protocoles d’échantillonnage exact distribué des distributions discrètes quantiques, PhD thesis, Université de Montréal, https://papyrus.bib.umontreal.ca/xmlui/handle/1866/12337 (2015)
Han, T.S., Hoshi, M.: Interval algorithm for random number generation. IEEE Trans. Inf. Theory 43, 599–611 (1997)
Karney, C.F.F.: Sampling exactly from the normal distribution. ACM Trans. Math. Softw. 42, 1–14 (2016)
Knuth, D.E., Yao, A.C.-C.: The complexity of nonuniform random number generation. In: Algorithms and Complexity: New Directions and Recent Results., Traub, J.F. (ed.) New York, Carnegie-Mellon University, Computer Science Department, Academic Press, pp. 357–428. Reprinted in Knuth’s Selected Papers on Analysis of Algorithms (CSLI, 2000) (1976)
Rachev, S.T., Rüschendorf, L.: Mass transportation problems: Volume 1: Theory, Springer (Probability and Its Applications), (1998)
Rényi, A.: On the dimension and entropy of probability distributions. Acta Math Acad Sci Hung 10, 193–215 (1959)
Samet, H.: Foundations of Multidimensional and Metric Data Structures. Morgan Kaufmann, Elsevier/Morgan Kaufmann, San Mateo (2006)
von Neumann, J.: Various techniques used in connection with random digits. Monte Carlo Methods, National Bureau of Standards 12, 36–38 (1951)
Acknowledgments
The authors would like to thank all three referees for their feedback. They are invited to Luc’s house for drinks if they wish to come out of the closet. Luc Devroye’s research was supported by an NSERC Discovery Grant. Claude Gravel thanks Gilles Brassard.
Author information
Authors and Affiliations
Corresponding author
Electronic supplementary material
Below is the link to the electronic supplementary material.
Appendices
Appendix 1: Riemann integrability and the sup/inf oracle
In this section, we contruct a family of densities that are not Riemann-integrable for which the oracle is useless. Let \(\delta \in [0,1\slash 3)\) be a parameter, and let \(I_{\delta }\subseteq [0,1]\) be a Cantor-like set constructed below. Setting
where \(\lambda \) is the Lebesgue measure, we have (see below) \(\lambda (I_{\delta })=(1-3\delta )\slash (1-2\delta )\). The Lebesgue measure of the set of discontinuities is \(1-\lambda (I_{\delta })\) and is zero only if \(\delta =0\). The case of \(\delta =0\) corresponds to the usual uniform density on [0, 1] that is Riemann-integrable. All cases of \(\delta \in (0,1\slash 3)\) are Lebesgue integrable but not Riemann-integrable because the set of discontinuities is non-zero and yet possess a cumulative distribution function. For every \(\epsilon >0\) and every \(x\in I_{\delta }\) we have
Since these boundaries are invariant under changes of \(\epsilon \), Algorithm 4, when used for rejection, say, from a uniform density, has an infinite loop with positive probability. It is, therefore, essential that Riemann-integrable densities are considered as that the supremum and infimum returned by the oracle over given small intervals converge to each other as intervals shrink.
For the construction of \(I_{\delta }\), we recursively remove middle open subintervals of geometrically decreasing sizes. Let \(I_{j,k}\subset [0,1]\) for \(j\in {\mathbb {N}}\setminus \{0\}\) and \(k=0,\ldots {},2^{j}-1\) be the \(2^{j}\) closed subintervals that are left once the middle parts are removed from the previous subintervals \(I_{j-1,k}\) with \(k=0\) corresponding to the leftmost subinterval and so on. Initially, \(I_{0,0}=[0,1]\). For all \(j\in {\mathbb {N}}\setminus \{0\}\) and \(k\in \{0,\ldots {},2^{j}-1\}\), the length of a removed middle part is \(\delta ^{j}\). For all \(j\in {\mathbb {N}}\setminus \{0\}\), the total length not removed at the j-th step is \(2^{j}\lambda (I_{j,0})\) because the subintervals are of the same length. Let \(I_{\delta }\) be the limiting subset of [0, 1] that is left, i.e.,
We compute \(\lambda (I_{\delta })\) as follows:
and therefore
so that
Appendix 2: A naive modification to the general rejection method that is incorrect
A trivial, but incorrect, modification to Algorithm 3 would be:
This attempt leads to failure. Let A be the support of \(X_{\epsilon }\), which is necessarily contained in a fixed countable subset of \([0,1]^{d}\). Then given any Riemann-integrable density g, take a finite subset \(A^{\star }\) of A, and modify g on \(A^{\star }\) by setting
We have that f is still a Riemann-integrable density bounded by C (and its set of discontinuities is of measure 0 because \(A^{\star }\) is countable) but since \(f(X_{\epsilon })=C\) if \(X_{\epsilon }\in A^{\star }\), we accept all \(X_{\epsilon }\in A^{\star }\), regardless of the density g we started with. Since \({\mathbf {P}}\{X_{\epsilon }\in A^{\star }\}>0\), we make an error with positive probability.
If we set
then g is no longer Riemann-integrable, and in that case, \(f(X_{\epsilon })=0\) with probability one, and therefore, the algorithm loops forever, regardless of the choice of g.
This simple example shows the necessity of the oracle and of the condition of Riemann-integrability.
Rights and permissions
About this article
Cite this article
Devroye, L., Gravel, C. The expected bit complexity of the von Neumann rejection algorithm. Stat Comput 27, 699–710 (2017). https://doi.org/10.1007/s11222-016-9648-z
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s11222-016-9648-z
Keywords
- Random number generation
- Random bit model
- Von Neumann sampling algorithm
- Tree-based algorithms
- Random sampling
- Entropy