g13 Chapter Contents
g13 Chapter Introduction
NAG C Library Manual

# NAG Library Function Documentnag_tsa_varma_estimate (g13ddc)

## 1  Purpose

nag_tsa_varma_estimate (g13ddc) fits a vector autoregressive moving average (VARMA) model to an observed vector of time series using the method of Maximum Likelihood (ML). Standard errors of parameter estimates are computed along with their appropriate correlation matrix. The function also calculates estimates of the residual series.

## 2  Specification

 #include #include
 void nag_tsa_varma_estimate (Integer k, Integer n, Integer ip, Integer iq, Nag_IncludeMean mean, double par[], Integer npar, double qq[], Integer kmax, const double w[], const Nag_Boolean parhld[], Nag_Boolean exact, Integer iprint, double cgetol, Integer maxcal, Integer ishow, const char *outfile, Integer *niter, double *rlogl, double v[], double g[], double cm[], Integer pdcm, NagError *fail)

## 3  Description

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. Similarly, the ARMA model (1) is said to be invertible if the eigenvalues of $B\left(\theta \right)$ lie inside the unit circle.
The method of computing the exact likelihood function (using a Kalman filter algorithm) is discussed in Shea (1987). A quasi-Newton algorithm (see Gill and Murray (1972)) is then used to search for the maximum of the log-likelihood function. Stationarity and invertibility are enforced on the model using the reparameterisation discussed in Ansley and Kohn (1986). Conditional on the maximum likelihood estimates being equal to their true values the estimates of the residual series are uncorrelated with zero mean and constant variance $\Sigma$.
You have the option of setting an argument (exact to Nag_FALSE) so that nag_tsa_varma_estimate (g13ddc) calculates conditional maximum likelihood estimates (conditional on ${W}_{0}={W}_{-1}=\cdots ={W}_{1-p}={\epsilon }_{0}={\epsilon }_{-1}=\cdots =\phantom{\rule{0ex}{0ex}}{\epsilon }_{1-q}=0$). This may be useful if the exact maximum likelihood estimates are close to the boundary of the invertibility region.
You also have the option (see Section 5) of requesting nag_tsa_varma_estimate (g13ddc) to constrain elements of the $\varphi$ and $\theta$ matrices and $\mu$ vector to have pre-specified values.

## 4  References

Ansley C F and Kohn R (1986) A note on reparameterising a vector autoregressive moving average model to enforce stationarity J. Statist. Comput. Simulation 24 99–106
Gill P E and Murray W (1972) Quasi-Newton methods for unconstrained optimization J. Inst. Math. Appl. 9 91–108
Shea B L (1987) Estimation of multivariate time series J. Time Ser. Anal. 8 95–110

## 5  Arguments

