# NAG Library Routine Document

## 1Purpose

g13dsf is a diagnostic checking routine suitable for use after fitting a vector ARMA model to a multivariate time series using g13ddf. The residual cross-correlation matrices are returned along with an estimate of their asymptotic standard errors and correlations. Also, g13dsf calculates the modified Li–McLeod portmanteau statistic and its significance level for testing model adequacy.

## 2Specification

Fortran Interface
 Subroutine g13dsf ( k, n, v, kmax, ip, iq, m, par, qq, r0, r, rcm, chi, idf, iw, liw, work,
 Integer, Intent (In) :: k, n, kmax, ip, iq, m, ishow, ldrcm, liw, lwork Integer, Intent (Inout) :: ifail Integer, Intent (Out) :: idf, iw(liw) Real (Kind=nag_wp), Intent (In) :: v(kmax,n), par((ip+iq)*k*k) Real (Kind=nag_wp), Intent (Inout) :: qq(kmax,k), r0(kmax,k), r(kmax,kmax,m), rcm(ldrcm,m*k*k) Real (Kind=nag_wp), Intent (Out) :: chi, siglev, work(lwork) Logical, Intent (In) :: parhld((ip+iq)*k*k)
#include <nagmk26.h>
 void g13dsf_ (const Integer *k, const Integer *n, const double v[], const Integer *kmax, const Integer *ip, const Integer *iq, const Integer *m, const double par[], const logical parhld[], double qq[], const Integer *ishow, double r0[], double r[], double rcm[], const Integer *ldrcm, double *chi, Integer *idf, double *siglev, Integer iw[], const Integer *liw, double work[], const Integer *lwork, Integer *ifail)

## 3Description

Let ${W}_{\mathit{t}}={\left({w}_{1\mathit{t}},{w}_{2\mathit{t}},\dots ,{w}_{\mathit{k}\mathit{t}}\right)}^{\mathrm{T}}$, for $\mathit{t}=1,2,\dots ,n$, denote a vector of $k$ time series which is assumed to follow a multivariate ARMA model of the form
 $Wt-μ= ϕ1Wt-1-μ+ϕ2Wt-2-μ+⋯+ϕpWt-p-μ +εt-θ1εt-1-θ2εt-2-⋯-θqεt-q,$ (1)
where ${\epsilon }_{\mathit{t}}={\left({\epsilon }_{1\mathit{t}},{\epsilon }_{2\mathit{t}},\dots ,{\epsilon }_{k\mathit{t}}\right)}^{\mathrm{T}}$, for $\mathit{t}=1,2,\dots ,n$, is a vector of $k$ residual series assumed to be Normally distributed with zero mean and positive definite covariance matrix $\Sigma$. The components of ${\epsilon }_{t}$ are assumed to be uncorrelated at non-simultaneous lags. The ${\varphi }_{i}$ and ${\theta }_{j}$ are $k$ by $k$ matrices of parameters. $\left\{{\varphi }_{\mathit{i}}\right\}$, for $\mathit{i}=1,2,\dots ,p$, are called the autoregressive (AR) parameter matrices, and $\left\{{\theta }_{\mathit{i}}\right\}$, for $\mathit{i}=1,2,\dots ,q$, the moving average (MA) parameter matrices. The parameters in the model are thus the $p$ ($k$ by $k$) $\varphi$-matrices, the $q$ ($k$ by $k$) $\theta$-matrices, the mean vector $\mu$ and the residual error covariance matrix $\Sigma$. Let
 $Aϕ= ϕ1 I 0 . . . 0 ϕ2 0 I 0 . . 0 . . . . . . ϕp-1 0 . . . 0 I ϕp 0 . . . 0 0 pk×pk and Bθ= θ1 I 0 . . . 0 θ2 0 I 0 . . 0 . . . . . . θq-1 0 . . . I θq 0 . . . . 0 qk×qk$
where $I$ denotes the $k$ by $k$ identity matrix.
The ARMA model (1) is said to be stationary if the eigenvalues of $A\left(\varphi \right)$ lie inside the unit circle, and invertible if the eigenvalues of $B\left(\theta \right)$ lie inside the unit circle. The ARMA model is assumed to be both stationary and invertible. Note that some of the elements of the $\varphi$- and/or $\theta$-matrices may have been fixed at pre-specified values (for example by calling g13ddf).
The estimated residual cross-correlation matrix at lag $l$ is defined to the $k$ by $k$ matrix ${\stackrel{^}{R}}_{l}$ whose $\left(i,j\right)$th element is computed as
 $r ^ i j l = ∑ t = l + 1 n ε ^ i t - l - ε - i ε ^ j t - ε - j ∑ t = 1 n ε ^ i t - ε - i 2 ∑ t = 1 n ε ^ j t - ε - j 2 , l =0,1,…,i​ and ​j=1,2,…,k ,$
where ${\stackrel{^}{\epsilon }}_{it}$ denotes an estimate of the $t$th residual for the $i$th series ${\epsilon }_{it}$ and ${\stackrel{-}{\epsilon }}_{i}=\sum _{t=1}^{n}{\stackrel{^}{\epsilon }}_{it}/n$. (Note that ${\stackrel{^}{R}}_{l}$ is an estimate of $E\left({\epsilon }_{t-l}{\epsilon }_{t}^{\mathrm{T}}\right)$, where $E$ is the expected value.)
A modified portmanteau statistic, ${Q}_{\left(m\right)}^{*}$, is calculated from the formula (see Li and McLeod (1981))
 $Qm * = k2 mm+1 2n + n ∑ l=1 m r^ lT R^ 0 -1 ⊗ R^ 0 -1 r^ l ,$
where $\otimes$ denotes Kronecker product, ${\stackrel{^}{R}}_{0}$ is the estimated residual cross-correlation matrix at lag zero and $\stackrel{^}{r}\left(l\right)=\mathrm{vec}\left({\stackrel{^}{R}}_{l}^{\mathrm{T}}\right)$, where $\text{vec}$ of a $k$ by $k$ matrix is a vector with the $\left(i,j\right)$th element in position $\left(i-1\right)k+j$. $m$ denotes the number of residual cross-correlation matrices computed. (Advice on the choice of $m$ is given in Section 9.2.) Let ${l}_{C}$ denote the total number of ‘free’ parameters in the ARMA model excluding the mean, $\mu$, and the residual error covariance matrix $\Sigma$. Then, under the hypothesis of model adequacy, ${Q}_{\left(m\right)}^{*}$, has an asymptotic ${\chi }^{2}$-distribution on $m{k}^{2}-{l}_{C}$ degrees of freedom.
Let $\underline{\stackrel{^}{r}}=\left(\mathrm{vec}\left({R}_{1}^{\mathrm{T}}\right),\mathrm{vec}\left({R}_{2}^{\mathrm{T}}\right),\dots ,\mathrm{vec}\left({R}_{m}^{\mathrm{T}}\right)\right)$ then the covariance matrix of $\underline{\stackrel{^}{r}}$ is given by
 $Varr̲^=Y-XXTGGTX-1XT/n,$
where $Y={I}_{m}\otimes \left(\Delta \otimes \Delta \right)$ and $G={I}_{m}\left(G{G}^{\mathrm{T}}\right)$. $\Delta$ is the dispersion matrix $\Sigma$ in correlation form and $G$ a nonsingular $k$ by $k$ matrix such that $G{G}^{\mathrm{T}}={\Delta }^{-1}$ and $G\Delta {G}^{\mathrm{T}}={I}_{k}$. The construction of the matrix $X$ is discussed in Li and McLeod (1981). (Note that the mean, $\mu$, plays no part in calculating $\mathrm{Var}\left(\stackrel{^}{\underline{r}}\right)$ and therefore is not required as input to g13dsf.)

## 4References

Li W K and McLeod A I (1981) Distribution of the residual autocorrelations in multivariate ARMA time series models J. Roy. Statist. Soc. Ser. B 43 231–239

## 5Arguments

The output quantities k, n, v, kmax, ip, iq, par, parhld and qq from g13ddf are suitable for input to g13dsf.
1:     $\mathbf{k}$ – IntegerInput
On entry: $k$, the number of residual time series.
Constraint: ${\mathbf{k}}\ge 1$.
2:     $\mathbf{n}$ – IntegerInput
On entry: $n$, the number of observations in each residual series.
3:     $\mathbf{v}\left({\mathbf{kmax}},{\mathbf{n}}\right)$ – Real (Kind=nag_wp) arrayInput
On entry: ${\mathbf{v}}\left(\mathit{i},\mathit{t}\right)$ must contain an estimate of the $\mathit{i}$th component of ${\epsilon }_{\mathit{t}}$, for $\mathit{i}=1,2,\dots ,k$ and $\mathit{t}=1,2,\dots ,n$.
Constraints:
• no two rows of ${\mathbf{v}}$ may be identical;
• in each row there must be at least two distinct elements.
4:     $\mathbf{kmax}$ – IntegerInput
On entry: the first dimension of the arrays v, qq, r and r0 and the second dimension of the array r as declared in the (sub)program from which g13dsf is called.
Constraint: ${\mathbf{kmax}}\ge {\mathbf{k}}$.
5:     $\mathbf{ip}$ – IntegerInput
On entry: $p$, the number of AR parameter matrices.
Constraint: ${\mathbf{ip}}\ge 0$.
6:     $\mathbf{iq}$ – IntegerInput
On entry: $q$, the number of MA parameter matrices.
Constraint: ${\mathbf{iq}}\ge 0$.
Note: ${\mathbf{ip}}={\mathbf{iq}}=0$ is not permitted.
7:     $\mathbf{m}$ – IntegerInput
On entry: the value of $m$, the number of residual cross-correlation matrices to be computed. See Section 9.2 for advice on the choice of m.
Constraint: ${\mathbf{ip}}+{\mathbf{iq}}<{\mathbf{m}}<{\mathbf{n}}$.
8:     $\mathbf{par}\left(\left({\mathbf{ip}}+{\mathbf{iq}}\right)×{\mathbf{k}}×{\mathbf{k}}\right)$ – Real (Kind=nag_wp) arrayInput
On entry: the parameter estimates read in row by row in the order ${\varphi }_{1},{\varphi }_{2},\dots ,{\varphi }_{p}$, ${\theta }_{1},{\theta }_{2},\dots ,{\theta }_{q}$.
Thus,
• if ${\mathbf{ip}}>0$, ${\mathbf{par}}\left(\left(\mathit{l}-1\right)×k×k+\left(\mathit{i}-1\right)×k+j\right)$ must be set equal to an estimate of the $\left(\mathit{i},j\right)$th element of ${\varphi }_{\mathit{l}}$, for $\mathit{l}=1,2,\dots ,p$ and $\mathit{i}=1,2,\dots ,k$;
• if ${\mathbf{iq}}\ge 0$, ${\mathbf{par}}\left(p×k×k+\left(\mathit{l}-1\right)×k×k+\left(\mathit{i}-1\right)×k+j\right)$ must be set equal to an estimate of the $\left(\mathit{i},j\right)$th element of ${\theta }_{\mathit{l}}$, for $\mathit{l}=1,2,\dots ,q$ and $\mathit{i}=1,2,\dots ,k$.
The first $p×k×k$ elements of par must satisfy the stationarity condition and the next $q×k×k$ elements of par must satisfy the invertibility condition.
9:     $\mathbf{parhld}\left(\left({\mathbf{ip}}+{\mathbf{iq}}\right)×{\mathbf{k}}×{\mathbf{k}}\right)$ – Logical arrayInput
On entry: ${\mathbf{parhld}}\left(\mathit{i}\right)$ must be set to .TRUE. if ${\mathbf{par}}\left(\mathit{i}\right)$ has been held constant at a pre-specified value and .FALSE. if ${\mathbf{par}}\left(\mathit{i}\right)$ is a free parameter, for $\mathit{i}=1,2,\dots ,\left(p+q\right)×k×k$.
10:   $\mathbf{qq}\left({\mathbf{kmax}},{\mathbf{k}}\right)$ – Real (Kind=nag_wp) arrayInput/Output
On entry: ${\mathbf{qq}}\left(i,j\right)$ is an efficient estimate of the $\left(i,j\right)$th element of $\Sigma$. The lower triangle only is needed.
Constraint: ${\mathbf{qq}}$ must be positive definite.
On exit: if ${\mathbf{ifail}}\ne {\mathbf{1}}$, then the upper triangle is set equal to the lower triangle.
11:   $\mathbf{ishow}$ – IntegerInput
On entry: must be nonzero if the residual cross-correlation matrices $\left\{{\stackrel{^}{r}}_{ij}\left(l\right)\right\}$ and their standard errors $\left\{\mathrm{se}\left({\stackrel{^}{r}}_{ij}\left(l\right)\right)\right\}$, the modified portmanteau statistic with its significance and a summary table are to be printed. The summary table indicates which elements of the residual correlation matrices are significant at the $5%$ level in either a positive or negative direction; i.e., if ${\stackrel{^}{r}}_{ij}\left(l\right)>1.96×\mathrm{se}\left({\stackrel{^}{r}}_{ij}\left(l\right)\right)$ then a ‘$+$’ is printed, if ${\stackrel{^}{r}}_{ij}\left(l\right)<-1.96×\mathrm{se}\left({\stackrel{^}{r}}_{ij}\left(l\right)\right)$ then a ‘$-$’ is printed, otherwise a fullstop (.) is printed. The summary table is only printed if $k\le 6$ on entry.
The residual cross-correlation matrices, their standard errors and the modified portmanteau statistic with its significance are available also as output variables in r, rcm, chi, idf and siglev.
12:   $\mathbf{r0}\left({\mathbf{kmax}},{\mathbf{k}}\right)$ – Real (Kind=nag_wp) arrayOutput
On exit: if $i\ne j$, then ${\mathbf{r0}}\left(i,j\right)$ contains an estimate of the $\left(i,j\right)$th element of the residual cross-correlation matrix at lag zero, ${\stackrel{^}{R}}_{0}$. When $i=j$, ${\mathbf{r0}}\left(i,j\right)$ contains the standard deviation of the $i$th residual series. If ${\mathbf{ifail}}={\mathbf{3}}$ on exit then the first k rows and columns of r0 are set to zero.
13:   $\mathbf{r}\left({\mathbf{kmax}},{\mathbf{kmax}},{\mathbf{m}}\right)$ – Real (Kind=nag_wp) arrayOutput
On exit: ${\mathbf{r}}\left(\mathit{l},\mathit{i},\mathit{j}\right)$ is an estimate of the $\left(\mathit{i},\mathit{j}\right)$th element of the residual cross-correlation matrix at lag $\mathit{l}$, for $\mathit{i}=1,2,\dots ,k$, $\mathit{j}=1,2,\dots ,k$ and $\mathit{l}=1,2,\dots ,m$. If ${\mathbf{ifail}}={\mathbf{3}}$ on exit then all elements of r are set to zero.
14:   $\mathbf{rcm}\left({\mathbf{ldrcm}},{\mathbf{m}}×{\mathbf{k}}×{\mathbf{k}}\right)$ – Real (Kind=nag_wp) arrayOutput
On exit: the estimated standard errors and correlations of the elements in the array r. The correlation between ${\mathbf{r}}\left(l,i,j\right)$ and ${\mathbf{r}}\left({l}_{2},{i}_{2},{j}_{2}\right)$ is returned as ${\mathbf{rcm}}\left(s,t\right)$ where $s=\left(l-1\right)×k×k+\left(j-1\right)×k+i$ and $t=\left({l}_{2}-1\right)×k×k+\left({j}_{2}-1\right)×k+{i}_{2}$ except that if $s=t$, then ${\mathbf{rcm}}\left(s,t\right)$ contains the standard error of ${\mathbf{r}}\left(l,i,j\right)$. If on exit, ${\mathbf{ifail}}\ge {\mathbf{5}}$, then all off-diagonal elements of rcm are set to zero and all diagonal elements are set to $1/\sqrt{n}$.
15:   $\mathbf{ldrcm}$ – IntegerInput
On entry: the first dimension of the array rcm as declared in the (sub)program from which g13dsf is called.
Constraint: ${\mathbf{ldrcm}}\ge {\mathbf{m}}×{\mathbf{k}}×{\mathbf{k}}$.
16:   $\mathbf{chi}$ – Real (Kind=nag_wp)Output
On exit: the value of the modified portmanteau statistic, ${Q}_{\left(m\right)}^{*}$. If ${\mathbf{ifail}}={\mathbf{3}}$ on exit then chi is returned as zero.
17:   $\mathbf{idf}$ – IntegerOutput
On exit: the number of degrees of freedom of chi.
18:   $\mathbf{siglev}$ – Real (Kind=nag_wp)Output
On exit: the significance level of chi based on idf degrees of freedom. If ${\mathbf{ifail}}={\mathbf{3}}$ on exit, siglev is returned as one.
19:   $\mathbf{iw}\left({\mathbf{liw}}\right)$ – Integer arrayWorkspace
20:   $\mathbf{liw}$ – IntegerInput
On entry: the dimension of the array iw as declared in the (sub)program from which g13dsf is called.
Constraint: ${\mathbf{liw}}\ge {\mathbf{k}}×\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{ip}},{\mathbf{iq}}\right)$.
21:   $\mathbf{work}\left({\mathbf{lwork}}\right)$ – Real (Kind=nag_wp) arrayWorkspace
22:   $\mathbf{lwork}$ – IntegerInput
On entry: the dimension of the array work as declared in the (sub)program from which g13dsf is called.
Constraint: if ${\mathbf{lwork}}\ge k\left(n+{\mathbf{kmax}}+2\right)+m{k}^{2}\left(\mathrm{NPAR}+m{k}^{2}+1\right)+\phantom{\rule{0ex}{0ex}}3{k}^{2}+\left(\mathrm{NPAR}+1\right)\mathrm{NPAR}$, $\mathrm{NPAR}=\left(p+q\right){k}^{2}$.
23:   $\mathbf{ifail}$ – IntegerInput/Output
On entry: ifail must be set to $0$, . If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value  is recommended. If the output of error messages is undesirable, then the value $1$ is recommended. Otherwise, because for this routine the values of the output arguments may be useful even if ${\mathbf{ifail}}\ne {\mathbf{0}}$ on exit, the recommended value is $-1$. When the value  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).
Note: g13dsf may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the routine:
${\mathbf{ifail}}=1$
On entry, ${\mathbf{ip}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ip}}\ge 0$.
On entry, ${\mathbf{ip}}=0$ and ${\mathbf{iq}}=0$.
Constraint: ${\mathbf{ip}}={\mathbf{iq}}=0$ must not hold.
On entry, ${\mathbf{iq}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{iq}}\ge 0$.
On entry, ${\mathbf{k}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{k}}\ge 1$.
On entry, ${\mathbf{kmax}}=〈\mathit{\text{value}}〉$ and ${\mathbf{k}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{kmax}}\ge {\mathbf{k}}$.
On entry, ${\mathbf{ldrcm}}=〈\mathit{\text{value}}〉$, ${\mathbf{m}}=〈\mathit{\text{value}}〉$ and ${\mathbf{k}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ldrcm}}\ge {\mathbf{m}}×{\mathbf{k}}×{\mathbf{k}}$.
On entry, ${\mathbf{liw}}=〈\mathit{\text{value}}〉$ and the minimum size $\text{required}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{liw}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{ip}},{\mathbf{iq}}\right)$.
On entry, ${\mathbf{lwork}}=〈\mathit{\text{value}}〉$ and the minimum size $\text{required}=〈\mathit{\text{value}}〉$.
Constraint: lwork must be sufficiently large.
On entry, ${\mathbf{m}}=〈\mathit{\text{value}}〉$, ${\mathbf{ip}}=〈\mathit{\text{value}}〉$ and ${\mathbf{iq}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{m}}>{\mathbf{ip}}+{\mathbf{iq}}$.
On entry, ${\mathbf{m}}=〈\mathit{\text{value}}〉$ and ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{m}}<{\mathbf{n}}$.
${\mathbf{ifail}}=2$
On entry, the AR parameter matrices are outside the stationarity region. To proceed you must supply different parameter estimates in the arrays par and qq.
On entry, the covariance matrix qq is not positive definite. To proceed you must supply different parameter estimates in the arrays par and qq.
On entry, the MA parameter matrices are outside the invertibility region. To proceed you must supply different parameter estimates in the arrays par and qq.
${\mathbf{ifail}}=3$
On entry, at least one of the residual series in the array v has near-zero variance. In this case chi is set to zero, siglev to one and all the elements of r0 and r are set to zero.
On entry, at least two of the residual series are identical. In this case chi is set to zero, siglev to one and all the elements of r0 and r are set to zero.
${\mathbf{ifail}}=4$
Excessive iterations needed to find zeros of determinental polynomials.
${\mathbf{ifail}}=5$
On entry, the AR operator has a factor in common with the MA operator. To proceed you must either supply different parameter estimates in the array qq or delete this common factor from the model. In this case, the off-diagonal elements of rcm are returned as zero and the diagonal elements set to $1/\sqrt{n}$. All other output quantities will be correct.
${\mathbf{ifail}}=6$
The matrix rcm could not be computed because one of its diagonal elements was found to be non-positive. In this case, the off-diagonal elements of rcm are returned as zero and the diagonal elements set to $1/\sqrt{n}$.
${\mathbf{ifail}}=-99$
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

