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_autocorr_part (g13db)

Purpose

nag_tsa_multi_autocorr_part (g13db) calculates the multivariate partial autocorrelation function of a multivariate time series.

Syntax

[p, v0, v, d, db, w, wb, nvp, ifail] = g13db(c0, c, nl, nk, 'ns', ns)
[p, v0, v, d, db, w, wb, nvp, ifail] = nag_tsa_multi_autocorr_part(c0, c, nl, nk, 'ns', ns)

Description

The input is a set of lagged autocovariance matrices C0,C1,C2,,CmC0,C1,C2,,Cm. These will generally be sample values such as are obtained from a multivariate time series using nag_tsa_multi_corrmat_cross (g13dm).
The main calculation is the recursive determination of the coefficients in the finite lag (forward) prediction equation
xt = Φl,1 xt1 + + Φl,l xtl + el,t
xt = Φl,1 xt-1 ++ Φl,l xt-l + el,t
and the associated backward prediction equation
xtl 1 = Ψl,1xtl + + Ψl,lxt 1 + fl,t
xt-l- 1=Ψl,1xt-l++Ψl,lxt- 1+fl,t
together with the covariance matrices DlDl of el,tel,t and GlGl of fl,tfl,t.
The recursive cycle, by which the order of the prediction equation is extended from ll to l + 1l+1, is to calculate
Ml + 1 = Cl + 1T Φl,1 ClT Φl,l C1T
Ml+1 = Cl+1T - Φ l,1 ClT -- Φl,l C1T
(1)
then Φl + 1,l + 1 = Ml + 1 Dl1 Φ l+1,l+1 = Ml+1 Dl-1 , Ψl + 1,l + 1 = MTl + 1 Gl1 Ψ l+1,l+1 = MT l+1 Gl-1
from which
Φl + 1,j = Φl,jΦl + 1,l + 1Ψl,l + 1j,   j = 1,2,,l
Φl+1,j=Φl,j-Φl+1,l+1Ψl,l+1-j,   j=1,2,,l
(2)
and
Ψl + 1,j = Ψl,jΨl + 1,l + 1Φl,l + 1j,  j = 1,2,,l.
Ψl+1,j=Ψl,j-Ψl+1,l+1Φl,l+1-j,  j=1,2,,l.
(3)
Finally, Dl + 1 = DlMl + 1ΦTl + 1,l + 1Dl+1=Dl-Ml+1ΦTl+1,l+1 and Gl + 1 = GlMTl + 1ΨTl + 1,l + 1Gl+1=Gl-MTl+1ΨTl+1,l+1.
(Here TT denotes the transpose of a matrix.)
The cycle is initialized by taking (for l = 0l=0)
D0 = G0 = C0.
D0=G0=C0.
In the step from l = 0l=0 to 11, the above equations contain redundant terms and simplify. Thus (1) becomes M1 = CT1M1=CT1 and neither (2) or (3) are needed.
Quantities useful in assessing the effectiveness of the prediction equation are generalized variance ratios
vl = detDl / detC0 ,   l = 1,2,
vl = detDl / detC0 ,   l=1,2,
and multiple squared partial autocorrelations
pl2 = 1 vl / vl1 .
pl2 = 1 - vl / v l-1 .

References

Akaike H (1971) Autoregressive model fitting for control Ann. Inst. Statist. Math. 23 163–180
Whittle P (1963) On the fitting of multivariate autoregressions and the approximate canonical factorization of a spectral density matrix Biometrika 50 129–134

Parameters

Compulsory Input Parameters

1:     c0(ldc0,ns) – double array
ldc0, the first dimension of the array, must satisfy the constraint ldc0max (ns,1)ldc0max(ns,1).
Contains the zero lag cross-covariances between the ns series as returned by nag_tsa_multi_corrmat_cross (g13dm). (c0 is assumed to be symmetric, upper triangle only is used.)
2:     c(ldc0,ldc0,nl) – double array
ldc0, the first dimension of the array, must satisfy the constraint ldc0max (ns,1)ldc0max(ns,1).
Contains the cross-covariances at lags 11 to nl. c(i,j,k)cijk must contain the cross-covariance, cijkcijk, of series ii and series jj at lag kk. Series jj leads series ii.
3:     nl – int64int32nag_int scalar
mm, the maximum lag for which cross-covariances are supplied in c.
Constraint: nl1nl1.
4:     nk – int64int32nag_int scalar
The number of lags to which partial auto-correlations are to be calculated.
Constraint: 1nknl1nknl.

Optional Input Parameters

