g13dkf 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 g13djf must be made prior to calling this routine 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 g13dkf the reference vector is updated so that should future series values become available these forecasts may be updated by recalling g13dkf.
The routine may be called by the names g13dkf or nagf_tsa_multi_varma_update.
3Description
Let ${Z}_{\mathit{t}}={({z}_{1\mathit{t}},{z}_{2\mathit{t}},\dots ,{z}_{k\mathit{t}})}^{\mathrm{T}}$, for $\mathit{t}=1,2,\dots ,n$, denote a $k$-dimensional time series for which forecasts of ${\hat{Z}}_{n+1},{\hat{Z}}_{n+2},\dots ,{\hat{Z}}_{n+{l}_{\mathrm{max}}}$ have been computed using g13djf. Given $m$ further observations ${Z}_{n+1},{Z}_{n+2},\dots ,{Z}_{n+m}$, where $m<{l}_{\mathrm{max}}$, g13dkf updates the forecasts of ${Z}_{n+m+1},{Z}_{n+m+2},\dots ,{Z}_{n+{l}_{\mathrm{max}}}$ and their corresponding standard errors.
g13dkf uses a multivariate version of the procedure described in Box and Jenkins (1976). The forecasts are updated using the $\psi $ weights, computed in g13djf. If ${Z}_{t}^{*}$ denotes the transformed value of ${Z}_{t}$ and ${\hat{Z}}_{t}^{*}\left(l\right)$ denotes the forecast of ${Z}_{t+l}^{*}$ from time $t$ with a lead of $l$ (that is the forecast of ${Z}_{t+l}^{*}$ given observations ${Z}_{t}^{*},{Z}_{t-1}^{*},\dots \text{}$), then
Estimates of the residuals corresponding to the new observations are also computed as ${\epsilon}_{n+\mathit{l}}={Z}_{n+\mathit{l}}^{*}-{\hat{Z}}_{n}^{*}\left(\mathit{l}\right)$, for $\mathit{l}=1,2,\dots ,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 g13dkf 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 ${Z}_{t}$; see Granger and Newbold (1976).
4References
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. B38 189–203
Wei W W S (1990) Time Series Analysis: Univariate and Multivariate Methods Addison–Wesley
5Arguments
The quantities
k, lmax, kmax, ref and lref from g13djf
are suitable for input to g13dkf.
1: $\mathbf{k}$ – IntegerInput
On entry: $k$, the dimension of the multivariate time series.
Constraint:
${\mathbf{k}}\ge 1$.
2: $\mathbf{lmax}$ – IntegerInput
On entry: the number, ${l}_{\mathrm{max}}$, of forecasts requested in the call to g13djf.
Constraint:
${\mathbf{lmax}}\ge 2$.
3: $\mathbf{m}$ – IntegerInput
On entry: $m$, the number of new observations available since the last call to either g13djf or g13dkf. The number of new observations since the last call to g13djf is then ${\mathbf{m}}+{\mathbf{mlast}}$.
On entry: on the first call to g13dkf, since calling g13djf, 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 g13dkf.
On exit: is incremented by $m$ to indicate that ${\mathbf{mlast}}+{\mathbf{m}}$ observations have now been used to update the forecasts since the last call to g13djf.
mlast must not be changed between calls to g13dkf, unless a call to g13djf has been made between the calls in which case mlast should be reset to $0$.
5: $\mathbf{z}({\mathbf{kmax}},{\mathbf{m}})$ – Real (Kind=nag_wp) arrayInput
On entry: ${\mathbf{z}}(\mathit{i},\mathit{j})$ must contain the value of ${z}_{\mathit{i},n+{\mathbf{mlast}}+\mathit{j}}$, for $\mathit{i}=1,2,\dots ,k$ and $\mathit{j}=1,2,\dots ,m$, and where $n$ is the number of observations in the time series in the last call made to g13djf.
Constraint:
if the transformation defined in tr in g13djf for the $\mathit{i}$th series is the log transformation, then ${\mathbf{z}}(\mathit{i},\mathit{j})>0.0$, and if it is the square-root transformation, then ${\mathbf{z}}(\mathit{i},\mathit{j})\ge 0.0$, for $\mathit{j}=1,2,\dots ,m$ and $\mathit{i}=1,2,\dots ,k$.
6: $\mathbf{kmax}$ – IntegerInput
On entry: the first dimension of the arrays z, predz, sefz and v as declared in the (sub)program from which g13dkf is called.
Constraint:
${\mathbf{kmax}}\ge {\mathbf{k}}$.
7: $\mathbf{ref}\left({\mathbf{lref}}\right)$ – Real (Kind=nag_wp) arrayInput/Output
On entry: must contain the first $({\mathbf{lmax}}-1)\times {\mathbf{k}}\times {\mathbf{k}}+2\times {\mathbf{k}}\times {\mathbf{lmax}}+{\mathbf{k}}$ elements of the reference vector as returned on a successful exit from g13djf (or a previous call to g13dkf).
On exit: the elements of ref are updated. The first $({\mathbf{lmax}}-1)\times {\mathbf{k}}\times {\mathbf{k}}$ elements store the $\psi $ weights ${\psi}_{1},{\psi}_{2},\dots ,{\psi}_{{l}_{\mathrm{max}}-1}$. The next ${\mathbf{k}}\times {\mathbf{lmax}}$ elements contain the forecasts of the transformed series and the next ${\mathbf{k}}\times {\mathbf{lmax}}$ elements contain the variances of the forecasts of the transformed variables; see g13djf. The last k elements are not updated.
8: $\mathbf{lref}$ – IntegerInput
On entry: the dimension of the array ref as declared in the (sub)program from which g13dkf is called.
9: $\mathbf{v}({\mathbf{kmax}},{\mathbf{m}})$ – Real (Kind=nag_wp) arrayOutput
On exit: ${\mathbf{v}}(\mathit{i},\mathit{j})$ contains an estimate of the $\mathit{i}$th component of ${\epsilon}_{n+{\mathbf{mlast}}+\mathit{j}}$, for $\mathit{i}=1,2,\dots ,k$ and $\mathit{j}=1,2,\dots ,m$.
10: $\mathbf{predz}({\mathbf{kmax}},{\mathbf{lmax}})$ – Real (Kind=nag_wp) arrayInput/Output
On entry: nonupdated values are kept intact.
On exit: ${\mathbf{predz}}(\mathit{i},\mathit{j})$ contains the updated forecast of ${z}_{\mathit{i},n+\mathit{j}}$, for $\mathit{i}=1,2,\dots ,k$ and $\mathit{j}={\mathbf{mlast}}+{\mathbf{m}}+1,\dots ,{l}_{\mathrm{max}}$.
The columns of predz corresponding to the new observations since the last call to either g13djf or g13dkf are set equal to the corresponding columns of z.
11: $\mathbf{sefz}({\mathbf{kmax}},{\mathbf{lmax}})$ – Real (Kind=nag_wp) arrayInput/Output
On entry: nonupdated values are kept intact.
On exit: ${\mathbf{sefz}}(\mathit{i},\mathit{j})$ contains an estimate of the standard error of the corresponding element of predz, for $\mathit{i}=1,2,\dots ,k$ and $\mathit{j}={\mathbf{mlast}}+{\mathbf{m}}+1,\dots ,{l}_{\mathrm{max}}$.
The columns of sefz corresponding to the new observations since the last call to either g13djf or g13dkf are set equal to zero.
12: $\mathbf{work}\left({\mathbf{k}}\times {\mathbf{m}}\right)$ – Real (Kind=nag_wp) arrayWorkspace
13: $\mathbf{ifail}$ – IntegerInput/Output
On entry: ifail must be set to $0$, $-1$ or $1$ to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of $0$ causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of $-1$ means that an error message is printed while a value of $1$ means that it is not.
If halting is not appropriate, the value $-1$ or $1$ is recommended. If message printing is undesirable, then the value $1$ is recommended. Otherwise, the value $0$ is recommended. When the value $-\mathbf{1}$ or $\mathbf{1}$ is used it is essential to test the value of ifail on exit.
On exit: ${\mathbf{ifail}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).
6Error Indicators and Warnings
If on entry ${\mathbf{ifail}}=0$ or $-1$, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
${\mathbf{ifail}}=1$
On entry, ${\mathbf{k}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{k}}\ge 1$.
On entry, ${\mathbf{kmax}}=\u27e8\mathit{\text{value}}\u27e9$ and ${\mathbf{k}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{kmax}}\ge {\mathbf{k}}$.
On entry, ${\mathbf{lmax}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{lmax}}\ge 2$.
On entry, ${\mathbf{lref}}=\u27e8\mathit{\text{value}}\u27e9$ and the minimum size $\text{required}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{lref}}\ge ({\mathbf{lmax}}-1)\times {\mathbf{k}}\times {\mathbf{k}}+2\times {\mathbf{k}}\times {\mathbf{lmax}}+{\mathbf{k}}$.
On entry, ${\mathbf{m}}=\u27e8\mathit{\text{value}}\u27e9$, ${\mathbf{lmax}}=\u27e8\mathit{\text{value}}\u27e9$ and ${\mathbf{mlast}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{m}}<{\mathbf{lmax}}-{\mathbf{mlast}}$.
On entry, ${\mathbf{m}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{m}}>0$.
On entry, ${\mathbf{mlast}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{mlast}}\ge 0$.
${\mathbf{ifail}}=2$
On entry, some of the elements of the array ref have been corrupted.
${\mathbf{ifail}}=3$
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.
${\mathbf{ifail}}=4$
The updated forecasts will overflow if computed.
${\mathbf{ifail}}=-99$
An unexpected error has been triggered by this routine. Please
contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
7Accuracy
The matrix computations are believed to be stable.
8Parallelism and Performance
g13dkf 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 routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.
9Further Comments
If a further ${m}^{*}$ observations, ${Z}_{n+{\mathbf{mlast}}+1},{Z}_{n+{\mathbf{mlast}}+2},\dots ,{Z}_{n+{\mathbf{mlast}}+{m}^{*}}$, become available, then forecasts of ${Z}_{n+{\mathbf{mlast}}+{m}^{*}+1},{Z}_{n+{\mathbf{mlast}}+{m}^{*}+2},\dots ,{Z}_{n+{l}_{\mathrm{max}}}$ may be updated by recalling g13dkf with ${\mathbf{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 ${\epsilon}_{n+{\mathbf{mlast}}+1},{\epsilon}_{n+{\mathbf{mlast}}+2},\dots ,{\epsilon}_{n+{\mathbf{mlast}}+{m}^{*}}$; columns ${\mathbf{mlast}}+1,{\mathbf{mlast}}+2,\dots ,{\mathbf{mlast}}+{m}^{*}$ of predz contain the new observed values ${Z}_{n+{\mathbf{mlast}}+1},{Z}_{n+{\mathbf{mlast}}+2},\dots ,{Z}_{n+{\mathbf{mlast}}+{m}^{*}}$ and columns ${\mathbf{mlast}}+1,{\mathbf{mlast}}+2,\dots ,{\mathbf{mlast}}+{m}^{*}$ of sefz are set to zero.
10Example
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.
g13ddf
is first called to fit an AR(1) model to the series. $\mu $ is to be estimated and ${\varphi}_{1}(2,1)$ constrained to be zero. A call to g13djf 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.