NAG FL Interface
g13dkf (multi_varma_update)
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
Fortran Interface
Subroutine g13dkf ( |
k, lmax, m, mlast, z, kmax, ref, lref, v, predz, sefz, work, ifail) |
Integer, Intent (In) |
:: |
k, lmax, m, kmax, lref |
Integer, Intent (Inout) |
:: |
mlast, ifail |
Real (Kind=nag_wp), Intent (In) |
:: |
z(kmax,m) |
Real (Kind=nag_wp), Intent (Inout) |
:: |
ref(lref), v(kmax,m), predz(kmax,lmax), sefz(kmax,lmax) |
Real (Kind=nag_wp), Intent (Out) |
:: |
work(k*m) |
|
C Header Interface
#include <nag.h>
void |
g13dkf_ (const Integer *k, const Integer *lmax, const Integer *m, Integer *mlast, const double z[], const Integer *kmax, double ref[], const Integer *lref, double v[], double predz[], double sefz[], double work[], Integer *ifail) |
|
C++ Header Interface
#include <nag.h> extern "C" {
void |
g13dkf_ (const Integer &k, const Integer &lmax, const Integer &m, Integer &mlast, const double z[], const Integer &kmax, double ref[], const Integer &lref, double v[], double predz[], double sefz[], double work[], Integer &ifail) |
}
|
The routine may be called by the names g13dkf or nagf_tsa_multi_varma_update.
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
Arguments
The quantities
k,
lmax,
kmax,
ref and
lref from
g13djf
are suitable for input to
g13dkf.
-
1:
– Integer
Input
-
On entry: , the dimension of the multivariate time series.
Constraint:
.
-
2:
– Integer
Input
-
On entry: the number,
, of forecasts requested in the call to
g13djf.
Constraint:
.
-
3:
– Integer
Input
-
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:
– Integer
Input/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) array
Input
-
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:
– Integer
Input
-
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) array
Input/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:
– Integer
Input
-
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) array
Output
-
On exit: contains an estimate of the th component of , for and .
-
10:
– Real (Kind=nag_wp) array
Input/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) array
Input/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) array
Workspace
-
-
13:
– Integer
Input/Output
-
On entry:
ifail must be set to
,
or
to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value
or
is recommended. If message printing is undesirable, then the value
is recommended. Otherwise, the value
is recommended.
When the value or 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, .
Constraint: .
On entry, and .
Constraint: .
On entry, .
Constraint: .
On entry, and the minimum size .
Constraint: .
On entry, , and .
Constraint: .
On entry, .
Constraint: .
On entry, .
Constraint: .
-
On entry, some of the elements of the array
ref have been corrupted.
-
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.
-
The updated forecasts will overflow if computed.
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.
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.
Dynamic memory allocation failed.
See
Section 9 in the Introduction to the NAG Library FL Interface for further information.
7
Accuracy
The matrix computations are believed to be stable.
8
Parallelism 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.
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
10.2
Program Data
10.3
Program Results