## 7Accuracy

The computations are believed to be stable.

## 8Parallelism and Performance

g13dsf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
g13dsf 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.

### 9.1Timing

The time taken by g13dsf depends upon the number of residual cross-correlation matrices to be computed, $m$, and the number of time series, $k$.

### 9.2Choice of $m$

The number of residual cross-correlation matrices to be computed, $m$, should be chosen to ensure that when the ARMA model (1) is written as either an infinite order autoregressive process, i.e.,
 $Wt-μ=∑j=1∞πjWt-j-μ+εt$
or as an infinite order moving average process, i.e.,
 $Wt-μ=∑j= 1∞ψjεt-j+εt$
then the two sequences of $k$ by $k$ matrices $\left\{{\pi }_{1},{\pi }_{2},\dots \right\}$ and $\left\{{\psi }_{1},{\psi }_{2},\dots \right\}$ are such that ${\pi }_{j}$ and ${\psi }_{j}$ are approximately zero for $j>m$. An overestimate of $m$ is therefore preferable to an under-estimate of $m$. In many instances the choice $m=10$ will suffice. In practice, to be on the safe side, you should try setting $m=20$.

### 9.3Checking a ‘White Noise’ Model

If you have fitted the ‘white noise’ model
 $Wt-μ=εt$
then g13dsf should be entered with $p=1$, $q=0$, and the first ${k}^{2}$ elements of par and parhld set to zero and .TRUE. respectively.

