PDF version (NAG web site
, 64-bit version, 64-bit version)
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
-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
Description
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
nag_tsa_multi_corrmat_partlag (g13dn). These may be computed by
nag_tsa_multi_corrmat_cross (g13dm). 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.
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:
– int64int32nag_int scalar
-
, the number of observations in each series.
Constraint:
.
- 2:
– int64int32nag_int scalar
-
, 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:
.
- 3:
– double array
-
kmax, the first dimension of the array, must satisfy the constraint
.
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.
- 4:
– double array
-
kmax, the first dimension of the array, must satisfy the constraint
.
must contain the
th element of the sample cross-correlation at lag
,
, for
,
and
, where series
leads series
(see
Further Comments).
Optional Input Parameters
- 1:
– 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.)
, the dimension of the multivariate time series.
Constraint:
.
Output Parameters
- 1:
– int64int32nag_int scalar
-
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, then
maxlag will be less than
m.
- 2:
– double array
-
contains the th element of the sample partial lag correlation matrix at lag ,
, for , and .
- 3:
– double array
-
contains the -statistic at lag , for .
- 4:
– double array
-
contains the significance level of the corresponding
-statistic in
x, for
.
- 5:
– int64int32nag_int scalar
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.
-
-
On entry, | , |
or | , |
or | , |
or | , |
or | , |
or | . |
- W
-
The recursive equations used to compute the sample partial lag correlation matrices have broken down at 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
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
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 .
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
,
must contain the sample cross-correlation coefficient between
and
.
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
by making repeated calls to the function 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
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
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
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 , 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.
Open in the MATLAB editor:
g13dn_example
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';
[wmean, r0, r, ifail] = g13dm( ...
matrix, k, m, w);
[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)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015