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_varma_update (g13dk)

Purpose

nag_tsa_multi_varma_update (g13dk) accepts a sequence of new observations in a multivariate time series and updates both the forecasts and the standard deviations of the forecast errors. A call to nag_tsa_multi_varma_forecast (g13dj) must be made prior to calling this function in order to calculate the elements of a reference vector together with a set of forecasts and their standard errors. On a successful exit from nag_tsa_multi_varma_update (g13dk) the reference vector is updated so that should future series values become available these forecasts may be updated by recalling nag_tsa_multi_varma_update (g13dk).

Syntax

[mlast, ref, v, predz, sefz, ifail] = g13dk(k, mlast, z, ref, predz, sefz, 'lmax', lmax, 'm', m, 'lref', lref)
[mlast, ref, v, predz, sefz, ifail] = nag_tsa_multi_varma_update(k, mlast, z, ref, predz, sefz, 'lmax', lmax, 'm', m, 'lref', lref)

Description

Let Zt = (z1t,z2t,,zkt)T Zt = (z1t,z2t,,zkt)T , for t = 1,2,,nt=1,2,,n, denote a kk-dimensional time series for which forecasts of n + 1,n + 2,, n + lmaxZ^n+1,Z^n+2,, Z^n+lmax have been computed using nag_tsa_multi_varma_forecast (g13dj). Given mm further observations Zn + 1,Zn + 2,,Zn + mZn+1,Zn+2,,Zn+m, where m < lmaxm<lmax, nag_tsa_multi_varma_update (g13dk) updates the forecasts of Zn + m + 1,Zn + m + 2,,Zn + lmaxZn+m+1,Zn+m+2,,Zn+lmax and their corresponding standard errors.
nag_tsa_multi_varma_update (g13dk) uses a multivariate version of the procedure described in Box and Jenkins (1976). The forecasts are updated using the ψψ weights, computed in nag_tsa_multi_varma_forecast (g13dj). If Zt * Zt* denotes the transformed value of ZtZt and t * (l)Z^t*(l) denotes the forecast of Zt + l * Zt+l* from time tt with a lead of ll (that is the forecast of Zt + l * Zt+l* given observations Zt * ,Zt1 * ,Zt*,Zt-1*,), then
t + 1 * (l) = τ + ψlεt + 1 + ψl + 1εt + ψl + 2εt1 +
Z^t+1*(l)=τ+ψlεt+1+ψl+1εt+ψl+2εt-1+
and
t * (l + 1) = τ + ψl + 1εt + ψl + 2εt 1 +
Z^t*(l+ 1)=τ+ψl+ 1εt+ψl+ 2εt- 1+
where ττ is a constant vector of length kk involving the differencing parameters and the mean vector μμ. By subtraction we obtain
t + 1 * (l) = t * (l + 1) + ψlεt + 1.
Z^t+1*(l)=Z^t*(l+1)+ψlεt+1.
Estimates of the residuals corresponding to the new observations are also computed as εn + l = Zn + l * n * (l)εn+l=Zn+l*-Z^n*(l), for l = 1,2,,ml=1,2,,m. These may be of use in checking that the new observations conform to the previously fitted model.
On a successful exit, the reference array is updated so that nag_tsa_multi_varma_update (g13dk) may be called again should future series values become available, see Section [Further Comments].
When a transformation has been used the forecasts and their standard errors are suitably modified to give results in terms of the original series ZtZt; see Granger and Newbold (1976).

References

Box G E P and Jenkins G M (1976) Time Series Analysis: Forecasting and Control (Revised Edition) Holden–Day
Granger C W J and Newbold P (1976) Forecasting transformed series J. Roy. Statist. Soc. Ser. B 38 189–203
Wei W W S (1990) Time Series Analysis: Univariate and Multivariate Methods Addison–Wesley

Parameters

The quantities k, lmax, kmax, ref and lref from nag_tsa_multi_varma_forecast (g13dj) are suitable for input to nag_tsa_multi_varma_update (g13dk).

Compulsory Input Parameters

