Language Reference


VNORMAL Call

CALL VNORMAL (series, mu, sigma, n <, seed> );

The VNORMAL subroutine generates a multivariate normal random series.

This function is deprecated. Instead, you should use the RANDNORMAL function to generate random values. 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:

mu

specifies a $k \times 1$ (or $1 \times k$) mean vector, where $k\geq 2$ is the number of variables. You must specify either mu or sigma. If mu is not specified, a zero vector is used.

sigma

specifies a $k \times k$ symmetric positive-definite covariance matrix. By default, sigma is an identity matrix with dimension k. You must specify either mu or sigma. If sigma is not specified, an identity matrix is used.

n

specifies the length of the series. If n is not specified, $n=100$ is used.

seed

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 ($-1$)$\times $(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:

series

is an $n\times k$ matrix that contains the generated normal random series.

Consider a bivariate ($k=2$) normal random series with mean $\bm {\mu }$ and covariance matrix $\Sigma $, where

\[  \bm {\mu }=\left[\begin{matrix} 10   \cr 20   \cr \end{matrix}\right] ~ ~ \mr{and}~ ~  \Sigma =\left[\begin{matrix} 1.0   &  0.5   \cr 0.5   &  1.25   \cr \end{matrix}\right]  \]

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Ā 24.430. The first series oscillates about a mean value of 10; the second series oscillates about a mean value of 20.

Figure 24.430: Bivariate Normal Series

Bivariate Normal Series