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)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_tsa_multi_corrmat_partlag (g13dn) 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 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,,wktT , for t=1,2,,n, denote n observations of a vector of k time series. The partial lag correlation matrix at lag l, Pl, 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).
Pl has the following properties.
(i) If Wt follows a vector autoregressive model of order p, then Pl=0 for l>p;
(ii) When k=1, Pl reduces to the univariate partial autocorrelation at lag l;
(iii) Each element of Pl is a properly normalized correlation coefficient;
(iv) When l=1, Pl 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 nag_tsa_multi_corrmat_partlag (g13dn). These may be computed by nag_tsa_multi_corrmat_cross (g13dm). 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^ijs, are asymptotically Normally distributed with mean zero and variance 1/n. In addition the statistic
Xs=ni=1kj=1kP^ij s 2  
has an asymptotic χ2-distribution with k2 degrees of freedom. These quantities, Xl, 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
n, the number of observations in each series.
Constraint: n2.
2:     m int64int32nag_int scalar
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.
3:     r0kmaxk – double array
kmax, the first dimension of the array, must satisfy the constraint kmaxk.
If ij, then r0ij must contain the i,jth element of the sample cross-correlation matrix at lag zero, R^ij0. If i=j, then r0ii must contain the standard deviation of the ith series.
4:     rkmaxkmaxm – double array
kmax, the first dimension of the array, must satisfy the constraint kmaxk.
rijl  must contain the i,jth element of the sample cross-correlation at lag l, R^ijl, for l=1,2,,m, i=1,2,,k and j=1,2,,k, where series j leads series i (see 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.)
k, the dimension of the multivariate time series.
Constraint: k1.

Output Parameters

1:     maxlag int64int32nag_int scalar
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 ifail=2 on exit, then maxlag will be less than m.
2:     parlagkmaxkmaxm – double array
parlagijl contains the i,jth element of the sample partial lag correlation matrix at lag l, P^ijl, for l=1,2,,maxlag, i=1,2,,k and j=1,2,,k.
3:     xm – double array
xl contains the χ2-statistic at lag l, for l=1,2,,maxlag.
4:     pvaluem – double array
pvaluel contains the significance level of the corresponding χ2-statistic in x, for l=1,2,,maxlag.
5:     ifail int64int32nag_int scalar
ifail=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=1
On entry,k<1,
orn<2,
orm<1,
ormn,
orkmax<k,
orlwork<5m+6k2+k.
W  ifail=2
The recursive equations used to compute the sample partial lag correlation matrices have broken down at lag maxlag+1. All output quantities in the arrays parlag, x and pvalue up to and including lag maxlag will be correct.
   ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
   ifail=-399
Your licence key may have expired or may not have been installed correctly.
   ifail=-999
Dynamic memory allocation failed.

Accuracy

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

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 nag_tsa_multi_corrmat_cross (g13dm), then care must be taken to ensure they are supplied as described in Arguments. In particular, for l1, R^ijl must contain the sample cross-correlation coefficient between wit-l and wjt.
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, by making repeated calls to the function with the argument nk set to 1,2,. The i,jth element of the sample partial autoregression matrix at lag l is given by Wi,j,l when nk is set equal to l 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 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 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

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.
function g13dn_example


fprintf('g13dn example results\n\n');

w = [-1.49, -1.62, 5.20, 6.23, 6.21, 5.86, 4.09, 3.18, 2.62, 1.49, 1.17, ...
      0.85, -0.35, 0.24, 2.44, 2.58, 2.04, 0.40, 2.26, 3.34, 5.09, 5.00, ...
      4.78,  4.11, 3.45, 1.65, 1.29, 4.09, 6.32, 7.50, 3.89, 1.58, 5.21, ...
      5.25,  4.93, 7.38, 5.87, 5.81, 9.68, 9.07, 7.29, 7.84, 7.55, 7.32, ...
      7.97,  7.76, 7.00, 8.35;
      7.34,  6.35, 6.96, 8.54, 6.62, 4.97, 4.55, 4.81, 4.75, 4.76,10.88, ...
     10.01, 11.62,10.36, 6.40, 6.24, 7.93, 4.04, 3.73, 5.60, 5.35, 6.81, ...
      8.27,  7.68, 6.65, 6.08,10.25, 9.14,17.75,13.30, 9.63, 6.80, 4.08, ...
      5.06,  4.94, 6.65, 7.94,10.76,11.89, 5.85, 9.01, 7.50,10.02,10.38, ...
      8.15, 8.37, 10.73, 12.14];
