naginterfaces.library.rand.times_​mv_​varma

naginterfaces.library.rand.times_mv_varma(mode, n, xmean, ip, phi, iq, theta, var, comm, statecomm)[source]

times_mv_varma generates a realization of a multivariate time series from a vector autoregressive moving average (VARMA) model. The realization may be continued or a new realization generated at subsequent calls to times_mv_varma.

For full information please refer to the NAG Library document for g05pj

https://support.nag.com/numeric/nl/nagdoc_30/flhtml/g05/g05pjf.html

Parameters
modeint

A code for selecting the operation to be performed by the function.

Set up reference vector and compute a realization of the recent history.

Generate terms in the time series using reference vector set up in a prior call to times_mv_varma.

Combine the operations of or .

A new realization of the recent history is computed using information stored in the reference vector, and the following sequence of time series values are generated.

If or , you must ensure that the reference vector [‘r’] and the values of , , , , , , and have not been changed between calls to times_mv_varma.

nint

, the number of observations to be generated.

xmeanfloat, array-like, shape

, the vector of means of the multivariate time series.

ipint

, the number of autoregressive parameter matrices.

phifloat, array-like, shape

Must contain the elements of the autoregressive parameter matrices of the model, . If is considered as a three-dimensional array, dimensioned as , the th element of would be stored in ; that is, must be set equal to the th element of , for , and .

iqint

, the number of moving average parameter matrices.

thetafloat, array-like, shape

Must contain the elements of the moving average parameter matrices of the model, . If is considered as a three-dimensional array, dimensioned as (,,), the th element of would be stored in ; that is, must be set equal to the th element of , for , for , for .

varfloat, array-like, shape

must contain the ()th element of , for , for . Only the lower triangle is required.

commdict, communication object, modified in place

Communication structure for the reference vector.

If or , this argument must have been initialized by a prior call to times_mv_varma.

statecommdict, RNG communication object, modified in place

RNG communication structure.

This argument must have been initialized by a prior call to init_repeat() or init_nonrepeat().

Returns
xfloat, ndarray, shape

will contain a realization of the th component of , for , for .

Raises
NagValueError
(errno )

On entry, .

Constraint: , , or .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, the AR parameters are outside the stationarity region.

(errno )

On entry, .

Constraint: .

(errno )

On entry, the moving average parameter matrices are such that the model is non-invertible.

(errno )

On entry, the covariance matrix is not positive semidefinite to machine precision.

(errno )

is not the same as when [‘r’] was set up in a previous call.

Previous value of and .

(errno )

On entry, [‘state’] vector has been corrupted or not initialized.

(errno )

An excessive number of iterations were required by the NAG function used to evaluate the eigenvalues of the matrices used to test for stationarity or invertibility.

(errno )

The reference vector cannot be computed because the AR parameters are too close to the boundary of the stationarity region.

(errno )

An excessive number of iterations were required by the NAG function used to evaluate the eigenvalues of the covariance matrix.

Warns
NagAlgorithmicWarning
(errno )

An excessive number of iterations were required by the NAG function used to evaluate the eigenvalues stored in the reference vector.

Notes

Let the vector , denote a -dimensional time series which is assumed to follow a vector autoregressive moving average (VARMA) model of the form:

where , is a vector of residual series assumed to be Normally distributed with zero mean and covariance matrix . The components of are assumed to be uncorrelated at non-simultaneous lags. The ’s and ’s are matrices of parameters. , for , are called the autoregressive (AR) parameter matrices, and , for , the moving average (MA) parameter matrices. The parameters in the model are thus the -matrices, the -matrices, the mean vector and the residual error covariance matrix . Let

where denotes the identity matrix.

The model (1) must be both stationary and invertible. The model is said to be stationary if the eigenvalues of lie inside the unit circle and invertible if the eigenvalues of lie inside the unit circle.

For the VARMA model (1) is recast into state space form and a realization of the state vector at time zero computed. For all other cases the function computes a realization of the pre-observed vectors , , from (1), see Shea (1988). This realization is then used to generate a sequence of successive time series observations. Note that special action is taken for pure MA models, that is for .

At your request a new realization of the time series may be generated more efficiently using the information in a reference vector created during a previous call to times_mv_varma. See the description of the argument in Parameters for details.

The function returns a realization of . On a successful exit, the recent history is updated and saved in the array [‘r’] so that times_mv_varma may be called again to generate a realization of , etc. See the description of the argument in Parameters for details.

Further computational details are given in Shea (1988). Note, however, that times_mv_varma uses a spectral decomposition rather than a Cholesky factorization to generate the multivariate Normals. Although this method involves more multiplications than the Cholesky factorization method and is thus slightly slower it is more stable when faced with ill-conditioned covariance matrices. A method of assigning the AR and MA coefficient matrices so that the stationarity and invertibility conditions are satisfied is described in Barone (1987).

One of the initialization functions init_repeat() (for a repeatable sequence if computed sequentially) or init_nonrepeat() (for a non-repeatable sequence) must be called prior to the first call to times_mv_varma.

References

Barone, P, 1987, A method for generating independent realisations of a multivariate normal stationary and invertible ARMA process, J. Time Ser. Anal. (8), 125–130

Shea, B L, 1988, A note on the generation of independent realisations of a vector autoregressive moving average process, J. Time Ser. Anal. (9), 403–410