My final exam for the Monte Carlo course I taught last semester proved too much of a challenge for my fourth year students, despite being rather elementary and centred on accept-reject algorithms and importance/bridge sampling. One of the problems was a decomposition of the truncated Normal simulation method proposed by Marsaglia in 1963, found on X Validated!, which I had posted on the course Teams forum (and discussed on the ‘Og!). Obviously overlooked by the students as hardly anyone solved the central question… Quite a disappointment (and more exams to grade for the resit exam in June!)
Archive for fundamental lemma of simulation
Monte Carlo [exam]
Posted in Kids, pictures, R, Statistics, University life with tags accept-reject algorithm, cross validated, exam, France, fundamental lemma of simulation, George Marsaglia, Introduction to Monte Carlo Methods with R, MIDO, Monte Carlo algorithm, Monte Carlo methods, Monte Carlo Statistical Methods, Paris, PSL, R, ratio of uniform algorithm, Teams, truncated normal, Université Paris Dauphine on January 22, 2025 by xi'ansimulating signed mixtures
Posted in Books, pictures, R, Statistics, University life with tags accept-reject algorithm, arXiv, fundamental lemma of simulation, HAL, inverse cdf, mixtures of distributions, Monte Carlo Statistical Methods, pseudo-random generator, simulation on February 2, 2024 by xi'anWhile simulating from a mixture of standard densities is relatively straightforward, when the component densities are easily simulated, to the point that many simulation methods exploit an intermediary mixture construction to speed up the production of pseudo-random samples from more challenging distributions (see Devroye, 1986), things get surprisingly more complicated when the mixture weights can take negative values. For instance, the naïve solution consisting in first simulating from the associated mixture of positive weight components and then using an accept-reject step may prove highly inefficient since the overall probability of acceptance
is the inverse of the sum of the positive weights and hence can be arbitrarily close to zero. The intuition for such inefficiency is that simulating from the positive weight components need not produce values within regions of high probability for the actual distribution
since its negative weight components may remove most of the mass under the positive weight components. In other words, the negative weight components do not have a natural latent variable interpretation and the resulting mixture can be anything, as the above graph testifies.
Julien Stoehr (Paris Dauphine) and I started investigating this interesting challenge when the Master students who had been exposed to said challenge could not dent it in any meaningful way. We have now arXived a specific algorithm that proves superior to the naïve accept-reject algorithm, but also to the numerical cdf inversion (which happens to be available in this setting). Compared with the naïve version, we construct an alternative accept-reject scheme based on pairing positive and negative components as well as possible, partitioning the real line, and finding tighter upper and lower bounds on positive and negative components, respectively, towards yielding a higher acceptance rate on average. Designing a random generator of signed mixtures with enough variability and representativity proved a challenge in itself!
composition versus inversion
Posted in Books, Kids, R, Statistics with tags composition, cross validated, fundamental lemma of simulation, inversion, mixture of distributions, pseudo-random generators, R, uniroot() on March 31, 2021 by xi'an
While trying to convey to an OP on X validated why the inversion method was not always the panacea in pseudo-random generation, I took the example of a mixture of K exponential distributions when K is very large, in order to impress (?) upon said OP that solving F(x)=u for such a closed-form cdf F was very costly even when using a state-of-the-art (?) inversion algorithm, like uniroot, since each step involves adding the K terms in the cdf. Selecting the component from the cumulative distribution function on the component proves to be quite fast since using the rather crude
x=rexp(1,lambda[1+sum(runif(1)>wes)])
brings a 100-fold improvement over
Q = function(u) uniroot((function(x) F(x) - u), lower = 0,
upper = qexp(.999,rate=min(la)))[1] #numerical tail quantile
x=Q(runif(1))
when K=10⁵, as shown by a benchmark call
test elapsed 1 compo 0.057 2 Newton 45.736 3 uniroot 5.814
where Newton denotes a simple-minded Newton inversion. I wonder if there is a faster way to select the component in the mixture. Using a while loop starting from the most likely components proves to be much slower. And accept-reject solutions are invariably slow or fail to work with such a large number of components. Devroye’s Bible has a section (XIV.7.5) on simulating sums of variates from an infinite mixture distribution, but, for once, nothing really helpful. And another section (IV.5) on series methods, where again I could not find a direct connection.
