Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

Chapter Contents
Chapter Introduction
NAG Toolbox

# NAG Toolbox: nag_tsa_uni_arma_roots (g13dx)

## Purpose

nag_tsa_uni_arma_roots (g13dx) calculates the zeros of a vector autoregressive (or moving average) operator. This function is likely to be used in conjunction with nag_rand_times_mv_varma (g05pj), nag_tsa_uni_arima_resid (g13as), nag_tsa_multi_varma_estimate (g13dd) or nag_tsa_multi_varma_diag (g13ds).

## Syntax

[rr, ri, rmod, ifail] = g13dx(k, ip, par)
[rr, ri, rmod, ifail] = nag_tsa_uni_arma_roots(k, ip, par)

## Description

Consider the vector autoregressive moving average (VARMA) model
 $Wt-μ=ϕ1Wt-1-μ+ϕ2Wt-2-μ+⋯+ϕpWt-p-μ+εt-θ1εt-1-θ2εt-2-⋯-θqεt-q,$ (1)
where ${W}_{t}$ denotes a vector of $k$ time series and ${\epsilon }_{t}$ is a vector of $k$ residual series having zero mean and a constant variance-covariance matrix. The components of ${\epsilon }_{t}$ are also assumed to be uncorrelated at non-simultaneous lags. ${\varphi }_{1},{\varphi }_{2},\dots ,{\varphi }_{p}$ denotes a sequence of $k$ by $k$ matrices of autoregressive (AR) parameters and ${\theta }_{1},{\theta }_{2},\dots ,{\theta }_{q}$ denotes a sequence of $k$ by $k$ matrices of moving average (MA) parameters. $\mu$ is a vector of length $k$ containing the series means. Let
 $Aϕ= ϕ1 I 0 . . . 0 ϕ2 0 I 0 . . 0 . . . . . . ϕp-1 0 . . . 0 I ϕp 0 . . . 0 0 pk×pk$
where $I$ denotes the $k$ by $k$ identity matrix.
The model (1) is said to be stationary if the eigenvalues of $A\left(\varphi \right)$ lie inside the unit circle. Similarly let
 $Bθ= θ1 I 0 . . . 0 θ2 0 I 0 . . 0 . . . . . . θq-1 0 . . . 0 I θq 0 . . . 0 0 qk×qk .$
Then the model is said to be invertible if the eigenvalues of $B\left(\theta \right)$ lie inside the unit circle.
nag_tsa_uni_arma_roots (g13dx) returns the $pk$ eigenvalues of $A\left(\varphi \right)$ (or the $qk$ eigenvalues of $B\left(\theta \right)$) along with their moduli, in descending order of magnitude. Thus to check for stationarity or invertibility you should check whether the modulus of the largest eigenvalue is less than one.

## References

Wei W W S (1990) Time Series Analysis: Univariate and Multivariate Methods Addison–Wesley

## Parameters

### Compulsory Input Parameters

1:     $\mathrm{k}$int64int32nag_int scalar
$k$, the dimension of the multivariate time series.
Constraint: ${\mathbf{k}}\ge 1$.
2:     $\mathrm{ip}$int64int32nag_int scalar
The number of AR (or MA) parameter matrices, $p$ (or $q$).
Constraint: ${\mathbf{ip}}\ge 1$.
3:     $\mathrm{par}\left({\mathbf{ip}}×{\mathbf{k}}×{\mathbf{k}}\right)$ – double array
The AR (or MA) parameter matrices read in row by row in the order ${\varphi }_{1},{\varphi }_{2},\dots ,{\varphi }_{p}$ (or ${\theta }_{1},{\theta }_{2},\dots ,{\theta }_{q}$). That is, ${\mathbf{par}}\left(\left(\mathit{l}-1\right)×k×k+\left(i-1\right)×k+j\right)$ must be set equal to the $\left(i,j\right)$th element of ${\varphi }_{l}$, for $\mathit{l}=1,2,\dots ,p$ (or the $\left(i,j\right)$th element of ${\theta }_{\mathit{l}}$, for $\mathit{l}=1,2,\dots ,q$).

None.

### Output Parameters

1:     $\mathrm{rr}\left({\mathbf{k}}×{\mathbf{ip}}\right)$ – double array
The real parts of the eigenvalues.
2:     $\mathrm{ri}\left({\mathbf{k}}×{\mathbf{ip}}\right)$ – double array
The imaginary parts of the eigenvalues.
3:     $\mathrm{rmod}\left({\mathbf{k}}×{\mathbf{ip}}\right)$ – double array
The moduli of the eigenvalues.
4:     $\mathrm{ifail}$int64int32nag_int scalar
${\mathbf{ifail}}={\mathbf{0}}$ unless the function detects an error (see Error Indicators and Warnings).

## Error Indicators and Warnings

Errors or warnings detected by the function:
${\mathbf{ifail}}=1$
 On entry, ${\mathbf{k}}<1$, or ${\mathbf{ip}}<1$.
${\mathbf{ifail}}=2$
An excessive number of iterations are needed to evaluate the eigenvalues of $A\left(\varphi \right)$ (or $B\left(\theta \right)$). This is an unlikely exit. All output arguments are undefined.
${\mathbf{ifail}}=-99$
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.

## Accuracy

The accuracy of the results depends on the original matrix and the multiplicity of the roots.

The time taken is approximately proportional to $k{p}^{3}$ (or $k{q}^{3}$).

## Example

This example finds the eigenvalues of $A\left(\varphi \right)$ where $k=2$ and $p=1$ and ${\varphi }_{1}=\left[\begin{array}{rr}0.802& 0.065\\ 0.000& 0.575\end{array}\right]$.
```function g13dx_example

fprintf('g13dx example results\n\n');

k   = int64(2);
ip  = int64(1);
par = [0.802;     0.065;     0;     0.575];

% Calculate zeros
[rr, ri, rmod, ifail] = g13dx( ...
k, ip, par);

% Display results
fprintf('%20s%13s\n', 'Eigenvalues', 'Moduli');
fprintf('%20s%13s\n', '-----------', '------');
for i = 1:k*ip
if ri(i)>=0
fprintf(' %10.3f  + %6.3f i  %8.3f\n', rr(i), ri(i), rmod(i));
else
fprintf(' %10.3f  - %6.3f i  %8.3f\n', rr(i), -ri(i), rmod(i));
end
end

```
```g13dx example results

Eigenvalues       Moduli
-----------       ------
0.802  +  0.000 i     0.802
0.575  +  0.000 i     0.575
```