The VNORMAL subroutine generates a multivariate normal random series.
You can also generate multivariate random normal values by using the RANDNORMAL function. The RANDNORMAL function calls the RANDGEN subroutine, which has excellent statistical properties. Consequently, the RANDNORMAL function is preferred when you need to generate millions of random numbers.
The input arguments to the VNORMAL subroutine are as follows:
specifies a (or ) mean vector, where is the number of variables. You must specify either mu or sigma. If mu is not specified, a zero vector is used.
specifies a symmetric positive-definite covariance matrix. By default, sigma is an identity matrix with dimension . You must specify either mu or sigma. If sigma is not specified, an identity matrix is used.
specifies the length of the series. If n is not specified, is used.
is a scalar that contains the random number seed. At the first execution of the subroutine, the seed variable is used as follows:
If seed > 0, the input seed is used for generating the series.
If seed = 0, the system clock is used to generate the seed.
If seed < 0, the value ()(seed) is used for generating the series.
If the seed is not supplied, the system clock is used to generate the seed.
On subsequent calls of the subroutine in the DO loop like environment the seed variable is used as follows: If seed > 0, the seed remains unchanged. In other cases, after each execution of the subroutine, the current seed is updated internally.
The VNORMAL subroutine returns the following value:
is an matrix that contains the generated normal random series.
Consider a bivariate () normal random series with mean and covariance matrix , where
To generate this series, you can use the following statements:
mu = { 10, 20 }; sigma= { 1.0 0.5, 0.5 1.25}; call vnormal(et, mu, sigma, 100) seed=123;
Each column of the matrix et
is plotted in Figure 23.373. The first series oscillates about a mean value of 10; the second series oscillates about a mean value of 20.