Language Reference

VARMASIM Call

CALL VARMASIM (series, phi, theta, mu, sigma, n <, p> <, q> <, initial> <, seed> ) ;

This subroutine is supported by the IML procedure and the iml action.

The VARMASIM subroutine generates a VARMA(p,q) time series.

The input arguments to the VARMASIM subroutine are as follows:

phi

specifies a k m Subscript p times k matrix that contains the autoregressive coefficient matrices, where m Subscript p is the number of the elements in the subset of the AR order and k greater-than-or-equal-to 2 is the number of variables. You must specify either phi or theta.

theta

specifies a k m Subscript q times k matrix that contains the moving average coefficient matrices, where m Subscript q is the number of the elements in the subset of the MA order. You must specify either phi or theta.

mu

specifies a k times 1 (or 1 times k) mean vector of the series. If mu is not specified, a zero vector is used.

sigma

specifies a k times k covariance matrix of the innovation series. If sigma is not specified, an identity matrix is used.

n

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

p

specifies the subset of the AR order. See the VARMACOV subroutine.

q

specifies the subset of the MA order. See the VARMACOV subroutine.

initial

specifies the initial values of random variables. You can specify this argument in two ways:

  • A scalar value, a 0, assigns bold y Subscript negative p plus 1 Baseline equals ellipsis equals bold y 0 equals a 0 and bold-italic epsilon Subscript negative q plus 1 Baseline equals ellipsis equals bold-italic epsilon 0 equals a 0.

  • A left-parenthesis p plus q right-parenthesis times k matrix value, bold upper M, assigns values as follows. The first p rows of bold upper M specify the values for bold y Subscript negative p plus 1 Baseline comma ellipsis comma bold y 0. The next q rows of bold upper M specify the values for bold-italic epsilon Subscript negative q plus 1 Baseline comma ellipsis comma bold-italic epsilon 0. That is, the first row of bold upper M sets the value for bold y Subscript negative p plus 1, the second row sets the value for bold y Subscript negative p plus 2, and so on. Similarly, the left-parenthesis p plus 1 right-parenthesisst row of bold upper M sets the value for bold-italic epsilon Subscript negative q plus 1, the left-parenthesis p plus 2 right-parenthesisnd row sets the value for bold-italic epsilon Subscript negative q plus 2, and so on.

By default, the initial values are estimated for the stationary vector time series and the initial values are assumed to be zero for the nonstationary vector time series.

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 (negative 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 to the subroutine, if seed > 0, the seed remains unchanged. Otherwise, the current seed is updated internally after each call.

The VARMASIM subroutine returns the following value:

series

is an n times k matrix that contains the generated VARMA(p comma q) time series. When either the initial option is specified or zero initial values are used, these initial values are not included in series.

Consider the following bivariate (k equals 2) stationary VARMA(1,1) time series:

bold y Subscript t Baseline minus bold-italic mu equals normal upper Phi left-parenthesis bold y Subscript t minus 1 Baseline minus bold-italic mu right-parenthesis plus bold-italic epsilon Subscript t Baseline minus normal upper Theta bold-italic epsilon Subscript t minus 1
normal upper Phi equals Start 2 By 2 Matrix 1st Row 1st Column 1.2 2nd Column negative 0.5 2nd Row 1st Column 0.6 2nd Column 0.3 EndMatrix normal upper Theta equals Start 2 By 2 Matrix 1st Row 1st Column negative 0.6 2nd Column 0.3 2nd Row 1st Column 0.3 2nd Column 0.6 EndMatrix bold-italic mu equals StartBinomialOrMatrix 10 Choose 20 EndBinomialOrMatrix normal upper Sigma equals Start 2 By 2 Matrix 1st Row 1st Column 1.0 2nd Column 0.5 2nd Row 1st Column 0.5 2nd Column 1.25 EndMatrix

To generate this series, you can use the following statements:

phi  = { 1.2 -0.5, 0.6 0.3 };
theta= {-0.6  0.3, 0.3 0.6 };
mu   = { 10, 20 };
sigma= { 1.0  0.5, 0.5 1.25};
call varmasim(yt, phi, theta, mu, sigma, 100) seed=123;

Each column of the matrix yt is plotted in Figure 491. The first series oscillates about a mean value of 10; the second series oscillates about a mean value of 20.

Figure 491: Time Series Components

Time Series Components


You can also simulate a nonstationary VARMA(1,1) time series with the same bold-italic mu, normal upper Sigma, and normal upper Theta as in the previous example and with the following AR coefficient:

normal upper Phi equals Start 2 By 2 Matrix 1st Row 1st Column 1.0 2nd Column 0 2nd Row 1st Column 0 2nd Column 0.3 EndMatrix

To generate this series, you can use the following statements:

phi  = { 1.0 0.0, 0.0 0.3 };
call varmasim(yt, phi, theta, mu, sigma, 100) initial=3 seed=123;
Last updated: July 20, 2026