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:

    Writing ought either to be the manufacture of stories for which there is a market demand—a business as safe and commendable as making soap or breakfast foods—or it should be an art, which is always a search for something for which there is no market demand, something new and untried, where the values are intrinsic and have nothing to do with standardized values.
    Willa Cather (1876–1947)

    A normal adolescent is so restless and twitchy and awkward that he can mange to injure his knee—not playing soccer, not playing football—but by falling off his chair in the middle of French class.
    Judith Viorst (20th century)

    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)