1:     kIntegerInput
On entry: $k$, the number of observed time series.
Constraint: ${\mathbf{k}}\ge 1$.
2:     nIntegerInput
On entry: $n$, the number of observations in each time series.
3:     ipIntegerInput
On entry: $p$, the number of AR parameter matrices.
Constraint: ${\mathbf{ip}}\ge 0$.
4:     iqIntegerInput
On entry: $q$, the number of MA parameter matrices.
Constraint: ${\mathbf{iq}}\ge 0$.
${\mathbf{ip}}={\mathbf{iq}}=0$ is not permitted.
5:     meanNag_IncludeMeanInput
On entry: ${\mathbf{mean}}=\mathrm{Nag_MeanInclude}$, if components of $\mu$ have been estimated and ${\mathbf{mean}}=\mathrm{Nag_MeanZero}$, if all elements of $\mu$ are to be taken as zero.
Constraint: ${\mathbf{mean}}=\mathrm{Nag_MeanInclude}$ or $\mathrm{Nag_MeanZero}$.
6:     par[npar]doubleInput/Output
On entry: initial parameter estimates read in row by row in the order ${\varphi }_{1},{\varphi }_{2},\dots ,{\varphi }_{p}$, ${\theta }_{1},{\theta }_{2},\dots ,{\theta }_{q},\mu$.
Thus,
• if ${\mathbf{ip}}>0$, ${\mathbf{par}}\left[\left(\mathit{l}-1\right)×k×k+\left(\mathit{i}-1\right)×k+\mathit{j}-1\right]$ must be set equal to an initial estimate of the $\left(\mathit{i},\mathit{j}\right)$th element of ${\varphi }_{\mathit{l}}$, for $\mathit{l}=1,2,\dots ,p$, $\mathit{i}=1,2,\dots ,k$ and $\mathit{j}=1,2,\dots ,k$;
• if ${\mathbf{iq}}>0$, ${\mathbf{par}}\left[p×k×k+\left(l-1\right)×k×k+\left(i-1\right)×k+j-1\right]$ must be set equal to an initial estimate of the $\left(i,j\right)$th element of ${\theta }_{l}$, $l=1,2,\dots ,q$ and $i,j=1,2,\dots ,k$;
• if ${\mathbf{mean}}=\mathrm{Nag_MeanInclude}$, ${\mathbf{par}}\left[\left(p+q\right)×k×k+i-1\right]$ should be set equal to an initial estimate of the $i$th component of $\mu$ ($\mu \left(i\right)$). (If you set ${\mathbf{par}}\left[\left(p+q\right)×k×k+i-1\right]$ to $0.0$ then nag_tsa_varma_estimate (g13ddc) will calculate the mean of the $i$th series and use this as an initial estimate of $\mu \left(i\right)$.)
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.
If in doubt set all elements of par to $0.0$.
On exit: if NE_NOERROR or NE_G13D_BOUND, NE_G13D_DERIV, NE_G13D_MAX_LOGLIK, NE_G13D_MAXCAL or NE_HESS_NOT_POS_DEF then all the elements of par will be overwritten by the latest estimates of the corresponding ARMA parameters.
7:     nparIntegerInput
On entry: npar is the number of initial parameter estimates.
Constraints:
• if ${\mathbf{mean}}=\mathrm{Nag_MeanZero}$, npar must be set equal to $\left(p+q\right)×k×k$;
• if ${\mathbf{mean}}=\mathrm{Nag_MeanInclude}$, npar must be set equal to $\left(p+q\right)×k×k+k$.
The total number of observations $\left(n×k\right)$ must exceed the total number of parameters in the model (${\mathbf{npar}}+k\left(k+1\right)/2$).
8:     qq[${\mathbf{kmax}}×{\mathbf{k}}$]doubleInput/Output
On entry: ${\mathbf{qq}}\left[{\mathbf{kmax}}×\left(\mathit{j}-1\right)+\mathit{i}-1\right]$ must be set equal to an initial estimate of the $\left(\mathit{i},\mathit{j}\right)$th element of $\Sigma$. The lower triangle only is needed. qq must be positive definite. It is strongly recommended that on entry the elements of qq are of the same order of magnitude as at the solution point. If you set ${\mathbf{qq}}\left[{\mathbf{kmax}}×\left(\mathit{j}-1\right)+\mathit{i}-1\right]=0.0$, for $\mathit{i}=1,2,\dots ,k$ and $\mathit{j}=1,2,\dots ,i$, then nag_tsa_varma_estimate (g13ddc) will calculate the covariance matrix between the $k$ time series and use this as an initial estimate of $\Sigma$.
On exit: if NE_NOERROR or NE_G13D_BOUND, NE_G13D_DERIV, NE_G13D_MAX_LOGLIK, NE_G13D_MAXCAL or NE_HESS_NOT_POS_DEF then ${\mathbf{qq}}\left[{\mathbf{kmax}}×\left(j-1\right)+i-1\right]$ will contain the latest estimate of the $\left(i,j\right)$th element of $\Sigma$. The lower triangle only is returned.
9:     kmaxIntegerInput
On entry: stride seperating row elements in qq, w and v.
Constraint: ${\mathbf{kmax}}\ge {\mathbf{k}}$.
10:   w[${\mathbf{kmax}}×{\mathbf{n}}$]const doubleInput
On entry: ${\mathbf{w}}\left[{\mathbf{kmax}}×\left(\mathit{t}-1\right)+\mathit{i}-1\right]$ must be set equal to the $\mathit{i}$th component of ${W}_{\mathit{t}}$, for $\mathit{i}=1,2,\dots ,k$ and $\mathit{t}=1,2,\dots ,n$.
11:   parhld[npar]const Nag_BooleanInput
On entry: ${\mathbf{parhld}}\left[\mathit{i}-1\right]$ must be set to Nag_TRUE if ${\mathbf{par}}\left[\mathit{i}-1\right]$ is to be held constant at its input value and Nag_FALSE if ${\mathbf{par}}\left[\mathit{i}-1\right]$ is a free parameter, for $\mathit{i}=1,2,\dots ,{\mathbf{npar}}$.
If in doubt try setting all elements of parhld to Nag_FALSE.
12:   exactNag_BooleanInput
On entry: must be set equal to Nag_TRUE if you wish nag_tsa_varma_estimate (g13ddc) to compute exact maximum likelihood estimates. exact must be set equal to Nag_FALSE if only conditional likelihood estimates are required.
13:   iprintIntegerInput
On entry: the frequency with which the automatic monitoring function is to be called.
${\mathbf{iprint}}>0$
The ML search procedure is monitored once every iprint iterations and just before exit from the search function.
${\mathbf{iprint}}=0$
The search function is monitored once at the final point.
${\mathbf{iprint}}<0$
The search function is not monitored at all.
14:   cgetoldoubleInput
On entry: the accuracy to which the solution in par and qq is required.
If cgetol is set to ${10}^{-l}$ and on exit NE_NOERROR or NE_G13D_BOUND, NE_G13D_DERIV or NE_HESS_NOT_POS_DEF, then all the elements in par and qq should be accurate to approximately $l$ decimal places. For most practical purposes the value ${10}^{-4}$ should suffice. You should be wary of setting cgetol too small since the convergence criteria may then have become too strict for the machine to handle.
If cgetol has been set to a value which is less than the machine precision, $\epsilon$, then nag_tsa_varma_estimate (g13ddc) will use the value $10.0×\sqrt{\epsilon }$ instead.
15:   maxcalIntegerInput
On entry: the maximum number of likelihood evaluations to be permitted by the search procedure.
Suggested value: ${\mathbf{maxcal}}=40×{\mathbf{npar}}×\left({\mathbf{npar}}+5\right)$.
Constraint: ${\mathbf{maxcal}}\ge 1$.
16:   ishowIntegerInput
On entry: specifies which of the following two quantities are to be printed.
 (i) table of maximum likelihood estimates and their standard errors (as returned in the output arrays par, qq and cm); (ii) table of residual series (as returned in the output array v).
