hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_tsa_multi_corrmat_partlag (g13dn)

Purpose

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

Syntax

[maxlag, parlag, x, pvalue, ifail] = g13dn(n, m, r0, r, 'k', k)
[maxlag, parlag, x, pvalue, ifail] = nag_tsa_multi_corrmat_partlag(n, m, r0, r, 'k', k)

Description

Let Wt = (w1t,w2t,,wkt)T Wt = (w1t,w2t,,wkt)T , for t = 1,2,,nt=1,2,,n, denote nn observations of a vector of kk time series. The partial lag correlation matrix at lag ll, P(l)P(l), is defined to be the correlation matrix between WtWt and Wt + lWt+l, after removing the linear dependence on each of the intervening vectors Wt + 1,Wt + 2,,Wt + l1Wt+1,Wt+2,,Wt+l-1. It is the correlation matrix between the residual vectors resulting from the regression of Wt + lWt+l on the carriers Wt + l1,,Wt + 1Wt+l-1,,Wt+1 and the regression of WtWt on the same set of carriers; see Heyse and Wei (1985).
P(l)P(l) has the following properties.
(i) If WtWt follows a vector autoregressive model of order pp, then P(l) = 0P(l)=0 for l > pl>p;
(ii) When k = 1k=1, P(l)P(l) reduces to the univariate partial autocorrelation at lag ll;
(iii) Each element of P(l)P(l) is a properly normalized correlation coefficient;
(iv) When l = 1l=1, P(l)P(l) is equal to the cross-correlation matrix at lag 11 (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 mm, which is usually taken to be at most n / 4n/4. Only the sample cross-correlation matrices ((l)R^(l), for l = 0,1,,ml=0,1,,m) and the standard deviations of the series are required as input to nag_tsa_multi_corrmat_partlag (g13dn). These may be computed by nag_tsa_multi_corrmat_cross (g13dm). Under the hypothesis that WtWt follows an autoregressive model of order s1s-1, the elements of the sample partial lag matrix (s)P^(s), denoted by ij(s)P^ij(s), are asymptotically Normally distributed with mean zero and variance 1 / n1/n. In addition the statistic
kk
X(s) = nij(s)2
i = 1j = 1
X(s)=ni=1kj=1kP^ij (s) 2
has an asymptotic χ2χ2-distribution with k2k2 degrees of freedom. These quantities, X(l)X(l), are useful as a diagnostic aid for determining whether the series follows an autoregressive model and, if so, of what order.

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

Parameters

Compulsory Input Parameters

1:     n – int64int32nag_int scalar
nn, the number of observations in each series.
Constraint: n2n2.
2:     m – int64int32nag_int scalar
mm, 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 < n1m<n.
3:     r0(kmax,k) – double array
kmax, the first dimension of the array, must satisfy the constraint kmaxkkmaxk.
If ijij, then r0(i,j)r0ij must contain the (i,j)(i,j)th element of the sample cross-correlation matrix at lag zero, ij(0)R^ij(0). If i = ji=j, then r0(i,i)r0ii must contain the standard deviation of the iith series.
4:     r(kmax,kmax,m) – double array
kmax, the first dimension of the array, must satisfy the constraint kmaxkkmaxk.
r(i,j,l)r(i,j,l) must contain the (i,j)(i,j)th element of the sample cross-correlation at lag ll, ij(l)R^ij(l), for l = 1,2,,ml=1,2,,m, i = 1,2,,ki=1,2,,k and j = 1,2,,kj=1,2,,k, where series jj leads series ii (see Section [Further Comments]).

Optional Input Parameters

1:     k – int64int32nag_int scalar
Default: The first dimension of the arrays r0, r and the second dimension of the array r0. (An error is raised if these dimensions are not equal.)
kk, the dimension of the multivariate time series.
Constraint: k1k1.

Input Parameters Omitted from the MATLAB Interface

kmax work lwork

Output Parameters

1:     maxlag – int64int32nag_int scalar
The maximum lag up to which partial lag correlation matrices (along with χ2χ2-statistics and their significance levels) have been successfully computed. On a successful exit maxlag will equal m. If ifail = 2ifail=2 on exit, then maxlag will be less than m.
2:     parlag(kmax,kmax,m) – double array
kmaxkkmaxk.
parlag(i,j,l)parlag(i,j,l) contains the (i,j)(i,j)th element of the sample partial lag correlation matrix at lag ll, ij(l)P^ij(l), for l = 1,2,,maxlagl=1,2,,maxlag, i = 1,2,,ki=1,2,,k and j = 1,2,,kj=1,2,,k.
3:     x(m) – double array
x(l)xl contains the χ2χ2-statistic at lag ll, for l = 1,2,,maxlagl=1,2,,maxlag.
4:     pvalue(m) – double array
pvalue(l)pvaluel contains the significance level of the corresponding χ2χ2-statistic in x, for l = 1,2,,maxlagl=1,2,,maxlag.
5:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:

Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.

  ifail = 1ifail=1
On entry,k < 1k<1,
orn < 2n<2,
orm < 1m<1,
ormnmn,
orkmax < kkmax<k,
orlwork < (5m + 6)k2 + klwork<(5m+6)k2+k.
W ifail = 2ifail=2
The recursive equations used to compute the sample partial lag correlation matrices have broken down at lag maxlag + 1maxlag+1. All output quantities in the arrays parlag, x and pvalue up to and including lag maxlag will be correct.

Accuracy

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

Further Comments

The time taken is roughly proportional to m2k3m2k3.
If you have calculated the sample cross-correlation matrices in the arrays r0 and r, without calling nag_tsa_multi_corrmat_cross (g13dm), then care must be taken to ensure they are supplied as described in Section [Parameters]. In particular, for l1l1, ij(l)R^ij(l) must contain the sample cross-correlation coefficient between wi(tl)wi(t-l) and wjtwjt.
The function nag_tsa_multi_autocorr_part (g13db) 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,1,2, by making repeated calls to the function with the parameter nk set to 1,2,1,2,. The (i,j)(i,j)th element of the sample partial autoregression matrix at lag ll is given by W(i,j,l)W(i,j,l) when nk is set equal to ll on entry to nag_tsa_multi_autocorr_part (g13db). Note that this is the ‘Yule–Walker’ estimate. Unlike the partial lag correlation matrices computed by nag_tsa_multi_corrmat_partlag (g13dn), when WtWt follows an autoregressive model of order s1s-1, the elements of the sample partial autoregressive matrix at lag ss do not have variance 1 / n1/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 nag_tsa_multi_autocorr_part (g13db) takes the sample cross-covariance matrices as input whereas this function requires the sample cross-correlation matrices to be input.

Example

function nag_tsa_multi_corrmat_partlag_example
n = int64(48);
m = int64(10);
r0 = [2.817550272831091, 0.2493409556934405;
     0.2493409556934405, 2.815040887355392];
r(:,:,1) = ...
  [0.73593863031348350, 0.17433878570803560; 0.21134574083468491, 0.55456558496897801];
r(:,:,2) = ...
  [0.45574297048635831, 0.076489684716733147; 0.069281866929831626, 0.26045462989184309];
r(:,:,3) = ...
  [0.37916838732214042, 0.013853352862656621; 0.02598655726548196, -0.038097764295735172];
r(:,:,4) = ...
  [0.32240436132974731, 0.11001758294806301; 0.09328031343627570, -0.23585487058651339];
r(:,:,5) = ...
  [0.34106636103987392, 0.26947269669730167; 0.087228549020231153, -0.25006674266294399];
r(:,:,6) = ...
  [0.36305329805369058, 0.34359213396780991; 0.13229630902251391, -0.22651914298634429];
r(:,:,7) = ...
  [0.27995096372005901, 0.42541532263330151; 0.20691314644794351, -0.12843515289063159];
r(:,:,8) = ...
  [0.24797414664441220, 0.52175528114652636; 0.19701668447924531, -0.084636152820583122];
r(:,:,9) = ...
  [0.23975877705555310, 0.26643728652348198; 0.25365298730974162, 0.074574867932390251];
r(:,:,10) = ...
  [0.16192879425385229, -0.019718535446637431; 0.26664581656740433, 0.004727174709710211];
[maxlag, parlag, x, pvalue, ifail] = nag_tsa_multi_corrmat_partlag(n, m, r0, r)
 

maxlag =

                   10


parlag(:,:,1) =

    0.7359    0.1743
    0.2113    0.5546


parlag(:,:,2) =

   -0.1869   -0.0832
   -0.1805   -0.0724


parlag(:,:,3) =

    0.2775   -0.0069
    0.0837   -0.2133


parlag(:,:,4) =

   -0.0843    0.2268
    0.1284   -0.1763


parlag(:,:,5) =

    0.2362    0.2384
   -0.0468   -0.0455


parlag(:,:,6) =

   -0.0164    0.0873
    0.0996   -0.0810


parlag(:,:,7) =

   -0.0355    0.2611
    0.1257    0.0121


parlag(:,:,8) =

    0.0768    0.3815
    0.0268   -0.1492


parlag(:,:,9) =

   -0.0651   -0.3867
    0.1887    0.0565


parlag(:,:,10) =

   -0.0261   -0.2861
    0.0279   -0.1729


x =

   44.3621
    3.8239
    6.2189
    5.0941
    5.6094
    1.1698
    4.0983
    8.3707
    9.2440
    5.4353


pvalue =

    0.0000
    0.4304
    0.1834
    0.2778
    0.2303
    0.8830
    0.3929
    0.0789
    0.0553
    0.2455


ifail =

                    0


function g13dn_example
n = int64(48);
m = int64(10);
r0 = [2.817550272831091, 0.2493409556934405;
     0.2493409556934405, 2.815040887355392];
r(:,:,1) = ...
  [0.73593863031348350, 0.17433878570803560; 0.21134574083468491, 0.55456558496897801];
r(:,:,2) = ...
  [0.45574297048635831, 0.076489684716733147; 0.069281866929831626, 0.26045462989184309];
r(:,:,3) = ...
  [0.37916838732214042, 0.013853352862656621; 0.02598655726548196, -0.038097764295735172];
r(:,:,4) = ...
  [0.32240436132974731, 0.11001758294806301; 0.09328031343627570, -0.23585487058651339];
r(:,:,5) = ...
  [0.34106636103987392, 0.26947269669730167; 0.087228549020231153, -0.25006674266294399];
r(:,:,6) = ...
  [0.36305329805369058, 0.34359213396780991; 0.13229630902251391, -0.22651914298634429];
r(:,:,7) = ...
  [0.27995096372005901, 0.42541532263330151; 0.20691314644794351, -0.12843515289063159];
r(:,:,8) = ...
  [0.24797414664441220, 0.52175528114652636; 0.19701668447924531, -0.084636152820583122];
r(:,:,9) = ...
  [0.23975877705555310, 0.26643728652348198; 0.25365298730974162, 0.074574867932390251];
r(:,:,10) = ...
  [0.16192879425385229, -0.019718535446637431; 0.26664581656740433, 0.004727174709710211];
[maxlag, parlag, x, pvalue, ifail] = g13dn(n, m, r0, r)
 

maxlag =

                   10


parlag(:,:,1) =

    0.7359    0.1743
    0.2113    0.5546


parlag(:,:,2) =

   -0.1869   -0.0832
   -0.1805   -0.0724


parlag(:,:,3) =

    0.2775   -0.0069
    0.0837   -0.2133


parlag(:,:,4) =

   -0.0843    0.2268
    0.1284   -0.1763


parlag(:,:,5) =

    0.2362    0.2384
   -0.0468   -0.0455


parlag(:,:,6) =

   -0.0164    0.0873
    0.0996   -0.0810


parlag(:,:,7) =

   -0.0355    0.2611
    0.1257    0.0121


parlag(:,:,8) =

    0.0768    0.3815
    0.0268   -0.1492


parlag(:,:,9) =

   -0.0651   -0.3867
    0.1887    0.0565


parlag(:,:,10) =

   -0.0261   -0.2861
    0.0279   -0.1729


x =

   44.3621
    3.8239
    6.2189
    5.0941
    5.6094
    1.1698
    4.0983
    8.3707
    9.2440
    5.4353


pvalue =

    0.0000
    0.4304
    0.1834
    0.2778
    0.2303
    0.8830
    0.3929
    0.0789
    0.0553
    0.2455


ifail =

                    0



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013