NAG Library Routine Document
G13DKF
1 Purpose
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.
2 Specification
SUBROUTINE G13DKF ( |
K, LMAX, M, MLAST, Z, KMAX, REF, LREF, V, PREDZ, SEFZ, WORK, IFAIL) |
INTEGER |
K, LMAX, M, MLAST, KMAX, LREF, IFAIL |
REAL (KIND=nag_wp) |
Z(KMAX,M), REF(LREF), V(KMAX,M), PREDZ(KMAX,LMAX), SEFZ(KMAX,LMAX), WORK(K*M) |
|
3 Description
Let
, for
, denote a
-dimensional time series for which forecasts of
have been computed using
G13DJF. Given
further observations
, where
, G13DKF updates the forecasts of
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
weights, computed in
G13DJF. If
denotes the transformed value of
and
denotes the forecast of
from time
with a lead of
(that is the forecast of
given observations
), then
and
where
is a constant vector of length
involving the differencing parameters and the mean vector
. By subtraction we obtain
Estimates of the residuals corresponding to the new observations are also computed as
, for
. 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
; 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 Parameters
The quantities
K,
LMAX,
KMAX,
REF and
LREF from
G13DJF
are suitable for input to G13DKF.
- 1: – INTEGERInput
-
On entry: , the dimension of the multivariate time series.
Constraint:
.
- 2: – INTEGERInput
-
On entry: the number,
, of forecasts requested in the call to
G13DJF.
Constraint:
.
- 3: – INTEGERInput
-
On entry:
, 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
.
Constraint:
.
- 4: – INTEGERInput/Output
-
On entry: on the first call to G13DKF, since calling
G13DJF,
MLAST must be set to
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
to indicate that
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
.
Constraint:
.
- 5: – REAL (KIND=nag_wp) arrayInput
-
On entry:
must contain the value of
, for
and
, and where
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
th series is the log transformation, then
, and if it is the square-root transformation, then
, for
and
.
- 6: – 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:
.
- 7: – REAL (KIND=nag_wp) arrayInput/Output
-
On entry: must contain the first
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
elements store the
weights
. The next
elements contain the forecasts of the transformed series and the next
elements contain the variances of the forecasts of the transformed variables; see
G13DJF. The last
K elements are not updated.
- 8: – INTEGERInput
-
On entry: the dimension of the array
REF as declared in the (sub)program from which G13DKF is called.
Constraint:
.
- 9: – REAL (KIND=nag_wp) arrayOutput
-
On exit: contains an estimate of the th component of , for and .
- 10: – REAL (KIND=nag_wp) arrayInput/Output
-
On entry: nonupdated values are kept intact.
On exit:
contains the updated forecast of
, for
and
.
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: – REAL (KIND=nag_wp) arrayInput/Output
-
On entry: nonupdated values are kept intact.
On exit:
contains an estimate of the standard error of the corresponding element of
PREDZ, for
and
.
The columns of
SEFZ corresponding to the new observations since the last call to either
G13DJF or G13DKF are set equal to zero.
- 12: – REAL (KIND=nag_wp) arrayWorkspace
-
- 13: – INTEGERInput/Output
-
On entry:
IFAIL must be set to
,
. If you are unfamiliar with this parameter you should refer to
Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
.
When the value is used it is essential to test the value of IFAIL on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6 Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Errors or warnings detected by the routine:
-
On entry, | , |
or | , |
or | , |
or | , |
or | , |
or | , |
or | . |
-
On entry, some of the elements of the reference vector,
REF, have been corrupted since the most recent call to
G13DJF (or G13DKF).
-
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.
-
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.
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 3.8 in the Essential Introduction for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 3.7 in the Essential Introduction for further information.
Dynamic memory allocation failed.
See
Section 3.6 in the Essential Introduction for further information.
7 Accuracy
The matrix computations are believed to be stable.
8 Parallelism and Performance
G13DKF is not threaded by NAG in any implementation.
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.
If a further
observations,
, become available, then forecasts of
may be updated by recalling G13DKF with
. 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
; columns
of
PREDZ contain the new observed values
and columns
of
SEFZ are set to zero.
10 Example
This example shows how to update the forecasts of two series each of length
. 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.
is to be estimated and
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.
10.1 Program Text
Program Text (g13dkfe.f90)
10.2 Program Data
Program Data (g13dkfe.d)
10.3 Program Results
Program Results (g13dkfe.r)