[k,n] = size(w);
k = int64(k);
n = int64(n);
m = int64(10);
matrix = 'R';

% Calculate cross correlations
[wmean, r0, r, ifail] = g13dm( ...
			       matrix, k, m, w);

% Calculate sample partial lag correlation matrices
[maxlag, parlag, x, pvalue, ifail] = ...
  g13dn( ...
	 n, m, r0, r);

disp('Partial Lag Correlation Matrices');
for l = 1:m
  fprintf('Lag = %d\n',l);
  disp(parlag(:,:,l));
end
sn1 = 1/sqrt(double(n));
fprintf('Standard error = 1/sqrt(n) = %7.4f\n\n',sn1);

disp('Tables Of Indicator Symbols');
fprintf('\nFor Lags 1 to %d\n',m);
lhs = {'              0.005  :'; '        +     0.01   :';
       '              0.05   :'; 
       '   Sig. Level        :- - - - - - - - - -  Lags';
       '              0.05   :';
       '        -     0.01   :'; '              0.005  :'};
c = sn1*[3.29, 2.58, 1.96, 0, -1.96, -2.58, -3.29];
for i = 1:k
  for j=1:k
    if i==j
      fprintf('\nAuto-correlation function for series %d\n', i);
    else
      fprintf('\nCross-correlation function for series %d and series %d\n', ...
	      i, j);
    end
    rhs = lhs;
    for t = 1:m
      for u = 1:3
	if parlag(i,j,t)>c(u)
	  rhs{u} = strcat(rhs{u},'*');
	end
      end
      for u = 5:7
	if parlag(i,j,t)<c(u)
	  rhs{u} = strcat(rhs{u},'*');
	end
      end
    end
    fprintf('\n');
    fprintf('%s\n',rhs{1:end});
  end
end  

fprintf('\n Lag     Chi-square statistic     P-value\n\n');
ilag = double([1:m]);
fprintf('%4d%18.3f%19.4f\n',[ilag; x'; pvalue']);


g13dn example results

Partial Lag Correlation Matrices
Lag = 1
    0.7359    0.1743
    0.2114    0.5546

Lag = 2
   -0.1869   -0.0832
   -0.1805   -0.0724

Lag = 3
    0.2775   -0.0069
    0.0837   -0.2133

Lag = 4
   -0.0843    0.2269
    0.1284   -0.1764

Lag = 5
    0.2361    0.2384
   -0.0468   -0.0455

Lag = 6
   -0.0164    0.0873
    0.0996   -0.0809

Lag = 7
   -0.0355    0.2611
    0.1258    0.0120

Lag = 8
    0.0767    0.3814
    0.0268   -0.1492

Lag = 9
   -0.0651   -0.3868
    0.1887    0.0564

Lag = 10
   -0.0261   -0.2861
    0.0279   -0.1729

Standard error = 1/sqrt(n) =  0.1443

Tables Of Indicator Symbols

For Lags 1 to 10

Auto-correlation function for series 1

              0.005  :*
        +     0.01   :*
              0.05   :*
   Sig. Level        :- - - - - - - - - -  Lags
              0.05   :
        -     0.01   :
              0.005  :

Cross-correlation function for series 1 and series 2

              0.005  :
        +     0.01   :*
              0.05   :*
   Sig. Level        :- - - - - - - - - -  Lags
              0.05   :**
        -     0.01   :*
              0.005  :

Cross-correlation function for series 2 and series 1

              0.005  :
        +     0.01   :
              0.05   :
   Sig. Level        :- - - - - - - - - -  Lags
              0.05   :
        -     0.01   :
              0.005  :

Auto-correlation function for series 2

              0.005  :*
        +     0.01   :*
              0.05   :*
   Sig. Level        :- - - - - - - - - -  Lags
              0.05   :
        -     0.01   :
              0.005  :

 Lag     Chi-square statistic     P-value

   1            44.363             0.0000
   2             3.825             0.4302
   3             6.220             0.1833
   4             5.096             0.2776
   5             5.609             0.2303
   6             1.169             0.8832
   7             4.098             0.3929
   8             8.368             0.0790
   9             9.248             0.0552
  10             5.434             0.2456

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–2015