Professional Documents
Culture Documents
Generation of Standard Normal Random Numbers: January 2012
Generation of Standard Normal Random Numbers: January 2012
net/publication/260433985
CITATION READS
1 1,410
1 author:
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Naveen Kumar Boiroju on 14 January 2015.
Abstract: In this paper, we propose an easy method to generate standard normal random
variables and this method is compared with the other existing methods. It is observed that the
proposed method is quite competitive with most of the existing methods. Randomness of the
generated sample is tested using the autocorrelation function and Ljung-Box test. Normality
of the samples is checked with the help of relation between testing of hypothesis and
confidence intervals.
1. Introduction
The normal distribution is also called as the Gaussian distribution and it is the most
1 − ( x − µ )2
f (x ) = exp 2 ; − ∞ < x, µ < ∞ and σ > 0
σ 2π 2σ
1
where µ is a location parameter, equal to the mean, and σ the standard deviation. For
2. Mean=0, Standard deviation =1, Skewness=0 and Kurtosis relative to normal (β 2 − 3) =0.
4. Normal random variables X ’s with mean µ and variance σ 2 are generated by the
widely used by statisticians for several purposes. These include evaluating performance of
estimation and test procedures, and also use of simulation as a part of statistical inference.
Generating normal random numbers is an old and very important problem in the statistical
method. Several algorithms are available in the literature to generate normal random numbers
method, inversion method, etc. Howell and Rheinfurth (1982), Devroye (1986), Johnson et.al.
(1995), Thomas et.al. (2007) and Rao et.al. (2011) provides an extensive list of different
algorithms for the generation of standard normal random numbers. In view of the enormous
recent development in statistics that relies on the use of simulation, it is essential for every
statistician to have some knowledge of the corresponding techniques. It is also useful to note
that because of its extensive use, search for an appropriate simulation technique is itself an
area of research. In Section 2, some of the existing methods to generate standard normal
2
random numbers discussed and a very simple and convenient method is proposed. Testing of
Some existing methods for generating standard normal random numbers discussed in
this section. A new algorithm to generate standard normal random numbers is also proposed
The simplest way of generating normal variables is an application of the central limit
theorem. The central limit theorem is a weak convergence result that expresses the fact that
any sum of many small independent random variables is approximately normally distributed.
Use of the central limit theorem on U(0,1) random variables provide a simple method for
closely approximating normal random variates. The following algorithm is used to generate
3
Method-2: Box-Muller Method
This method is due to Box and Muller (1958) and generates a pair of independent
standard normal random variables using a pair of uniform random numbers as follows:
Another form of the Box-Muller method is called the polar technique. This improves
over the previous technique in being quicker as well as numerically more robust. The
− 2 ln S − 2 ln S
Z1 = V1 and Z 2 = V2 .
S S
This algorithm also requires two uniform variables to generate a single standard normal
random number.
This method is due to Hastings (1955) and the algorithm can be summarized as
follows:
4
1. Generate U ~ U(0,1).
2
∑a w i
i
2. Return Z = Φ −1 (U ) = -w + i =0
3
; U ≤ 0.5.
∑b w
j =0
j
i
3. if U ≥ 0.5, use Z = -Φ −1 (1 − U ).
where
w = − 2 ln (U ); b0 = 1;
a 0 = 2.515517; b1 = 1.432788;
a1 = 0.802853; b2 = 0.189269;
a 2 = 0.010328; b3 = 0.001308.
This method requires single uniform random number but involves seven constants.
This algorithm is an iterative algorithm and requires at least three uniform random
5
This algorithm requires only one uniform random number for the generation of single
∑ [ 3 (2U ]
1
2. Compute X = j − 1) .
5 j =1
(
3. Z = X − 0.01 3 X − X 3 )
This formula requires atleast five uniform random numbers to generate a single
The following algorithm proposed by Rao et.al. (2011) and it is explained in the
following steps.
1
− ln − 1
2. Return Z = U .
1.702
This algorithm requires only a single uniform random variable to generate the
standard normal variables and it is very much easier to apply and compute.
6
Method-9: Proposed Method
summarized as follows:
X2=Tanh(-2.57136-31.16364U),
X3=Tanh(3.94963-1.66888U) and
X4=Tanh(2.31229+1.84289U) .
3. Return Z=0.46615+90.72192X1-89.36967X2-96.55499X3+97.36346X4.
This method requires only one uniform random number to generate the standard
A comparative study of the above methods discussed in this section. 1000 random
numbers generated using each of the methods discussed in section 2 and tested for the
randomness and normality of the random numbers generated using the proposed method.
Testing Randomness:
For a random series, we expect to find that autocorrelation function (ACF) is zero for
all non-zero values of lag k and none of the autocorrelations is significantly different from
zero at the level 0.05. Hence, the ACF is used as a graphical test procedure to test the
7
randomness of the generated data (Chatfield, 1991). The sample ACF of the standard normal
random numbers generated from the proposed method (Method-9) is presented in the
following figure.
Figure 1: Autocorrelation function of the sample generated from the proposed method
As the results indicate, none of these autocorrelations of the standard normal random
numbers generated from the proposed method is significantly different from zero at the level
Randomness of the sample generated from the proposed method is tested using Ljung-
Box test (Chatfield, 1991; Ljung and Box, 1978). The following table presents the values of
Ljung-Box statistic and its significant probability values for different lags of the
autocorrelations.
8
Table 1: Ljung-Box test
Ljung-Box Statistic
Lag Value df P-value
10 6.962 10 0.729
20 15.838 20 0.727
30 26.017 30 0.674
40 43.304 40 0.332
50 55.901 50 0.263
60 70.495 60 0.167
70 84.422 70 0.115
80 95.620 80 0.112
90 102.298 90 0.177
100 108.618 100 0.261
From the above table, it is observed that the P-values of the Ljung-Box statistic at different
lags is greater than the level 0.05, therefore we accept the null hypothesis of randomness of
the sample and we may conclude that the sample generated using the proposed method is a
random sample.
Testing of Normality:
The histogram of the sample generated using the proposed method (Method-9) is
9
Figure 2: Histogram of the sample generated using the proposed method
From the above histogram, it is observed that the sample generated using the proposed
method is symmetric and normal. The following table presents the descriptive statistics of the
Descriptive Method
Statistics
M1 M2 M3 M4 M5 M6 M7 M8 M9
N Valid 1000 1000 1000 1000 1000 1000 1000 1000 1000
Mean -0.002 -0.032 -0.023 0.060 0.048 0.015 0.039 -0.014 0.042
Median -0.007 -0.001 -0.054 0.029 0.049 0.011 0.013 -0.012 0.059
Mode -0.016 0.059 -0.118 -0.033 0.049 0.001 -0.041 -0.006 0.094
Std. Deviation 0.983 1.024 1.005 0.984 1.002 1.025 0.960 0.989 0.998
Skewness 0.000 -0.003 0.093 0.091 -0.139 0.029 0.056 0.006 -0.054
Kurtosis -0.178 0.030 -0.194 0.147 -0.019 -0.162 -0.163 -0.039 -0.055
Range 5.930 6.074 6.111 6.634 6.530 6.503 5.615 5.218 5.745
Minimum -3.180 -2.963 -2.909 -3.023 -3.337 -3.176 -2.813 -2.590 -2.895
Maximum 2.750 3.111 3.202 3.611 3.194 3.326 2.802 2.628 2.851
Quartiles Q1 -0.670 -0.714 -0.705 -0.597 -0.636 -0.703 -0.663 -0.650 -0.633
Q2 -0.007 -0.001 -0.054 0.029 0.049 0.011 0.013 -0.012 0.059
Q3 0.673 0.653 0.643 0.727 0.751 0.753 0.694 0.603 0.705
10
From the above table, it is clear that the mean, median and mode are almost equal to zero and
same for the samples generated from the each method. Standard deviation, skewness and
kurtosis of the random numbers generated using each of the methods is near to one, zero and
zero respectively. This indicates that the methods producing standard normal random
numbers. The sample quartiles are also agreeing with that of the standard normal distribution.
Method-4 generates a wide range of the standard random numbers whereas method-8
The relation between testing of hypothesis and confidence intervals is used to test the
normality of the samples. The characteristics of the standard normal distribution is checked
and tested with the help of bootstrap confidence intervals (Becher et.al.; 1993 and Efron and
Tibishirani; 1993). If all the parameters (mean=0, standard deviation=1, skewness=0 and
kurtosis=0 ) of the standard normal distribution lies in between the lower and upper bounds
of bootstrap confidence interval, then the normality of the sample is satisfied. Bootstrap
confidence intervals for the mean, standard deviation, skewness and kurtosis of the samples
11
Table 3: Bootstrap confidence intervals
12
From the above table, it is observed that the parameters of the standard normal distribution
belong to the respective bootstrap confidence intervals for all the methods. This implies that
all the methods considered in this article can be used to generate the standard normal random
numbers.
4. Conclusion
From the above study, it is observed that the proposed method possesses the
randomness as well as the normality. The proposed method is an easy and convenient method
to generate the standard normal random numbers. Hence, the proposed method can be viewed
References:
[1] Becher H., Hall P., Wilson S.R. (1993), Bootstrap hypothesis testing procedures,
[3] Box, G. E. P. and Muller, M. E. (1958), A note on the generation of random normal
[4] Chatfield, C. (1991), The Analysis of Time Series: An Introduction, 5th ed., Chapman
York.
[6] Efron B., Tibshirani R.J. (1993), An introduction to the Bootstrap, Chapman & Hall,
New York.
13
[7] Hastings, C.(1955), Approximations for Digital Computers. Princeton University
[8] Howell, L.W. and Rheinfurth, M.H. (1982), Generation of Pseudo-Random Numbers,
[10] Kundu, D., Gupta, R.D. and Manglick, A. (2006), A convenient way of generating
[11] Ljung, G. M. and Box, G. E. P. (1978), “On a measure of lack of fit in time series
[12] Rao, K.R., Boiroju, N.K. and Reddy, M.K. (2011), Generation of standard normal
[13] Sigman, K. (2007), Simulating normal (Gaussian) rvs with applications to simulating
Brownian motion and geometric Brownian motion in one and two dimensions,
www.columbia.edu/~ks20/...Sigman/4703-07-Notes-BM-GBM-I.pdf.
[14] Thomas, D.B., Luk, W., Leong, P.H.W., Villasenor, J.D. (2007), Gaussian Random
Number Generators, ACM Computing Surveys, Vol. 39, No. 4, Article 11.
14