﻿ g13dx Method
g13dx calculates the zeros of a vector autoregressive (or moving average) operator. This method is likely to be used in conjunction with g05pj g13as g13dd (G13DSF not in this release).

# Syntax

C#
```public static void g13dx(
int k,
int ip,
double[] par,
double[] rr,
double[] ri,
double[] rmod,
out int ifail
)```
Visual Basic
```Public Shared Sub g13dx ( _
k As Integer, _
ip As Integer, _
par As Double(), _
rr As Double(), _
ri As Double(), _
rmod As Double(), _
<OutAttribute> ByRef ifail As Integer _
)```
Visual C++
```public:
static void g13dx(
int k,
int ip,
array<double>^ par,
array<double>^ rr,
array<double>^ ri,
array<double>^ rmod,
[OutAttribute] int% ifail
)```
F#
```static member g13dx :
k : int *
ip : int *
par : float[] *
rr : float[] *
ri : float[] *
rmod : float[] *
ifail : int byref -> unit
```

#### Parameters

k
Type: System..::..Int32
On entry: $k$, the dimension of the multivariate time series.
Constraint: ${\mathbf{k}}\ge 1$.
ip
Type: System..::..Int32
On entry: the number of AR (or MA) parameter matrices, $p$ (or $q$).
Constraint: ${\mathbf{ip}}\ge 1$.
par
Type: array<System..::..Double>[]()[][]
An array of size [${\mathbf{ip}}×{\mathbf{k}}×{\mathbf{k}}$]
On entry: 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-1\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$).
rr
Type: array<System..::..Double>[]()[][]
An array of size [${\mathbf{k}}×{\mathbf{ip}}$]
On exit: the real parts of the eigenvalues.
ri
Type: array<System..::..Double>[]()[][]
An array of size [${\mathbf{k}}×{\mathbf{ip}}$]
On exit: the imaginary parts of the eigenvalues.
rmod
Type: array<System..::..Double>[]()[][]
An array of size [${\mathbf{k}}×{\mathbf{ip}}$]
On exit: the moduli of the eigenvalues.
ifail
Type: System..::..Int32%
On exit: ${\mathbf{ifail}}={0}$ unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

# 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ϕ=ϕ1I0...0ϕ20I0..0......ϕp-10...0Iϕp0...00pk×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θ=θ1I0...0θ20I0..0......θq-10...0Iθq0...00qk×qk.$
Then the model is said to be invertible if the eigenvalues of $B\left(\theta \right)$ lie inside the unit circle.
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

# Error Indicators and Warnings

Errors or warnings detected by the method:
${\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 parameters are undefined.
${\mathbf{ifail}}=-9000$
An error occured, see message report.
${\mathbf{ifail}}=-8000$
Negative dimension for array $〈\mathit{\text{value}}〉$
${\mathbf{ifail}}=-6000$
Invalid Parameters $〈\mathit{\text{value}}〉$

# Accuracy

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

# Parallelism and Performance

None.

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]$.

Example program (C#): g13dxe.cs

Example program data: g13dxe.d

Example program results: g13dxe.r