NAG CL Interface
g13dkc (multi_​varma_​update)

Settings help

CL Name Style:


1 Purpose

g13dkc 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 g13djc 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 g13dkc the reference vector is updated so that should future series values become available these forecasts may be updated by recalling g13dkc.

2 Specification

#include <nag.h>
void  g13dkc (Integer k, Integer lmax, Integer m, Integer *mlast, const double z[], Integer kmax, double ref[], Integer lref, double v[], double predz[], double sefz[], NagError *fail)
The function may be called by the names: g13dkc, nag_tsa_multi_varma_update or nag_tsa_varma_update.

3 Description

Let Zt = (z1t,z2t,,zkt) T , for t=1,2,,n, denote a k-dimensional time series for which forecasts of Z^n+1,Z^n+2,, Z^n+lmax have been computed using g13djc. Given m further observations Zn+1,Zn+2,,Zn+m, where m<lmax, g13dkc updates the forecasts of Zn+m+1,Zn+m+2,,Zn+lmax and their corresponding standard errors.
g13dkc uses a multivariate version of the procedure described in Box and Jenkins (1976). The forecasts are updated using the ψ weights, computed in g13djc. If Zt* denotes the transformed value of Zt and Z^t*(l) denotes the forecast of Zt+l* from time t with a lead of l (that is the forecast of Zt+l* given observations Zt*,Zt-1*,), then
Z^t+1*(l)=τ+ψlεt+1+ψl+1εt+ψl+2εt-1+  
and
Z^t*(l+1)=τ+ψl+ 1εt+ψl+ 2εt- 1+  
where τ is a constant vector of length k involving the differencing parameters and the mean vector μ. By subtraction we obtain
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*-Z^n*(l), for l=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 g13dkc may be called again should future series values become available, see Section 9.
When a transformation has been used the forecasts and their standard errors are suitably modified to give results in terms of the original series Zt; see Granger and Newbold (1976).

4 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

5 Arguments

The quantities k, lmax, kmax, ref and lref from g13djc are suitable for input to g13dkc.
1: k Integer Input
On entry: k, the dimension of the multivariate time series.
Constraint: k1.
2: lmax Integer Input
On entry: the number, lmax, of forecasts requested in the call to g13djc.
Constraint: lmax2.
3: m Integer Input
On entry: m, the number of new observations available since the last call to either g13djc or g13dkc. The number of new observations since the last call to g13djc is then m+mlast.
Constraint: 0<m<lmax-mlast.
4: mlast Integer * Input/Output
On entry: on the first call to g13dkc, since calling
g13djc, mlast must be set to 0 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 g13dkc.
On exit: is incremented by m to indicate that mlast+m observations have now been used to update the forecasts since the last call to g13djc.
mlast must not be changed between calls to g13dkc, unless a call to g13djc has been made between the calls in which case mlast should be reset to 0.
Constraint: 0mlast<lmax-m.
5: z[kmax×m] const double Input
On entry: z[kmax×(j-1)+i-1] must contain the value of zi,n+mlast+j, for i=1,2,,k and j=1,2,,m, and where n is the number of observations in the time series in the last call made to g13djc.
Constraint: if the transformation defined in tr in g13djc for the ith series is the log transformation, then z[kmax×(j-1)+i-1]>0.0, and if it is the square-root transformation, then z[kmax×(j-1)+i-1]0.0, for j=1,2,,m and i=1,2,,k.
6: kmax Integer Input
On entry: the first dimension of the arrays Z, PREDZ, SEFZ and V.
Constraint: kmaxk.
7: ref[lref] double Input/Output
On entry: must contain the first (lmax-1)×k×k+2×k×lmax+k elements of the reference vector as returned on a successful exit from g13djc (or a previous call to g13dkc).
On exit: the elements of ref are updated. The first (lmax-1)×k×k elements store the ψ weights ψ1,ψ2,,ψlmax-1. The next k×lmax elements contain the forecasts of the transformed series and the next k×lmax elements contain the variances of the forecasts of the transformed variables; see g13djc. The last k elements are not updated.
8: lref Integer Input
On entry: the dimension of the array ref.
Constraint: lref(lmax-1)×k×k+2×k×lmax+k.
9: v[kmax×m] double Output
On exit: v[kmax×(j-1)+i-1] contains an estimate of the ith component of εn+mlast+j, for i=1,2,,k and j=1,2,,m.
10: predz[kmax×lmax] double Input/Output
On entry: nonupdated values are kept intact.
On exit: predz[kmax×(j-1)+i-1] contains the updated forecast of zi,n+j, for i=1,2,,k and j=mlast+m+1,,lmax.
The columns of predz corresponding to the new observations since the last call to either g13djc or g13dkc are set equal to the corresponding columns of z.
11: sefz[kmax×lmax] double Input/Output
On entry: nonupdated values are kept intact.
On exit: sefz[kmax×(j-1)+i-1] contains an estimate of the standard error of the corresponding element of predz, for i=1,2,,k and j=mlast+m+1,,lmax.
The columns of sefz corresponding to the new observations since the last call to either g13djc or g13dkc are set equal to zero.
12: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_INT
On entry, k=value.
Constraint: k1.
On entry, lmax=value.
Constraint: lmax2.
On entry, lref=value and the minimum size required=value.
Constraint: lref(lmax-1)×k×k+2×k×lmax+k.
On entry, m=value.
Constraint: m>0.
On entry, mlast=value.
Constraint: mlast0.
NE_INT_2
On entry, kmax=value and k=value.
Constraint: kmaxk.
NE_INT_3
On entry, m=value, lmax=value and mlast=value.
Constraint: m<lmax-mlast.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
NE_REF_VEC
On entry, some of the elements of the array ref have been corrupted.
NE_RESULT_OVERFLOW
The updated forecasts will overflow if computed.
NE_TRANSFORMATION
On entry, one (or more) of the transformations requested is invalid. Check that you are not trying to log or square-root a series, some of whose values are negative.

7 Accuracy

The matrix computations are believed to be stable.

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
g13dkc makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9 Further Comments

If a further m* observations, Zn+mlast+1,Zn+mlast+2,, Zn+mlast+m*, become available, then forecasts of Zn+mlast+m*+1,Zn+mlast+m*+2,, Zn+lmax may be updated by recalling g13dkc with 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*; columns mlast+1,mlast+2,,mlast+m* of predz contain the new observed values Zn+mlast+1,Zn+mlast+2,, Zn+mlast+m* and columns mlast+1,mlast+2,,mlast+m* of sefz are set to zero.

10 Example

This example shows how to update the forecasts of two series each of length 48. No transformation has been used and no differencing applied to either of the series. g13ddc is first called to fit an AR(1) model to the series. μ is to be estimated and ϕ1(2,1) constrained to be zero. A call to g13djc is then made in order to compute forecasts of the next five series values. After one new observation becomes available the four forecasts are updated. A further observation becomes available and the three forecasts are updated.

10.1 Program Text

Program Text (g13dkce.c)

10.2 Program Data

Program Data (g13dkce.d)

10.3 Program Results

Program Results (g13dkce.r)