1:     ns – int64int32nag_int scalar
Default: The second dimension of the array c0.
kk, the number of time series whose cross-covariances are supplied in c and c0.
Constraint: ns1ns1.

Input Parameters Omitted from the MATLAB Interface

ldc0 wa iwa

Output Parameters

1:     p(nk) – double array
The multiple squared partial autocorrelations from lags 11 to nvp; that is, p(l)pl contains pl2pl2, for l = 1,2,,nvpl=1,2,,nvp. For lags nvp + 1nvp+1 to nk the elements of p are set to zero.
2:     v0 – double scalar
The lag zero prediction error variance (equal to the determinant of c0).
3:     v(nk) – double array
The prediction error variance ratios from lags 11 to nvp; that is, v(l)vl contains vlvl, for l = 1,2,,nvpl=1,2,,nvp. For lags nvp + 1nvp+1 to nk the elements of v are set to zero.
4:     d(ldc0,ldc0,nk) – double array
ldc0max (ns,1)ldc0max(ns,1).
The prediction error variance matrices at lags 11 to nvp.
Element (i,j,k)(i,j,k) of d contains the prediction error covariance of series ii and series jj at lag kk, for k = 1,2,,nvpk=1,2,,nvp. Series jj leads series ii; that is, the (i,j)(i,j)th element of DkDk. For lags nvp + 1nvp+1 to nk the elements of d are set to zero.
5:     db(ldc0,ns) – double array
ldc0max (ns,1)ldc0max(ns,1).
The backward prediction error variance matrix at lag nvp.
db(i,j)dbij contains the backward prediction error covariance of series ii and series jj; that is, the (i,j)(i,j)th element of the GkGk, where k = nvpk=nvp.
6:     w(ldc0,ldc0,nk) – double array
ldc0max (ns,1)ldc0max(ns,1).
The prediction coefficient matrices at lags 11 to nvp.
w(i,j,l)wijl contains the jjth prediction coefficient of series ii at lag ll; that is, the (i,j)(i,j)th element of ΦklΦkl, where k = nvpk=nvp, for l = 1,2,,nvpl=1,2,,nvp. For lags nvp + 1nvp+1 to nk the elements of w are set to zero.
7:     wb(ldc0,ldc0,nk) – double array
ldc0max (ns,1)ldc0max(ns,1).
The backward prediction coefficient matrices at lags 11 to nvp.
wb(i,j,l)wbijl contains the jjth backward prediction coefficient of series ii at lag ll; that is, the (i,j)(i,j)th element of ΨklΨkl, where k = nvpk=nvp, for l = 1,2,,nvpl=1,2,,nvp. For lags nvp + 1nvp+1 to nk the elements of wb are set to zero.
8:     nvp – int64int32nag_int scalar
The maximum lag, LL, for which calculation of p, v, d, db, w and wb was successful. If the function completes successfully nvp will equal nk.
9:     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,ldc0 < 1ldc0<1,
orns < 1ns<1,
orns > ldc0ns>ldc0,
ornl < 1nl<1,
ornk < 1nk<1,
ornk > nlnk>nl,
oriwa < (2 × ns + 1) × nsiwa<(2×ns+1)×ns.
  ifail = 2ifail=2
c0 is not positive definite.
v0, v, p, d, db, w, wb and nvp are set to zero.
W ifail = 3ifail=3
At lag k = nvp + 1nkk=nvp+1nk, DkDk was found not to be positive definite. Up to lag nvp, v0, v, p, d, w and wb contain the values calculated so far and from lag nvp + 1nvp+1 to lag nk the matrices contain zero. db contains the backward prediction coefficients for lag nvp.

Accuracy

The conditioning of the problem depends on the prediction error variance ratios. Very small values of these may indicate loss of accuracy in the computations.

Further Comments

The time taken by nag_tsa_multi_autocorr_part (g13db) is roughly proportional to nk2 × ns3nk2×ns3.
If sample autocorrelation matrices are used as input, then the output will be relevant to the original series scaled by their standard deviations. If these autocorrelation matrices are produced by nag_tsa_multi_corrmat_cross (g13dm), you must replace the diagonal elements of C0C0 (otherwise used to hold the series variances) by 11.

Example

function nag_tsa_multi_autocorr_part_example
c0 = [0.0109, -0.0077917, 0.0013004, 0.0012654;
     -0.0077917, 0.05704, 0.002418, 0.014409;
     0.0013004, 0.002418, 0.04396, -0.021421;
     0.0012654, 0.014409, -0.021421, 0.072289];
