NAG Library Function Document
nag_tsa_varma_update (g13dkc)
1
Purpose
nag_tsa_varma_update (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
nag_tsa_varma_forecast (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
nag_tsa_varma_update (g13dkc) the reference vector is updated so that should future series values become available these forecasts may be updated by recalling
nag_tsa_varma_update (g13dkc).
2
Specification
#include <nag.h> |
#include <nagg13.h> |
void |
nag_tsa_varma_update (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) |
|
3
Description
Let
, for
, denote a
-dimensional time series for which forecasts of
have been computed using
nag_tsa_varma_forecast (g13djc). Given
further observations
, where
,
nag_tsa_varma_update (g13dkc) updates the forecasts of
and their corresponding standard errors.
nag_tsa_varma_update (g13dkc) uses a multivariate version of the procedure described in
Box and Jenkins (1976). The forecasts are updated using the
weights, computed in
nag_tsa_varma_forecast (g13djc). 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
nag_tsa_varma_update (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
; 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
nag_tsa_varma_forecast (g13djc)
are suitable for input to
nag_tsa_varma_update (g13dkc).
- 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
nag_tsa_varma_forecast (g13djc).
Constraint:
.
- 3:
– IntegerInput
-
On entry:
, the number of new observations available since the last call to either
nag_tsa_varma_forecast (g13djc) or
nag_tsa_varma_update (g13dkc). The number of new observations since the last call to
nag_tsa_varma_forecast (g13djc) is then
.
Constraint:
.
- 4:
– Integer *Input/Output
-
On entry: on the first call to
nag_tsa_varma_update (g13dkc), since calling
nag_tsa_varma_forecast (g13djc),
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
nag_tsa_varma_update (g13dkc).
On exit: is incremented by
to indicate that
observations have now been used to update the forecasts since the last call to
nag_tsa_varma_forecast (g13djc).
mlast must not be changed between calls to
nag_tsa_varma_update (g13dkc), unless a call to
nag_tsa_varma_forecast (g13djc) has been made between the calls in which case
mlast should be reset to
.
Constraint:
.
- 5:
– const doubleInput
-
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
nag_tsa_varma_forecast (g13djc).
Constraint:
if the transformation defined in
tr in
nag_tsa_varma_forecast (g13djc) 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.
Constraint:
.
- 7:
– doubleInput/Output
-
On entry: must contain the first
elements of the reference vector as returned on a successful exit from
nag_tsa_varma_forecast (g13djc) (or a previous call to
nag_tsa_varma_update (g13dkc)).
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
nag_tsa_varma_forecast (g13djc). The last
k elements are not updated.
- 8:
– IntegerInput
-
On entry: the dimension of the array
ref.
Constraint:
.
- 9:
– doubleOutput
-
On exit: contains an estimate of the th component of , for and .
- 10:
– doubleInput/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
nag_tsa_varma_forecast (g13djc) or
nag_tsa_varma_update (g13dkc) are set equal to the corresponding columns of
z.
- 11:
– doubleInput/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
nag_tsa_varma_forecast (g13djc) or
nag_tsa_varma_update (g13dkc) are set equal to zero.
- 12:
– NagError *Input/Output
-
The NAG error argument (see
Section 3.7 in How to Use the NAG Library and its Documentation).
6
Error Indicators and Warnings
- NE_ALLOC_FAIL
-
Dynamic memory allocation failed.
See
Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
- NE_BAD_PARAM
-
On entry, argument had an illegal value.
- NE_INT
-
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry,
lref is too small:
but must be at least
.
On entry, .
Constraint: .
On entry, .
Constraint: .
- NE_INT_2
-
On entry, and .
Constraint: .
- NE_INT_3
-
On entry, , and .
Constraint: .
- 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 2.7.6 in How to Use the NAG Library and its Documentation for further information.
- NE_NO_LICENCE
-
Your licence key may have expired or may not have been installed correctly.
See
Section 2.7.5 in How to Use the NAG Library and its Documentation 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.
7
Accuracy
The matrix computations are believed to be stable.
8
Parallelism and Performance
nag_tsa_varma_update (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.
If a further
observations,
, become available, then forecasts of
may be updated by recalling
nag_tsa_varma_update (g13dkc) 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.
nag_tsa_varma_estimate (g13ddc)
is first called to fit an AR(1) model to the series.
is to be estimated and
constrained to be zero. A call to
nag_tsa_varma_forecast (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)