1:     k – int64int32nag_int scalar
kk, the dimension of the multivariate time series.
Constraint: k1k1.
2:     mlast – int64int32nag_int scalar
On the first call to nag_tsa_multi_varma_update (g13dk), since calling nag_tsa_multi_varma_forecast (g13dj), mlast must be set to 00 to indicate that no new observations have yet been used to update the forecasts; on subsequent calls mlast must contain the value of mlast as output on the previous call to nag_tsa_multi_varma_update (g13dk).
Constraint: 0mlast < lmaxm0mlast<lmax-m.
3:     z(kmax,m) – double array
kmax, the first dimension of the array, must satisfy the constraint kmaxkkmaxk.
z(i,j)zij must contain the value of zi,n + mlast + jzi,n+mlast+j, for i = 1,2,,ki=1,2,,k and j = 1,2,,mj=1,2,,m, and where nn is the number of observations in the time series in the last call made to nag_tsa_multi_varma_forecast (g13dj).
Constraint: if the transformation defined in tr in nag_tsa_multi_varma_forecast (g13dj) for the iith series is the log transformation, then z(i,j) > 0.0zij>0.0, and if it is the square-root transformation, then z(i,j)0.0zij0.0, for j = 1,2,,mj=1,2,,m and i = 1,2,,ki=1,2,,k.
4:     ref(lref) – double array
lref, the dimension of the array, must satisfy the constraint lref(lmax1) × k × k + 2 × k × lmax + klref(lmax-1)×k×k+2×k×lmax+k.
Must contain the first (lmax1) × k × k + 2 × k × lmax + k(lmax-1)×k×k+2×k×lmax+k elements of the reference vector as returned on a successful exit from nag_tsa_multi_varma_forecast (g13dj) (or a previous call to nag_tsa_multi_varma_update (g13dk)).
5:     predz(kmax,lmax) – double array
kmax, the first dimension of the array, must satisfy the constraint kmaxkkmaxk.
Nonupdated values are kept intact.
6:     sefz(kmax,lmax) – double array
kmax, the first dimension of the array, must satisfy the constraint kmaxkkmaxk.
Nonupdated values are kept intact.

Optional Input Parameters

1:     lmax – int64int32nag_int scalar
Default: The second dimension of the arrays predz, sefz. (An error is raised if these dimensions are not equal.)
The number, lmaxlmax, of forecasts requested in the call to nag_tsa_multi_varma_forecast (g13dj).
Constraint: lmax2lmax2.
2:     m – int64int32nag_int scalar
Default: The second dimension of the array z.
mm, the number of new observations available since the last call to either nag_tsa_multi_varma_forecast (g13dj) or nag_tsa_multi_varma_update (g13dk). The number of new observations since the last call to nag_tsa_multi_varma_forecast (g13dj) is then m + mlastm+mlast.
Constraint: 0 < m < lmaxmlast0<m<lmax-mlast.
3:     lref – int64int32nag_int scalar
Default: The dimension of the array ref.
The dimension of the array ref as declared in the (sub)program from which nag_tsa_multi_varma_update (g13dk) is called.
Constraint: lref(lmax1) × k × k + 2 × k × lmax + klref(lmax-1)×k×k+2×k×lmax+k.

Input Parameters Omitted from the MATLAB Interface

kmax work

Output Parameters