### 9.4Approximate Standard Errors

When ${\mathbf{ifail}}={\mathbf{5}}$ or ${\mathbf{6}}$ all the standard errors in rcm are set to $1/\sqrt{n}$. This is the asymptotic standard error of ${\stackrel{^}{r}}_{ij}\left(l\right)$ when all the autoregressive and moving average parameters are assumed to be known rather than estimated.

### 9.5Alternative Tests

${\stackrel{^}{R}}_{0}$ is useful in testing for instantaneous causality. If you wish to carry out a likelihood ratio test then the covariance matrix at lag zero $\left({\stackrel{^}{C}}_{0}\right)$ can be used. It can be recovered from ${\stackrel{^}{R}}_{0}$ by setting
 $C^0i,j =R^0i,j×R^0i,i×R^0j,j, for ​i≠j =R^0i,j×R^0i,j, for ​i=j$

## 10Example

This example fits a bivariate AR(1) model to two series each of length $48$. $\mu$ has been estimated but ${\varphi }_{1}\left(2,1\right)$ has been constrained to be zero. Ten residual cross-correlation matrices are to be computed.

### 10.1Program Text

Program Text (g13dsfe.f90)

### 10.2Program Data

Program Data (g13dsfe.d)

### 10.3Program Results

Program Results (g13dsfe.r)