The Monte Carlo method, also known as the statistical simulation method, is widely used in physics, chemistry, Economics and information technology by Monte random sampling to simulate the probability and statistic of the object. Reject sampling (reject sampling) is a random sampling method for complex problems.
First, give a simple example to introduce the idea of Monte Carlo method. If you want to estimate the value of Pi Π\pi, select a square with a side length of 1 and make a incircle in the square, then we can calculate that the ratio of the area of the circle to the square area is Π/4 \pi/4. Now randomly generating a large number of points in a square, as shown in Figure 1, the dots falling in the circle area are marked red, and the points outside the circle are marked blue, so the number of points in the circular region is equal to the number of all the dots, which can be considered approximate equals Π/4 \pi/4. Therefore, the Monte Carlo method is based on random sampling to estimate probabilities in terms of frequency.
Fig. 1 Monte Carlo method to estimate the value of Π\PI
Samples of simple distributions, such as uniform distribution, Gaussian distribution, gamma distribution, etc., have been implemented in the computer, but for the sampling of complex problems, we need to take some strategies, rejecting sampling is a basic sampling strategy, the sampling process is as follows.
Given a probability distribution P (z) =1zpp̃ (z) p (z) =\frac{1}{z_p} \tilde{p} (z), where p̃ (z) \tilde{p} (z) is known, Zp z_p is a normalized constant, unknown. To reject a sample of this distribution, we first borrow a simple reference distribution (proposal distribution), which is called Q (x) q (x), which is easy to implement, such as uniform distribution, Gaussian distribution. And then introducing the constant k K, so that all Z Z, satisfies the KQ (z) ≥p̃ (z) KQ (z) \geq\tilde{p} (z), as shown in Figure 2, the red curve is p̃ (z) \tilde{p} (z), and the Blue curve is KQ (z) KQ (z). In each sample, a numerical z0 Z_0 is first sampled from Q (z) q (z), then uniformly sampled in the interval [0,KQ (z0)] [0,KQ (Z_0)] to obtain u0 u_0. If U0<p̃ (