1:     mlast – int64int32nag_int scalar
Is incremented by mm to indicate that mlast + mmlast+m observations have now been used to update the forecasts since the last call to nag_tsa_multi_varma_forecast (g13dj).
mlast must not be changed between calls to nag_tsa_multi_varma_update (g13dk), unless a call to nag_tsa_multi_varma_forecast (g13dj) has been made between the calls in which case mlast should be reset to 00.
2:     ref(lref) – double array
The elements of ref are updated. The first (lmax1) × k × k(lmax-1)×k×k elements store the ψψ weights ψ1,ψ2,,ψlmax1ψ1,ψ2,,ψlmax-1. The next k × lmaxk×lmax elements contain the forecasts of the transformed series and the next k × lmaxk×lmax elements contain the variances of the forecasts of the transformed variables; see nag_tsa_multi_varma_forecast (g13dj). The last k elements are not updated.
3:     v(kmax,m) – double array
kmaxkkmaxk.
v(i,j)vij contains an estimate of the iith component of εn + mlast + jεn+mlast+j, for i = 1,2,,ki=1,2,,k and j = 1,2,,mj=1,2,,m.
4:     predz(kmax,lmax) – double array
kmaxkkmaxk.
predz(i,j)predzij contains the updated forecast of zi,n + jzi,n+j, for i = 1,2,,ki=1,2,,k and j = mlast + m + 1,,lmaxj=mlast+m+1,,lmax.
The columns of predz corresponding to the new observations since the last call to either nag_tsa_multi_varma_forecast (g13dj) or nag_tsa_multi_varma_update (g13dk) are set equal to the corresponding columns of z.
5:     sefz(kmax,lmax) – double array
kmaxkkmaxk.
sefz(i,j)sefzij contains an estimate of the standard error of the corresponding element of predz, for i = 1,2,,ki=1,2,,k and j = mlast + m + 1,,lmaxj=mlast+m+1,,lmax.
The columns of sefz corresponding to the new observations since the last call to either nag_tsa_multi_varma_forecast (g13dj) or nag_tsa_multi_varma_update (g13dk) are set equal to zero.
6:     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:
  ifail = 1ifail=1
On entry,k < 1k<1,
orlmax < 2lmax<2,
orm0m0,
ormlast + mlmaxmlast+mlmax,
ormlast < 0mlast<0,
orkmax < kkmax<k,
orlref < (lmax1) × k × k + 2 × k × lmax + klref<(lmax-1)×k×k+2×k×lmax+k.
  ifail = 2ifail=2
On entry, some of the elements of the reference vector, ref, have been corrupted since the most recent call to nag_tsa_multi_varma_forecast (g13dj) (or nag_tsa_multi_varma_update (g13dk)).
  ifail = 3ifail=3
On entry, one or more of the elements of z is invalid, for the transformation being used; that is you may be trying to log or square root a series, some of whose values are negative.
  ifail = 4ifail=4
This is an unlikely exit. For one of the series, overflow will occur if the forecasts are updated. You should check whether the elements of ref have been corrupted.

Accuracy

The matrix computations are believed to be stable.

Further Comments

If a further m*m* observations, Zn + mlast + 1,Zn + mlast + 2,, Zn + mlast + m*Zn+mlast+1,Zn+mlast+2,, Zn+mlast+m*, become available, then forecasts of Zn + mlast + m* + 1,Zn + mlast + m* + 2,, Zn + lmaxZn+mlast+m*+1,Zn+mlast+m*+2,, Zn+lmax may be updated by recalling nag_tsa_multi_varma_update (g13dk) with m = m*m=m*. Note that m and the contents of the array z are the only quantities which need updating; mlast is updated on exit from the previous call. On a successful exit, v contains estimates of εn + mlast + 1,εn + mlast + 2,, εn + mlast + m*εn+mlast+1,εn+mlast+2,, εn+mlast+m*; columns mlast + 1,mlast + 2,,mlast + m*mlast+1,mlast+2,,mlast+m* of predz contain the new observed values Zn + mlast + 1,Zn + mlast + 2,, Zn + mlast + m*Zn+mlast+1,Zn+mlast+2,, Zn+mlast+m* and columns mlast + 1,mlast + 2,,mlast + m*mlast+1,mlast+2,,mlast+m* of sefz are set to zero.

Example

function nag_tsa_multi_varma_update_example
k = int64(2);
mlast = int64(0);
z = [8.1;
     10.2];
ref = [0.8016071892386086;
     0;
     0.0648134906597352;
     0.575015951133362;
     0.6425740858390225;
     0;
     0.08922375105047406;
     0.330643344057805;
     0.5150920068269873;
     0;
     0.09295254958469001;
     0.1901251969693142;
     0.4129014557918555;
     0;
     0.08683410968309672;
     0.109325020969728;
     7.82042808779155;
     10.30633951031062;
     7.277073498724811;
     9.251955479776221;
     6.773178244308308;
     8.645667843598654;
     6.329956567700314;
     8.297042781821611;
     5.952071278119719;
     8.096577810334958;
     2.964154253391392;
     5.379903126133676;
     4.957660260306922;
     7.158732286465553;
     6.297464315601706;
     7.746890308545223;
     7.191419098742513;
     7.941360843800069;
     7.783032455102286;
     8.005661231897443;
     100;
     100;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0];
