Ziggourat method
The method Ziggourat is an algorithm to generate random random numbers of law not uniforms. It is about a method of rejection and to be selected to simulate a Random variable having a strictly monotonous density. This method can also be applied to symmetrical laws unimodal such that the normal Law by choosing a point on one of the halves and by choosing the side by chance. This method was developed by George Marsaglia and Wai Wan Tang. Like the majority of the algorithms of this type, it in general supposes that one has a generator of random random numbers of uniform law, a pseudo-random generator. In the majority of the cases, like the normal Law or the exponential Law, the algoritme consists to generate a floating number, a random index of table, to make a research in a table, a multiplication and a comparison. This algorithm is considerably faster than the other methods to simulate variables random of normal law, as the Method of Boxes-Muller which require to calculate a square root or a logarithm. On another side, this method is more complex to implement and requires precalculated tables, so that it is to use best when one needs random random numbers in great quantity.
The name of this method comes owing to the fact that it covers the density of the law with rectangular segments piled up by order of size decreasing, what thus resembles a Ziggourat.
Theory
The Ziggourate method is a method of rejection. The position of a point is generated by chance inside a curve slightly more delimiting one surface slightly larger than that délimitéé by the density of the law considered. One tests then if this point is in this last surface. If it is the case, one turns over the X-coordinate of the point. If not, it is rejected this point and one draws new.
To build the surface which recovers the density, one chooses a surface made up of areas of equal sizes, of which is rectangles piled up with the top of a nonrectangular area which covers the tail of the density of the law.
If is the density of the law to be simulated, the base of the ziggourate is thus composed of an active rectangle whose left lower corner for coordonéées and the corner higher than for coordinates , and of the whole of the points located under the curve for . This layer delimits an area of surface . One places at the top a rectangular area of which the left lower corner is and the corner higher right , where is so that the surface of this rectangle is equal to . One builds in the same way a rectangle of coordinates defined by and of surface One thus builds a succession of points for a number of layers given in advance (typically, ). The coordinates of the points depend on .
By being unaware of for the moment the problem of the first layer which is not rectangular, the algorithm is the following:
-
One chooses way by chance a layer with a probability .
- If , one uses a specific algorithm then (see low)
- One gives itself a realization of a uniform random variable on
For a law of which the density is symmetrical, it is just enough to test if
Losrque density with a noncompact support (as it is the case for the normal Loi, the exponential law,…), it is then
necessary to use a specific algorithm when the first section is selected. This algorithm depends on
law.
The first layer can be divided into a rectangular central area, and an area with an infinite tail. One can use
the same algorithm by adding a fictitious point
Another possibility consists in calling the Ziggourate algorithm in a recursive way on the tail of the density.
For the normal law, G. Marsaglia proposes the following method:
As for a typical size of table,
The algorithm can turn in an effective way by using tables precalculated for the
It is possible to store in the algorithm the whole table of the points
Being given a number of level
by calculating the
Algorithms for the tail of the density
Optimizations
How to generate the tables?
How to find
See too
References
Random links: Duck mallard | Frederic Magné | The Community of communes of Thiérache of the Center | Oudewater | Jacques Népote | Aéroport_d'admission_de_Rankin