${\mathbf{ishow}}=0$
None of the above are printed.
${\mathbf{ishow}}=1$
(i) only is printed.
${\mathbf{ishow}}=2$
(i) and (ii) are printed.
Constraint: $0\le {\mathbf{ishow}}\le 2$.
17:   outfileconst char *Input
On entry: the name of a file to which diagnostic output will be directed. If outfile is NULL the diagnostic output will be directed to standard output.
18:   niterInteger *Output
On exit: if NE_NOERROR or NE_G13D_BOUND, NE_G13D_DERIV, NE_G13D_MAX_LOGLIK, NE_G13D_MAXCAL or NE_HESS_NOT_POS_DEF then niter contains the number of iterations performed by the search function.
19:   rlogldouble *Output
On exit: if NE_NOERROR or NE_G13D_BOUND, NE_G13D_DERIV, NE_G13D_MAX_LOGLIK, NE_G13D_MAXCAL or NE_HESS_NOT_POS_DEF then rlogl contains the value of the log-likelihood function corresponding to the final point held in par and qq.
20:   v[${\mathbf{kmax}}×{\mathbf{n}}$]doubleOutput
On exit: if NE_NOERROR or NE_G13D_BOUND, NE_G13D_DERIV, NE_G13D_MAX_LOGLIK, NE_G13D_MAXCAL or NE_HESS_NOT_POS_DEF then ${\mathbf{v}}\left[{\mathbf{kmax}}×\left(\mathit{t}-1\right)+\mathit{i}-1\right]$ will 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$, corresponding to the final point held in par and qq.
21:   g[npar]doubleOutput
On exit: if NE_NOERROR or NE_G13D_BOUND, NE_G13D_DERIV, NE_G13D_MAX_LOGLIK, NE_G13D_MAXCAL or NE_HESS_NOT_POS_DEF then ${\mathbf{g}}\left[i-1\right]$ will contain the estimated first derivative of the log-likelihood function with respect to the $i$th element in the array par. If the gradient cannot be computed then all the elements of g are returned as zero.
22:   cm[${\mathbf{pdcm}}×{\mathbf{npar}}$]doubleOutput
On exit: if NE_NOERROR or NE_G13D_BOUND, NE_G13D_DERIV, NE_G13D_MAX_LOGLIK, NE_G13D_MAXCAL or NE_HESS_NOT_POS_DEF then ${\mathbf{cm}}\left[{\mathbf{pdcm}}×\left(j-1\right)+i-1\right]$ will contain an estimate of the correlation coefficient between the $i$th and $j$th elements in the par array for $1\le i\le {\mathbf{npar}}$, $1\le j\le {\mathbf{npar}}$. If $i=j$, then ${\mathbf{cm}}\left[{\mathbf{pdcm}}×\left(j-1\right)+i-1\right]$ will contain the estimated standard error of ${\mathbf{par}}\left[i-1\right]$. If the $l$th component of par has been held constant, i.e., ${\mathbf{parhld}}\left[l-1\right]$ was set to Nag_TRUE, then the $l$th row and column of cm will be set to zero. If the second derivative matrix cannot be computed then all the elements of cm are returned as zero.
23:   pdcmIntegerInput
On entry: stride seperating row elements in cm.
Constraint: ${\mathbf{pdcm}}\ge {\mathbf{npar}}$.
24:   failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

