# NAG FL Interfaceg13dxf (uni_​arma_​roots)

## ▸▿ Contents

Settings help

FL Name Style:

FL Specification Language:

## 1Purpose

g13dxf calculates the zeros of a vector autoregressive (or moving average) operator. This routine is likely to be used in conjunction with g05pjf, g13asf, g13ddf or g13dsf.

## 2Specification

Fortran Interface
 Subroutine g13dxf ( k, ip, par, rr, ri, rmod, work,
 Integer, Intent (In) :: k, ip Integer, Intent (Inout) :: ifail Integer, Intent (Out) :: iwork(k*ip) Real (Kind=nag_wp), Intent (In) :: par(ip*k*k) Real (Kind=nag_wp), Intent (Out) :: rr(k*ip), ri(k*ip), rmod(k*ip), work(k*k*ip*ip)
#include <nag.h>
 void g13dxf_ (const Integer *k, const Integer *ip, const double par[], double rr[], double ri[], double rmod[], double work[], Integer iwork[], Integer *ifail)
The routine may be called by the names g13dxf or nagf_tsa_uni_arma_roots.

## 3Description

Consider the vector autoregressive moving average (VARMA) model
 $Wt-μ=ϕ1(Wt-1-μ)+ϕ2(Wt-2-μ)+⋯+ϕp(Wt-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×k$ matrices of autoregressive (AR) parameters and ${\theta }_{1},{\theta }_{2},\dots ,{\theta }_{q}$ denotes a sequence of $k×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×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.
g13dxf 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 $1$.
Wei W W S (1990) Time Series Analysis: Univariate and Multivariate Methods Addison–Wesley

## 5Arguments

1: $\mathbf{k}$Integer Input
On entry: $k$, the dimension of the multivariate time series.
Constraint: ${\mathbf{k}}\ge 1$.
2: $\mathbf{ip}$Integer Input
On entry: the number of AR (or MA) parameter matrices, $p$ (or $q$).
Constraint: ${\mathbf{ip}}\ge 1$.
3: $\mathbf{par}\left({\mathbf{ip}}×{\mathbf{k}}×{\mathbf{k}}\right)$Real (Kind=nag_wp) array Input
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\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$).
4: $\mathbf{rr}\left({\mathbf{k}}×{\mathbf{ip}}\right)$Real (Kind=nag_wp) array Output
On exit: the real parts of the eigenvalues.
5: $\mathbf{ri}\left({\mathbf{k}}×{\mathbf{ip}}\right)$Real (Kind=nag_wp) array Output
On exit: the imaginary parts of the eigenvalues.
6: $\mathbf{rmod}\left({\mathbf{k}}×{\mathbf{ip}}\right)$Real (Kind=nag_wp) array Output
On exit: the moduli of the eigenvalues.
7: $\mathbf{work}\left({\mathbf{k}}×{\mathbf{k}}×{\mathbf{ip}}×{\mathbf{ip}}\right)$Real (Kind=nag_wp) array Workspace
8: $\mathbf{iwork}\left({\mathbf{k}}×{\mathbf{ip}}\right)$Integer array Workspace
9: $\mathbf{ifail}$Integer Input/Output
On entry: ifail must be set to $0$, $-1$ or $1$ to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of $0$ causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of $-1$ means that an error message is printed while a value of $1$ means that it is not.
If halting is not appropriate, the value $-1$ or $1$ is recommended. If message printing is undesirable, then the value $1$ is recommended. Otherwise, the value $0$ is recommended. When the value $-\mathbf{1}$ or $\mathbf{1}$ is used it is essential to test the value of ifail on exit.
On exit: ${\mathbf{ifail}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6Error Indicators and Warnings

If on entry ${\mathbf{ifail}}=0$ or $-1$, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
${\mathbf{ifail}}=1$
On entry, ${\mathbf{ip}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{ip}}\ge 1$.
On entry, ${\mathbf{k}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{k}}\ge 1$.
${\mathbf{ifail}}=2$
An excessive number of iterations have been required to calculate the eigenvalues.
${\mathbf{ifail}}=-99$
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

## 7Accuracy

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

## 8Parallelism and Performance

g13dxf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
g13dxf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

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

## 10Example

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

### 10.1Program Text

Program Text (g13dxfe.f90)

### 10.2Program Data

Program Data (g13dxfe.d)

### 10.3Program Results

Program Results (g13dxfe.r)