NAG CL Interface
g13dnc (multi_​corrmat_​partlag)

Settings help

CL Name Style:

1 Purpose

g13dnc calculates the sample partial lag correlation matrices of a multivariate time series. A set of χ2-statistics and their significance levels are also returned. A call to g13dmc is usually made prior to calling this function in order to calculate the sample cross-correlation matrices.

2 Specification

#include <nag.h>
void  g13dnc (Integer k, Integer n, Integer m, const double r0[], const double r[], Integer *maxlag, double parlag[], double x[], double pvalue[], NagError *fail)
The function may be called by the names: g13dnc, nag_tsa_multi_corrmat_partlag or nag_tsa_multi_part_lag_corr.

3 Description

Let Wt = (w1t,w2t,,wkt) T , for t=1,2,,n, denote n observations of a vector of k time series. The partial lag correlation matrix at lag l, P(l), is defined to be the correlation matrix between Wt and Wt+l, after removing the linear dependence on each of the intervening vectors Wt+1,Wt+2,,Wt+l-1. It is the correlation matrix between the residual vectors resulting from the regression of Wt+l on the carriers Wt+l-1,,Wt+1 and the regression of Wt on the same set of carriers; see Heyse and Wei (1985).
P(l) has the following properties.
  1. (i)If Wt follows a vector autoregressive model of order p, then P(l)=0 for l>p;
  2. (ii)When k=1, P(l) reduces to the univariate partial autocorrelation at lag l;
  3. (iii)Each element of P(l) is a properly normalized correlation coefficient;
  4. (iv)When l=1, P(l) is equal to the cross-correlation matrix at lag 1 (a natural property which also holds for the univariate partial autocorrelation function).
Sample estimates of the partial lag correlation matrices may be obtained using the recursive algorithm described in Wei (1990). They are calculated up to lag m, which is usually taken to be at most n/4. Only the sample cross-correlation matrices (R^(l), for l=0,1,,m) and the standard deviations of the series are required as input to g13dnc. These may be computed by g13dmc. Under the hypothesis that Wt follows an autoregressive model of order s-1, the elements of the sample partial lag matrix P^(s), denoted by P^ij(s), are asymptotically Normally distributed with mean zero and variance 1/n. In addition the statistic
X(s)=ni=1kj=1kP^ij (s) 2  
has an asymptotic χ2-distribution with k2 degrees of freedom. These quantities, X(l), are useful as a diagnostic aid for determining whether the series follows an autoregressive model and, if so, of what order.

4 References

Heyse J F and Wei W W S (1985) The partial lag autocorrelation function Technical Report No. 32 Department of Statistics, Temple University, Philadelphia
Wei W W S (1990) Time Series Analysis: Univariate and Multivariate Methods Addison–Wesley

5 Arguments

1: k Integer Input
On entry: k, the dimension of the multivariate time series.
Constraint: k1.
2: n Integer Input
On entry: n, the number of observations in each series.
Constraint: n2.
3: m Integer Input
On entry: m, the number of partial lag correlation matrices to be computed. Note this also specifies the number of sample cross-correlation matrices that must be contained in the array r.
Constraint: 1m<n.
4: r0[k×k] const double Input
On entry: the sample cross-correlations at lag zero/standard deviations as provided by g13dmc, that is, r0[(j-1)k+i-1] must contain the (i,j)th element of the sample cross-correlation matrix at lag zero if ij and the standard deviation of i=j, for i=1,2,,k and j=1,2,,k.
5: r[k×k×m] const double Input
On entry: the sample cross-correlations as provided by g13dmc, that is, r[(l-1)k2+(j-1)k+i-1] must contain the (i,j)th element of the sample cross-correlation at lag l, for l=1,2,,m, i=1,2,,k and j=1,2,,k, where series j leads series i.
6: maxlag Integer * Output
On exit: the maximum lag up to which partial lag correlation matrices (along with χ2-statistics and their significance levels) have been successfully computed. On a successful exit maxlag will equal m. If fail.code= MATRIX_ILL_CONDITIONED on exit, maxlag will be less than m.
7: parlag[k×k×m] double Input/Output
On exit: parlag[(l-1)k2+(j-1)k+i-1] contains the (i,j)th element of the sample partial lag correlation matrix at lag l, for l=1,2,,maxlag, i=1,2,,k and j=1,2,,k.
8: x[m] double Output
On exit: x[l-1] contains the χ2-statistic at lag l, for l=1,2,,maxlag.
9: pvalue[m] double Output
On exit: pvalue[l-1] contains the significance level of the corresponding χ2-statistic in x, for l=1,2,,maxlag.
10: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

The recursive equations used to compute the partial lag correlation matrices are ill-conditioned (they have been computed up to lag value). All output quantities in the arrays parlag, x and pvalue up to and including lag maxlag will be correct.
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument value had an illegal value.
On entry, k=value.
Constraint: k1.
On entry, m=value.
Constraint: m1.
On entry, n=value.
Constraint: n2.
On entry, m=value and n=value.
Constraint: m<n.
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.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.

7 Accuracy

The accuracy will depend upon the accuracy of the sample cross-correlations.

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
g13dnc is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
g13dnc 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 function. 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 m2k3.
If you have calculated the sample cross-correlation matrices in the arrays r0 and r, without calling g13dmc, then care must be taken to ensure they are supplied as described in Section 5. In particular, for l1, R^ij(l) must contain the sample cross-correlation coefficient between wi(t-l) and wjt.
The function g13dbc computes squared partial autocorrelations for a specified number of lags. It may also be used to estimate a sequence of partial autoregression matrices at lags 1,2, by making repeated calls to the function with the argument nk set to 1,2,. The (i,j)th element of the sample partial autoregression matrix at lag l is given by W(i,j,l) when nk is set equal to l on entry to g13dbc. Note that this is the ‘Yule–Walker’ estimate. Unlike the partial lag correlation matrices computed by g13dnc, when Wt follows an autoregressive model of order s-1, the elements of the sample partial autoregressive matrix at lag s do not have variance 1/n, making it very difficult to spot a possible cut-off point. The differences between these matrices are discussed further by Wei (1990).
Note that g13dbc takes the sample cross-covariance matrices as input whereas this function requires the sample cross-correlation matrices to be input.

10 Example

This example computes the sample partial lag correlation matrices of two time series of length 48, up to lag 10. The matrices, their χ2-statistics and significance levels and a plot of symbols indicating which elements of the sample partial lag correlation matrices are significant are printed. Three * represent significance at the 0.5% level, two * represent significance at the 1% level and a single * represents significance at the 5% level. The * are plotted above or below the central line depending on whether the elements are significant in a positive or negative direction.

10.1 Program Text

Program Text (g13dnce.c)

10.2 Program Data

Program Data (g13dnce.d)

10.3 Program Results

Program Results (g13dnce.r)