predz = [7.82042808779155, 7.277073498724811, 6.773178244308308, 6.329956567700314, 5.952071278119719;
     10.30633951031062, 9.251955479776221, 8.645667843598654, 8.297042781821611, 8.096577810334958];
sefz = [1.721671935471852, 2.226580396102266, 2.509474908342721, 2.681682139766477, 2.789808677150153;
     2.319461818209922, 2.675580738169856, 2.783323608304507, 2.81804202307206, 2.829427721624541];
[mlastOut, refOut, v, predzOut, sefzOut, ifail] = ...
    nag_tsa_multi_varma_update(k, mlast, z, ref, predz, sefz)
 

mlastOut =

                    1


refOut =

    0.8016
         0
    0.0648
    0.5750
    0.6426
         0
    0.0892
    0.3306
    0.5151
         0
    0.0930
    0.1901
    0.4129
         0
    0.0868
    0.1093
    7.8204
   10.3063
    7.4943
    9.1908
    6.9433
    8.6105
    6.4641
    8.2768
    6.0583
    8.0850
    2.9642
    5.3799
    4.9577
    7.1587
    6.2975
    7.7469
    7.1914
    7.9414
    7.7830
    8.0057
  100.0000
  100.0000
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0


v =

    0.2796
   -0.1063


predzOut =

    8.1000    7.4943    6.9433    6.4641    6.0583
   10.2000    9.1908    8.6105    8.2768    8.0850


sefzOut =

         0    1.7217    2.2266    2.5095    2.6817
         0    2.3195    2.6756    2.7833    2.8180


ifail =

                    0


function g13dk_example
k = int64(2);
mlast = int64(0);
z = [8.1;
     10.2];
ref = [0.8016071892386086;
     0;
     0.0648134906597352;
     0.575015951133362;
     0.6425740858390225;
     0;
     0.08922375105047406;
     0.330643344057805;
     0.5150920068269873;
     0;
     0.09295254958469001;
     0.1901251969693142;
     0.4129014557918555;
     0;
     0.08683410968309672;
     0.109325020969728;
     7.82042808779155;
     10.30633951031062;
     7.277073498724811;
     9.251955479776221;
     6.773178244308308;
     8.645667843598654;
     6.329956567700314;
     8.297042781821611;
     5.952071278119719;
     8.096577810334958;
     2.964154253391392;
     5.379903126133676;
     4.957660260306922;
     7.158732286465553;
     6.297464315601706;
     7.746890308545223;
     7.191419098742513;
     7.941360843800069;
     7.783032455102286;
     8.005661231897443;
     100;
     100;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0;
     0];
predz = [7.82042808779155, 7.277073498724811, 6.773178244308308, 6.329956567700314, 5.952071278119719;
     10.30633951031062, 9.251955479776221, 8.645667843598654, 8.297042781821611, 8.096577810334958];
sefz = [1.721671935471852, 2.226580396102266, 2.509474908342721, 2.681682139766477, 2.789808677150153;
     2.319461818209922, 2.675580738169856, 2.783323608304507, 2.81804202307206, 2.829427721624541];
[mlastOut, refOut, v, predzOut, sefzOut, ifail] = g13dk(k, mlast, z, ref, predz, sefz)
 

mlastOut =

                    1


refOut =

    0.8016
         0
    0.0648
    0.5750
    0.6426
         0
    0.0892
    0.3306
    0.5151
         0
    0.0930
    0.1901
    0.4129
         0
    0.0868
    0.1093
    7.8204
   10.3063
    7.4943
    9.1908
    6.9433
    8.6105
    6.4641
    8.2768
    6.0583
    8.0850
    2.9642
    5.3799
    4.9577
    7.1587
    6.2975
    7.7469
    7.1914
    7.9414
    7.7830
    8.0057
  100.0000
  100.0000
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0


v =

    0.2796
   -0.1063


predzOut =

    8.1000    7.4943    6.9433    6.4641    6.0583
   10.2000    9.1908    8.6105    8.2768    8.0850


sefzOut =

         0    1.7217    2.2266    2.5095    2.6817
         0    2.3195    2.6756    2.7833    2.8180


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