## 6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
On entry, argument $〈\mathit{\text{value}}〉$ had an illegal value.
NE_G13D_AR
The initial AR parameter estimates are outside the stationarity region.
To proceed, you must try a different starting point.
NE_G13D_ARMA
On entry, ${\mathbf{ip}}=0$ and ${\mathbf{iq}}=0$.
NE_G13D_BOUND
The ML solution is so close to the boundary of either the stationarity region or the invertibility region that nag_tsa_varma_estimate (g13ddc) cannot evaluate the Hessian matrix. The elements of cm are set to zero, as are the elements of g. All other output quantities are correct.
NE_G13D_DERIV
An estimate of the second derivative matrix and the gradient vector at the solution point was computed. Either the Hessian matrix was found to be too ill-conditioned to be evaluated accurately or the gradient vector could not be computed to an acceptable degree of accuracy. The elements of cm are set to zero, as are the elements of g. All other output quantities are correct.
The function cannot compute a sufficiently accurate estimate of the gradient vector at the user-supplied starting point. This usually occurs if either the initial parameter estimates are very close to the ML parameter estimates, or you have supplied a very poor estimate of $\Sigma$, or the starting point is very close to the boundary of the stationarity or invertibility region. To proceed, you must try a different starting point.
NE_G13D_MA
The initial MA parameter estimates are outside the invertibility region. To proceed, you must try a different starting point.
NE_G13D_MAX_LOGLIK
The conditions for a solution have not all been met, but a point at which the log-likelihood took a larger value could not be found.
Further information:
 Provided that the estimated first derivatives are sufficiently small, and that the estimated condition number of the second derivative (Hessian) matrix, as printed when ${\mathbf{iprint}}\ge 0$, is not too large, this error exit may simply mean that, although it has not been possible to satisfy the specified requirements, the algorithm has in fact found the solution as far as the accuracy of the machine permits. Such a condition can arise, for instance, if cgetol has been set so small that rounding error in evaluating the likelihood function makes attainment of the convergence conditions impossible. If the estimated condition number at the final point is large, it could be that the final point is a solution but that the smallest eigenvalue of the Hessian matrix is so close to zero at the solution that it is not possible to recognize it as a solution. Output quantities were computed at the final point held in par and qq, except that if g or cm could not be computed, in which case they are set to zero.
NE_G13D_MAXCAL
There have been maxcal log-likelihood evaluations made in the function.
Further information:
 If steady increases in the log-likelihood function were monitored up to the point where this exit occurred, then the exit probably simply occurred because maxcal was set too small, so the calculations should be restarted from the final point held in par and qq. This type of exit may also indicate that there is no maximum to the likelihood surface. Output quantities were computed at the final point held in par and qq, except that if g or cm could not be computed, in which case they are set to zero.
NE_G13D_START
The starting point is too close to the boundary of the admissibility region.
NE_HESS_NOT_POS_DEF
The second-derivative matrix at the solution point is not positive definite. The elements of cm are set to zero. All other output quantities are correct.
NE_INT
On entry, ${\mathbf{ip}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ip}}\ge 0$.
On entry, ${\mathbf{iq}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{iq}}\ge 0$.
On entry, ${\mathbf{ishow}}=〈\mathit{\text{value}}〉$.
Constraint: $0\le {\mathbf{ishow}}\le 2$.
On entry, ${\mathbf{k}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{k}}\ge 1$.
On entry, ${\mathbf{maxcal}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{maxcal}}\ge 1$.
On entry, ${\mathbf{npar}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{npar}}=〈\mathit{\text{value}}〉$.
On entry, ${\mathbf{npar}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{npar}}\ge 0$.
NE_INT_2
On entry, ${\mathbf{kmax}}=〈\mathit{\text{value}}〉$ and ${\mathbf{k}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{kmax}}\ge {\mathbf{k}}$.
On entry, ${\mathbf{pdcm}}=〈\mathit{\text{value}}〉$ and ${\mathbf{npar}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdcm}}\ge {\mathbf{npar}}$.
NE_INT_3
On entry, ${\mathbf{n}}=〈\mathit{\text{value}}〉$, ${\mathbf{k}}=〈\mathit{\text{value}}〉$ and ${\mathbf{npar}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{n}}×{\mathbf{k}}>{\mathbf{npar}}+{\mathbf{k}}×\left({\mathbf{k}}+1\right)/2$.
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 contact NAG for assistance.
NE_NOT_CLOSE_FILE
Cannot close file $〈\mathit{\text{value}}〉$.
NE_NOT_POS_DEF
The initial estimate of $\Sigma$ is not positive definite. To proceed, you must try a different starting point.
NE_NOT_WRITE_FILE
Cannot open file $〈\mathit{\text{value}}〉$ for writing.

