NAG Library Routine Document

g13dpf  (multi_regmat_partial)

 Contents

    1  Purpose
    7  Accuracy

1
Purpose

g13dpf calculates the sample partial autoregression matrices of a multivariate time series. A set of likelihood ratio statistics and their significance levels are also returned. These quantities are useful for determining whether the series follows an autoregressive model and, if so, of what order.

2
Specification

Fortran Interface
Subroutine g13dpf ( k, n, z, kmax, m, maxlag, parlag, se, qq, x, pvalue, loglhd, work, lwork, iwork, ifail)
Integer, Intent (In):: k, n, kmax, m, lwork
Integer, Intent (Inout):: ifail
Integer, Intent (Out):: maxlag, iwork(k*m)
Real (Kind=nag_wp), Intent (In):: z(kmax,n)
Real (Kind=nag_wp), Intent (Inout):: parlag(kmax,kmax,m), se(kmax,kmax,m), qq(kmax,kmax,m)
Real (Kind=nag_wp), Intent (Out):: x(m), pvalue(m), loglhd(m), work(lwork)
C Header Interface
#include nagmk26.h
void  g13dpf_ ( const Integer *k, const Integer *n, const double z[], const Integer *kmax, const Integer *m, Integer *maxlag, double parlag[], double se[], double qq[], double x[], double pvalue[], double loglhd[], double work[], const Integer *lwork, Integer iwork[], Integer *ifail)

3
Description

Let Wt = w1t,w2t,,wktT , for t=1,2,,n, denote a vector of k time series. The partial autoregression matrix at lag l, Pl, is defined to be the last matrix coefficient when a vector autoregressive model of order l is fitted to the series. Pl has the property that if Wt follows a vector autoregressive model of order p then Pl=0 for l>p.
Sample estimates of the partial autoregression matrices may be obtained by fitting autoregressive models of successively higher orders by multivariate least squares; see Tiao and Box (1981) and Wei (1990). These models are fitted using a QR algorithm based on the routines g02dcf and g02dff. They are calculated up to lag m, which is usually taken to be at most n/4.
The routine also returns the asymptotic standard errors of the elements of P^l and an estimate of the residual variance-covariance matrix Σ^l, for l=1,2,,m. If Sl denotes the residual sum of squares and cross-products matrix after fitting an ARl model to the series then under the null hypothesis H0:Pl=0 the test statistic
Xl= - n-m-1 -12-lk log Sl Sl-1  
is asymptotically distributed as χ2 with k2 degrees of freedom. Xl provides a useful diagnostic aid in determining the order of an autoregressive model. (Note that Σ^l=Sl/n-l.) The routine also returns an estimate of the maximum of the log-likelihood function for each AR model that has been fitted.

4
References

Tiao G C and Box G E P (1981) Modelling multiple time series with applications J. Am. Stat. Assoc. 76 802–816
Wei W W S (1990) Time Series Analysis: Univariate and Multivariate Methods Addison–Wesley

5
Arguments

1:     k – IntegerInput
On entry: k, the number of time series.
Constraint: k1.
2:     n – IntegerInput
On entry: n, the number of observations in the time series.
Constraint: n4.
3:     zkmaxn – Real (Kind=nag_wp) arrayInput
On entry: zit must contain the observation wit, for i=1,2,,k and t=1,2,,n.
4:     kmax – IntegerInput
On entry: the first dimension of the arrays z, parlag, se and qq and the second dimension of the arrays parlag, se and qq as declared in the (sub)program from which g13dpf is called.
Constraint: kmaxk.
5:     m – IntegerInput
On entry: m, the number of partial autoregression matrices to be computed. If in doubt set m=10.
Constraint: m1 and n-m-k×m+1k.
6:     maxlag – IntegerOutput
On exit: the maximum lag up to which partial autoregression matrices (along with their likelihood ratio statistics and their significance levels) have been successfully computed. On a successful exit maxlag will equal m. If ifail=2 on exit then maxlag will be less than m.
7:     parlagkmaxkmaxm – Real (Kind=nag_wp) arrayOutput
On exit: parlagijl  contains an estimate of the i,jth element of the partial autoregression matrix at lag l, P^lij, for l=1,2,,maxlag, i=1,2,,k and j=1,2,,k.
8:     sekmaxkmaxm – Real (Kind=nag_wp) arrayOutput
On exit: seijl  contains an estimate of the standard error of the corresponding element in the array parlag.
9:     qqkmaxkmaxm – Real (Kind=nag_wp) arrayOutput
On exit: qqijl  contains an estimate of the i,jth element of the corresponding variance-covariance matrix Σ^l, for l=1,2,,maxlag, i=1,2,,k and j=1,2,,k.
10:   xm – Real (Kind=nag_wp) arrayOutput
On exit: xl contains Xl, the likelihood ratio statistic at lag l, for l=1,2,,maxlag.
11:   pvaluem – Real (Kind=nag_wp) arrayOutput
On exit: pvaluel contains the significance level of the statistic in the corresponding element of x.
12:   loglhdm – Real (Kind=nag_wp) arrayOutput
On exit: loglhdl contains an estimate of the maximum of the log-likelihood function when an ARl model has been fitted to the series, for l=1,2,,maxlag.
13:   worklwork – Real (Kind=nag_wp) arrayWorkspace
14:   lwork – IntegerInput
On entry: the dimension of the array work as declared in the (sub)program from which g13dpf is called.
Constraint: lworkk+1k+l4+k+2l2, where l=mk+1.
15:   iworkk×m – Integer arrayWorkspace
16:   ifail – IntegerInput/Output
On entry: ifail must be set to 0, -1​ or ​1. 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 -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this argument, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6
Error Indicators and Warnings

If on entry 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:
ifail=1
On entry,k<1,
orn<4,
orkmax<k,
orm<1,
orn-m-k×m+1<k,
orlwork is too small.
ifail=2
The recursive equations used to compute the sample partial autoregression matrices have broken down at lag maxlag+1. This exit could occur if the regression model is overparameterised. For your settings of k and n the value returned by maxlag is the largest permissible value of m for which the model is not overparameterised. All output quantities in the arrays parlag, se, qq, x, pvalue and loglhd up to and including lag maxlag will be correct.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
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.
ifail=-999
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

7
Accuracy

The computations are believed to be stable.

8
Parallelism and Performance

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

The time taken is roughly proportional to nmk.
For each order of autoregressive model that has been estimated, g13dpf returns the maximum of the log-likelihood function. An alternative means of choosing the order of a vector AR process is to choose the order for which Akaike's information criterion is smallest. That is, choose the value of l for which -2×loglhdl+2lk2 is smallest. You should be warned that this does not always lead to the same choice of l as indicated by the sample partial autoregression matrices and the likelihood ratio statistics.

10
Example

This example computes the sample partial autoregression matrices of two time series of length 48 up to lag 10.

10.1
Program Text

Program Text (g13dpfe.f90)

10.2
Program Data

Program Data (g13dpfe.d)

10.3
Program Results

Program Results (g13dpfe.r)

© The Numerical Algorithms Group Ltd, Oxford, UK. 2017