g13dnf calculates the sample partial lag correlation matrices of a multivariate time series. A set of -statistics and their significance levels are also returned. A call to g13dmf is usually made prior to calling this routine in order to calculate the sample cross-correlation matrices.
The routine may be called by the names g13dnf or nagf_tsa_multi_corrmat_partlag.
Let , for , denote observations of a vector of time series. The partial lag correlation matrix at lag , , is defined to be the correlation matrix between and , after removing the linear dependence on each of the intervening vectors . It is the correlation matrix between the residual vectors resulting from the regression of on the carriers and the regression of on the same set of carriers; see Heyse and Wei (1985).
has the following properties.
(i)If follows a vector autoregressive model of order , then for ;
(ii)When , reduces to the univariate partial autocorrelation at lag ;
(iii)Each element of is a properly normalized correlation coefficient;
(iv)When , is equal to the cross-correlation matrix at lag (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 , which is usually taken to be at most . Only the sample cross-correlation matrices (, for ) and the standard deviations of the series are required as input to g13dnf. These may be computed by g13dmf. Under the hypothesis that follows an autoregressive model of order , the elements of the sample partial lag matrix , denoted by , are asymptotically Normally distributed with mean zero and variance . In addition the statistic
has an asymptotic -distribution with degrees of freedom. These quantities, , are useful as a diagnostic aid for determining whether the series follows an autoregressive model and, if so, of what order.
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
1: – IntegerInput
On entry: , the dimension of the multivariate time series.
2: – IntegerInput
On entry: , the number of observations in each series.
3: – IntegerInput
On entry: , 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.
4: – IntegerInput
On entry: the first dimension of the arrays r0, r and parlag and the second dimension of the arrays r and parlag as declared in the (sub)program from which g13dnf is called.
5: – Real (Kind=nag_wp) arrayInput
On entry: if , then must contain the th element of the sample cross-correlation matrix at lag zero, . If , then must contain the standard deviation of the th series.
6: – Real (Kind=nag_wp) arrayInput
On entry: must contain the th element of the sample cross-correlation at lag ,
, for , and , where series leads series (see Section 9).
7: – IntegerOutput
On exit: the maximum lag up to which partial lag correlation matrices (along with -statistics and their significance levels) have been successfully computed. On a successful exit maxlag will equal m. If on exit, maxlag will be less than m.
8: – Real (Kind=nag_wp) arrayOutput
On exit: contains the th element of the sample partial lag correlation matrix at lag ,
, for , and .
9: – Real (Kind=nag_wp) arrayOutput
On exit: contains the -statistic at lag , for .
10: – Real (Kind=nag_wp) arrayOutput
On exit: contains the significance level of the corresponding -statistic in x, for .
11: – Real (Kind=nag_wp) arrayWorkspace
12: – IntegerInput
On entry: the dimension of the array work as declared in the (sub)program from which g13dnf is called.
13: – IntegerInput/Output
On entry: ifail must be set to , or to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value or is recommended. If message printing is undesirable, then the value is recommended. Otherwise, the value is recommended. When the value or is used it is essential to test the value of ifail on exit.
On exit: unless the routine detects an error or a warning has been flagged (see Section 6).
6Error Indicators and Warnings
If on entry or , explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
On entry, .
On entry, and .
On entry, and the minimum size .
On entry, .
On entry, and .
On entry, .
The recursive equations used to compute the partial lag correlation matrices are ill-conditioned (they have been computed up to lag ). All output quantities in the arrays parlag, x and pvalue up to and including lag maxlag will be correct.
An unexpected error has been triggered by this routine. Please
See Section 7 in the Introduction to the NAG Library FL 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 FL Interface for further information.
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
The accuracy will depend upon the accuracy of the sample cross-correlations.
8Parallelism and Performance
g13dnf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
g13dnf 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 roughly proportional to .
If you have calculated the sample cross-correlation matrices in the arrays r0 and r, without calling g13dmf, then care must be taken to ensure they are supplied as described in Section 5. In particular, for , must contain the sample cross-correlation coefficient between and .
The routine g13dbf 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 by making repeated calls to the routine with the argument nk set to . The th element of the sample partial autoregression matrix at lag is given by when nk is set equal to on entry to g13dbf. Note that this is the ‘Yule–Walker’ estimate. Unlike the partial lag correlation matrices computed by g13dnf, when follows an autoregressive model of order , the elements of the sample partial autoregressive matrix at lag do not have variance , making it very difficult to spot a possible cut-off point. The differences between these matrices are discussed further by Wei (1990).
Note that g13dbf takes the sample cross-covariance matrices as input whereas this routine requires the sample cross-correlation matrices to be input.
This example computes the sample partial lag correlation matrices of two time series of length , up to lag . The matrices, their -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 % 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.