c(:,:,1) = ...
 [0.0045889, 0.0004651 -0.00013275,  0.0077531;
 -0.0024419,  -0.011667,  -0.021956, -0.0045803;
   0.001108, -0.0080479,   0.013621, -0.0085868;
-0.00050614,   0.014045, -0.0010087,   0.012269];
c(:,:,2) = ...
 [0.0018652, -0.0064389,  0.0088307, -0.0024808;
  -0.011865,  0.0072367,  -0.019802,  0.0059069;
 -0.0080307,   0.014306,   0.014546,    0.01351;
 -0.0021791,  -0.029528,  -0.015887, 0.00088308];
c(:,:,3) = ...
[-8.055e-005, -0.0037759,  0.0075463, -0.0042276;
  0.0041447, -0.0037987,  0.0019332,  -0.017564;
  -0.010582,  0.0067733,  0.0069832,  0.0061747;
  0.0041352,  -0.016013,   0.017043,  -0.013412];
c(:,:,4) = ...
[0.00076079, -0.0010134,    0.01187, -0.0041651;
  0.0036014, -0.0036375,  -0.025571,  0.0050218;
  -0.013924,   0.011718, -0.0059088,  0.0059297;
   0.010739,  -0.014571,   0.013816,  -0.012588];
c(:,:,5) = ...
[-0.00064365, -0.0044556,  0.0051334, 0.00071587;
  0.0063617, 0.00015217,   0.002727, -0.0022261;
 -0.0085855,  0.0014468, -0.0028698,  0.0044384;
  0.0068339,  -0.002179,   0.013759, 0.00028217];
nl = int64(5);
nk = int64(3);
[p, v0, v, d, db, w, wb, nvp, ifail] = ...
               nag_tsa_multi_autocorr_part(c0, c, nl, nk)
 

p =

    0.6450
    0.9267
    0.8430


v0 =

   1.3670e-06


v =

    0.3550
    0.0260
    0.0041


d(:,:,1) =

    0.0081   -0.0051    0.0016   -0.0003
   -0.0051    0.0409    0.0076    0.0184
    0.0016    0.0076    0.0383   -0.0189
   -0.0003    0.0184   -0.0189    0.0676


d(:,:,2) =

    0.0035   -0.0009   -0.0007   -0.0011
   -0.0009    0.0195    0.0053    0.0057
   -0.0007    0.0053    0.0190   -0.0107
   -0.0011    0.0057   -0.0107    0.0406


d(:,:,3) =

    0.0030   -0.0009   -0.0005    0.0007
   -0.0009    0.0182    0.0087    0.0025
   -0.0005    0.0087    0.0093   -0.0022
    0.0007    0.0025   -0.0022    0.0225


db =

    0.0033   -0.0039   -0.0011    0.0059
   -0.0039    0.0189    0.0035   -0.0033
   -0.0011    0.0035    0.0100   -0.0105
    0.0059   -0.0033   -0.0105    0.0334


w(:,:,1) =

    0.8186    0.2340   -0.1710    0.0926
    0.0674   -0.4872   -0.1406    0.0429
    0.1504    0.1192   -0.3672   -0.4209
   -0.7097    0.0300    0.5978    0.3461


w(:,:,2) =

   -0.3405   -0.1337    0.4061   -0.0218
   -1.2757   -0.1359   -0.6578   -0.1127
   -0.4544    0.1938    0.6342    0.3392
   -0.4324   -0.5485   -0.6290    0.1667


w(:,:,3) =

    0.1644    0.1386    0.0129    0.0346
    0.3929    0.0741   -0.0880   -0.1536
   -1.2924   -0.2449    0.3023    0.3944
    0.8977   -0.3904    0.2515   -0.2830


wb(:,:,1) =

    0.4154    0.0615    0.1532    0.0508
    0.1237   -0.2647   -0.2272    0.4850
   -0.8693   -0.4737    0.3792    0.1381
    1.3078   -0.0918   -1.4540   -0.2197


wb(:,:,2) =

   -0.0674   -0.1226   -0.1367   -0.0973
   -1.2480    0.0309    0.5171   -0.2892
    0.9804   -0.2019    0.1631   -0.1087
   -1.6839   -0.7459    0.5290    0.4158


wb(:,:,3) =

    0.0379    0.1049   -0.2164    0.0801
    0.7539    0.2260   -0.2566   -0.4745
   -0.0034    0.0564   -0.0882    0.1272
    0.5502   -0.4123    0.7165   -0.1457


nvp =

                    3


ifail =

                    0


function g13db_example
c0 = [0.0109, -0.0077917, 0.0013004, 0.0012654;
     -0.0077917, 0.05704, 0.002418, 0.014409;
     0.0013004, 0.002418, 0.04396, -0.021421;
     0.0012654, 0.014409, -0.021421, 0.072289];
