|
NAG[g05pcc] NAG[nag_rngs_varma_time_series] - Generates a realisation of a multivariate time series from a VARMA model
|
|
Calling Sequence
g05pcc(mode, xmean, p, phi, q, theta, var, x, igen, iseed, r, 'k'=k, 'n'=n, 'fail'=fail)
nag_rngs_varma_time_series(. . .)
Parameters
|
mode - integer;
|
|
|
On entry: a code for selecting the operation to be performed by the function:
|
|
(start) Set up reference vector and compute a realisation of the recent history.
|
|
(continue) Generate terms in the time series using reference vector set up in a prior call to nag_rngs_varma_time_series (g05pcc).
|
|
(restart and generate) A new realisation of the recent history is computed using information stored in the reference vector, and the following sequence of time series values are generated.
|
|
Constraint: . .
|
|
|
xmean - Vector(1..k, datatype=float[8]);
|
|
|
On entry: , the vector of means of the multivariate time series.
|
|
|
p - integer;
|
|
|
On entry: , the number of autoregressive argument matrices.
|
|
Constraint: . .
|
|
|
phi - Vector(1..dim, datatype=float[8]);
|
|
|
Note: the dimension, dim, of the array phi must be at least .
|
|
Constraint: the first elements of phi must satisfy the stationarity condition. .
|
|
|
q - integer;
|
|
|
On entry: , the number of moving average argument matrices.
|
|
Constraint: . .
|
|
|
theta - Vector(1..dim, datatype=float[8]);
|
|
|
Note: the dimension, dim, of the array theta must be at least .
|
|
|
var - Matrix(1..dim1, 1..k, datatype=float[8], order=order);
|
|
|
Note: this array may be supplied in Fortran_order or C_order , as specified by order. All array parameters must use a consistent order.
|
|
Constraint: the elements of var must be such that is positive-definite. .
|
|
|
x - Matrix(1..dim1, 1..dim2, datatype=float[8], order=order);
|
|
|
Note: this array may be supplied in Fortran_order or C_order , as specified by order. All array parameters must use a consistent order.
|
|
|
iseed - Vector(1.. , datatype=integer[kernelopts('wordsize')/8]);
|
|
|
On entry: contains values which define the current state of the selected generator.
|
|
On exit: contains updated values defining the new state of the selected generator.
|
|
|
r - Vector(1.. , datatype=float[8]);
|
|
|
|
'k'=k - integer; (optional)
|
|
|
On entry: , the dimension of the multivariate time series.
|
|
Constraint: . .
|
|
|
'n'=n - integer; (optional)
|
|
|
Default value: the second dimension of the array x.
|
|
On entry: , the number of observations to be generated.
|
|
Constraint: . .
|
|
|
'fail'=fail - table; (optional)
|
|
|
The NAG error argument, see the documentation for NagError.
|
|
|
|
Description
|
|
|
Purpose
|
|
nag_rngs_varma_time_series (g05pcc) generates a realisation of a multivariate time series from a vector autoregressive moving average (VARMA) model. The realisation may be continued or a new realisation generated at subsequent calls to this function.
|
|
Description
|
|
Let the vector , denote a dimensional time series which is assumed to follow a vector autoregressive moving average (VARMA) model of the form:
(1)
where , is a vector of residual series assumed to be Normally distributed with zero mean and positive-definite covariance matrix . The components of are assumed to be uncorrelated at non-simultaneous lags. The 's and 's are by matrices of arguments. , for , are called the autoregressive (AR) argument matrices, and , for , the moving average (MA) argument matrices. The arguments in the model are thus the by -matrices, the by -matrices, the mean vector and the residual error covariance matrix . Let
where denotes the by 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 realisation of the state vector at time zero computed. For all other cases the function computes a realisation of the pre-observed vectors , , from equation (1), see Shea (1988). This realisation 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 realisation of the time series may be generated with less computation using only the information saved in a reference vector from a previous call to nag_rngs_varma_time_series (g05pcc). See the description of the argument mode in Section [Parameters] for details.
The function returns a realisation of . On a successful exit, the recent history is updated and saved in the array r so that nag_rngs_varma_time_series (g05pcc) may be called again to generate a realisation of etc. See the description of the argument mode in Section [Parameters] for details.
Further computational details are given in Shea (1988). Note however that this function 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 g05kbc (nag_rngs_init_repeatable) (for a repeatable sequence if computed sequentially) or g05kcc (nag_rngs_init_nonrepeatable) (for a non-repeatable sequence) must be called prior to the first call to nag_rngs_varma_time_series (g05pcc).
|
|
Error Indicators and Warnings
|
|
"NE_ALLOC_FAIL"
Dynamic memory allocation failed.
"NE_BAD_PARAM"
On entry, argument had an illegal value.
"NE_CLOSE_TO_STATIONARITY"
The reference vector cannot be computed because the AR arguments are too close to the boundary of the stationarity region.
"NE_INT"
On entry, . Constraint: .
On entry, . Constraint: .
On entry, . Constraint: .
On entry, . Constraint: .
On entry, . Constraint: .
"NE_INTERNAL_ERROR"
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please consult NAG for assistance.
"NE_INVERTIBILITY"
On entry, the MA argument matrices are outside the invertibility region.
"NE_OUTSIDE_STATIONARITY"
On entry, the AR argument matrices are outside the stationarity region.
"NE_POS_DEF"
On entry, the covariance matrix var is not positive-definite.
"NE_TOO_MANY_ITER"
An excessive number of iterations were required by the NAG function used to evaluate the eigenvalues of the covariance matrix.
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.
An excessive number of iterations were required by the NAG function used to evaluate the eigenvalues to be stored in the reference vector.
|
|
Accuracy
|
|
The accuracy is limited by the matrix computations performed, and this is dependent on the condition of the argument and covariance matrices.
|
|
Further Comments
|
|
Note that, in reference to the error "NE_INVERTIBILITY" is raised, nag_rngs_varma_time_series (g05pcc) will permit moving average arguments on the boundary of the invertibility region.
The elements of r contain amongst other information details of the spectral decompositions which are used to generate future multivariate Normals. Note that these eigenvectors may not be unique on different machines. For example the eigenvectors corresponding to multiple eigenvalues may be permuted. Although an effort is made to ensure that the eigenvectors have the same sign on all machines, differences in the signs may theoretically still occur.
The following table gives some examples of the required size of the array r, specified by the argument , for and for various values of and .
|
|
|
|
|
|
|
|
0
|
1
|
2
|
3
|
|
|
|
13
|
20
|
31
|
46
|
|
0
|
36
|
56
|
92
|
144
|
|
|
85
|
124
|
199
|
310
|
|
|
|
19
|
30
|
45
|
64
|
|
1
|
52
|
88
|
140
|
208
|
|
|
115
|
190
|
301
|
448
|
p
|
|
|
35
|
50
|
69
|
92
|
|
2
|
136
|
188
|
256
|
340
|
|
|
397
|
508
|
655
|
838
|
|
|
|
57
|
76
|
99
|
126
|
|
3
|
268
|
336
|
420
|
520
|
|
|
877
|
1024
|
1207
|
1426
|
|
|
Note that g13dxc (nag_tsa_arma_roots) may be used to check whether a VARMA model is stationary and invertible.
The time taken depends on the values of , and especially and .
|
|
|
Examples
|
|
>
|
mode := 2:
k := 2:
p := 1:
q := 0:
n := 48:
igen := 1:
xmean := Vector([5, 9], datatype=float[8]):
phi := Vector([0.8, 0, 0.07, 0.58], datatype=float[8]):
theta := Vector([0], datatype=float[8]):
var := Matrix([[2.97, 0], [0.64, 5.38]], datatype=float[8]):
x := Matrix(2, 48, datatype=float[8]):
iseed := Vector([1762543, 9324783, 4234401, 742355], datatype=integer[kernelopts('wordsize')/8]):
r := Vector(600, datatype=float[8]):
NAG:-g05kbc(igen,iseed):
NAG:-g05pcc(mode, xmean, p, phi, q, theta, var, x, igen, iseed, r, 'k' = k, 'n' = n):
|

|
|
See Also
|
|
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
g05 Chapter Introduction.
NAG Toolbox Overview.
NAG Web Site.
|
|