Normal Distribution - Generating Values From Normal Distribution

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
    \begin{align} & X = \sqrt{- 2 \ln U} \, \cos(2 \pi V), \\ & Y = \sqrt{- 2 \ln U} \, \sin(2 \pi V) . \end{align}
    will both have the standard normal distribution, and will be independent. This formulation arises because for a bivariate normal random vector (X Y) the squared norm X2 + Y2 will have the chi-squared distribution with two degrees of freedom, which is an easily generated exponential random variable corresponding to the quantity −2ln(U) in these equations; and the angle is distributed uniformly around the circle, chosen by the random variable V.
  • 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
     X = U\sqrt{\frac{-2\ln S}{S}}, \qquad Y = V\sqrt{\frac{-2\ln S}{S}}
    are returned. Again, X and Y will be independent and standard normally distributed.
  • 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:

    Culture is the name for what people are interested in, their thoughts, their models, the books they read and the speeches they hear, their table-talk, gossip, controversies, historical sense and scientific training, the values they appreciate, the quality of life they admire. All communities have a culture. It is the climate of their civilization.
    Walter Lippmann (1889–1974)

    Dada doubts everything. Dada is an armadillo. Everything is Dada, too. Beware of Dada. Anti-dadaism is a disease: selfkleptomania, man’s normal condition, is Dada. But the real dadas are against Dada.
    Tristan Tzara (1896–1963)

    My topic for Army reunions ... this summer: How to prepare for war in time of peace. Not by fortifications, by navies, or by standing armies. But by policies which will add to the happiness and the comfort of all our people and which will tend to the distribution of intelligence [and] wealth equally among all. Our strength is a contented and intelligent community.
    Rutherford Birchard Hayes (1822–1893)