c(:,:,1) = ...
 [0.0045889, 0.0004651 -0.00013275,  0.0077531;
 -0.0024419,  -0.011667,  -0.021956, -0.0045803;
   0.001108, -0.0080479,   0.013621, -0.0085868;
-0.00050614,   0.014045, -0.0010087,   0.012269];
c(:,:,2) = ...
 [0.0018652, -0.0064389,  0.0088307, -0.0024808;
  -0.011865,  0.0072367,  -0.019802,  0.0059069;
 -0.0080307,   0.014306,   0.014546,    0.01351;
 -0.0021791,  -0.029528,  -0.015887, 0.00088308];
c(:,:,3) = ...
[-8.055e-005, -0.0037759,  0.0075463, -0.0042276;
  0.0041447, -0.0037987,  0.0019332,  -0.017564;
  -0.010582,  0.0067733,  0.0069832,  0.0061747;
  0.0041352,  -0.016013,   0.017043,  -0.013412];
c(:,:,4) = ...
[0.00076079, -0.0010134,    0.01187, -0.0041651;
  0.0036014, -0.0036375,  -0.025571,  0.0050218;
  -0.013924,   0.011718, -0.0059088,  0.0059297;
   0.010739,  -0.014571,   0.013816,  -0.012588];
c(:,:,5) = ...
[-0.00064365, -0.0044556,  0.0051334, 0.00071587;
  0.0063617, 0.00015217,   0.002727, -0.0022261;
 -0.0085855,  0.0014468, -0.0028698,  0.0044384;
  0.0068339,  -0.002179,   0.013759, 0.00028217];
nl = int64(5);
nk = int64(3);
[p, v0, v, d, db, w, wb, nvp, ifail] = g13db(c0, c, nl, nk)
 

p =

    0.6450
    0.9267
    0.8430


v0 =

   1.3670e-06


v =

    0.3550
    0.0260
    0.0041


d(:,:,1) =

    0.0081   -0.0051    0.0016   -0.0003
   -0.0051    0.0409    0.0076    0.0184
    0.0016    0.0076    0.0383   -0.0189
   -0.0003    0.0184   -0.0189    0.0676


d(:,:,2) =

    0.0035   -0.0009   -0.0007   -0.0011
   -0.0009    0.0195    0.0053    0.0057
   -0.0007    0.0053    0.0190   -0.0107
   -0.0011    0.0057   -0.0107    0.0406


d(:,:,3) =

    0.0030   -0.0009   -0.0005    0.0007
   -0.0009    0.0182    0.0087    0.0025
   -0.0005    0.0087    0.0093   -0.0022
    0.0007    0.0025   -0.0022    0.0225


db =

    0.0033   -0.0039   -0.0011    0.0059
   -0.0039    0.0189    0.0035   -0.0033
   -0.0011    0.0035    0.0100   -0.0105
    0.0059   -0.0033   -0.0105    0.0334


w(:,:,1) =

    0.8186    0.2340   -0.1710    0.0926
    0.0674   -0.4872   -0.1406    0.0429
    0.1504    0.1192   -0.3672   -0.4209
   -0.7097    0.0300    0.5978    0.3461


w(:,:,2) =

   -0.3405   -0.1337    0.4061   -0.0218
   -1.2757   -0.1359   -0.6578   -0.1127
   -0.4544    0.1938    0.6342    0.3392
   -0.4324   -0.5485   -0.6290    0.1667


w(:,:,3) =

    0.1644    0.1386    0.0129    0.0346
    0.3929    0.0741   -0.0880   -0.1536
   -1.2924   -0.2449    0.3023    0.3944
    0.8977   -0.3904    0.2515   -0.2830


wb(:,:,1) =

    0.4154    0.0615    0.1532    0.0508
    0.1237   -0.2647   -0.2272    0.4850
   -0.8693   -0.4737    0.3792    0.1381
    1.3078   -0.0918   -1.4540   -0.2197


wb(:,:,2) =

   -0.0674   -0.1226   -0.1367   -0.0973
   -1.2480    0.0309    0.5171   -0.2892
    0.9804   -0.2019    0.1631   -0.1087
   -1.6839   -0.7459    0.5290    0.4158


wb(:,:,3) =

    0.0379    0.1049   -0.2164    0.0801
    0.7539    0.2260   -0.2566   -0.4745
   -0.0034    0.0564   -0.0882    0.1272
    0.5502   -0.4123    0.7165   -0.1457


nvp =

                    3


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