## 7  Accuracy

On exit from nag_tsa_varma_estimate (g13ddc), if NE_NOERROR or NE_G13D_BOUND, NE_G13D_DERIV or NE_HESS_NOT_POS_DEF and cgetol has been set to ${10}^{-l}$, then all the parameters should be accurate to approximately $l$ decimal places. If cgetol was set equal to a value less than the machine precision, $\epsilon$, then all the parameters should be accurate to approximately $10.0×\sqrt{\epsilon }$.
If NE_G13D_MAXCAL on exit (i.e., maxcal likelihood evaluations have been made but the convergence conditions of the search function have not been satisfied), then the elements in par and qq may still be good approximations to the ML estimates. Inspection of the elements of g may help you determine whether this is likely.

### 8.1  Memory Usage

Let $r=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{ip}},{\mathbf{iq}}\right)$ and $s={\mathbf{npar}}+{\mathbf{k}}×\left({\mathbf{k}}+1\right)/2$. Local workspace arrays of fixed lengths are allocated internally by nag_tsa_varma_estimate (g13ddc). The total size of these arrays amounts to $s+{\mathbf{k}}×r+52$ Integer elements and $2×{s}^{2}+s×\left(s-1\right)/2+15×s+{{\mathbf{k}}}^{2}×\left(2×{\mathbf{ip}}+{\mathbf{iq}}+{\left(r+3\right)}^{2}\right)+{\mathbf{k}}×\left(2×{r}^{2}+2×\phantom{\rule{0ex}{0ex}}r+3×{\mathbf{n}}+4\right)+10$ double elements.

### 8.2  Timing

The number of iterations required depends upon the number of parameters in the model and the distance of the user-supplied starting point from the solution.

### 8.3  Constraining for Stationarity and Invertibility

If the solution lies on the boundary of the admissibility region (stationarity and invertibility region) then nag_tsa_varma_estimate (g13ddc) may get into difficulty and exit with NE_G13D_MAX_LOGLIK. If this exit occurs you are advised to either try a different starting point or a different setting for exact. If this still continues to occur then you are urged to try fitting a more parsimonious model.

### 8.4  Over-parameterisation

You are advised to try and avoid fitting models with an excessive number of parameters since over-parameterisation can cause the maximization problem to become ill-conditioned.

### 8.5  Standardizing the Residual Series

The standardized estimates of the residual series ${\epsilon }_{t}$ (denoted by ${\stackrel{^}{e}}_{t}$) can easily be calculated by forming the Cholesky decomposition of $\Sigma$, e.g., $G{G}^{\mathrm{T}}$ and setting ${\stackrel{^}{e}}_{t}={G}^{-1}{\stackrel{^}{\epsilon }}_{t}$. nag_dpotrf (f07fdc) may be used to calculate the array g. The components of ${\stackrel{^}{e}}_{t}$ which are now uncorrelated at all lags can sometimes be more easily interpreted.

### 8.6  Assessing the Fit of the Model

If your time series model provides a good fit to the data then the residual series should be approximately white noise, i.e., exhibit no serial cross-correlation. An examination of the residual cross-correlation matrices should confirm whether this is likely to be so. You are advised to call nag_tsa_varma_diagnostic (g13dsc) to provide information for diagnostic checking. nag_tsa_varma_diagnostic (g13dsc) returns the residual cross-correlation matrices along with their asymptotic standard errors. nag_tsa_varma_diagnostic (g13dsc) also computes a portmanteau statistic and its asymptotic significance level for testing model adequacy. If NE_NOERROR or NE_G13D_BOUND, NE_G13D_DERIV, NE_G13D_MAX_LOGLIK or NE_HESS_NOT_POS_DEF on exit from nag_tsa_varma_estimate (g13ddc) then the quantities output k, n, v, kmax, ip, iq, par, parhld, and qq will be suitable for input to nag_tsa_varma_diagnostic (g13dsc).

## 9  Example

This example shows how to fit a bivariate AR(1) model to two series each of length $48$. $\mu$ will be estimated and ${\varphi }_{1}\left(2,1\right)$ will be constrained to be zero.

### 9.1  Program Text

Program Text (g13ddce.c)

### 9.2  Program Data

Program Data (g13ddce.d)

### 9.3  Program Results

Program Results (g13ddce.r)