Generating Values From Normal Distribution
In computer simulations, especially in applications of the Monte-Carlo method, it is often desirable to generate values that are normally distributed. The algorithms listed below all generate the standard normal deviates, since a N(μ, σ2
) can be generated as X = μ + σZ, where Z is standard normal. All these algorithms rely on the availability of a random number generator U capable of producing uniform random variates.
- The most straightforward method is based on the probability integral transform property: if U is distributed uniformly on (0,1), then Φ−1(U) will have the standard normal distribution. The drawback of this method is that it relies on calculation of the probit function Φ−1, which cannot be done analytically. Some approximate methods are described in Hart (1968) and in the erf article. Wichura gives a fast algorithm for computing this function to 16 decimal places, which is used by R to compute random variates of the normal distribution.
- An easy to program approximate approach, that relies on the central limit theorem, is as follows: generate 12 uniform U(0,1) deviates, add them all up, and subtract 6 – the resulting random variable will have approximately standard normal distribution. In truth, the distribution will be Irwin–Hall, which is a 12-section eleventh-order polynomial approximation to the normal distribution. This random deviate will have a limited range of (−6, 6).
- The Box–Muller method uses two independent random numbers U and V distributed uniformly on (0,1). Then the two random variables X and Y
- Marsaglia polar method is a modification of the Box–Muller method algorithm, which does not require computation of functions sin and cos. In this method U and V are drawn from the uniform (−1,1) distribution, and then S = U2 + V2 is computed. If S is greater or equal to one then the method starts over, otherwise two quantities
- The Ratio method is a rejection method. The algorithm proceeds as follows:
- Generate two independent uniform deviates U and V;
- Compute X = √8/e (V − 0.5)/U;
- If X2 ≤ 5 − 4e1/4U then accept X and terminate algorithm;
- If X2 ≥ 4e−1.35/U + 1.4 then reject X and start over from step 1;
- If X2 ≤ −4 / lnU then accept X, otherwise start over the algorithm.
- The ziggurat algorithm Marsaglia & Tsang (2000) is faster than the Box–Muller transform and still exact. In about 97% of all cases it uses only two random numbers, one random integer and one random uniform, one multiplication and an if-test. Only in 3% of the cases where the combination of those two falls outside the "core of the ziggurat" a kind of rejection sampling using logarithms, exponentials and more uniform random numbers has to be employed.
- There is also some investigation into the connection between the fast Hadamard transform and the normal distribution, since the transform employs just addition and subtraction and by the central limit theorem random numbers from almost any distribution will be transformed into the normal distribution. In this regard a series of Hadamard transforms can be combined with random permutations to turn arbitrary data sets into a normally distributed data.
Read more about this topic: Normal Distribution
Famous quotes containing the words values, normal and/or distribution:
“With all of its bad influences, T.V. is not to be feared.... It can be a fairly safe laboratory for confronting, seeing through, and thus being immunized against unhealthy values so as to be in the world but not of it.”
—Polly Berrien Berends (20th century)
“A normal adolescent is so restless and twitchy and awkward that he can mange to injure his kneenot playing soccer, not playing footballbut by falling off his chair in the middle of French class.”
—Judith Viorst (20th century)
“There is the illusion of time, which is very deep; who has disposed of it? Mor come to the conviction that what seems the succession of thought is only the distribution of wholes into causal series.”
—Ralph Waldo Emerson (18031882)