g13dj computes forecasts of a multivariate time series. It is assumed that a vector ARMA model has already been fitted to the appropriately differenced/transformed time series using
g13dd.
The standard deviations of the forecast errors are also returned. A reference vector is set up so that, should future series values become available, the forecasts and their standard errors may be updated by calling g13dk.
Syntax
C# |
---|
public static void g13dj( int k, int n, double[,] z, string[] tr, int[] id, double[,] delta, int ip, int iq, string mean, double[] par, double[,] qq, double[,] v, int lmax, double[,] predz, double[,] sefz, double[] dnref, out int ifail ) |
Visual Basic |
---|
Public Shared Sub g13dj ( _ k As Integer, _ n As Integer, _ z As Double(,), _ tr As String(), _ id As Integer(), _ delta As Double(,), _ ip As Integer, _ iq As Integer, _ mean As String, _ par As Double(), _ qq As Double(,), _ v As Double(,), _ lmax As Integer, _ predz As Double(,), _ sefz As Double(,), _ dnref As Double(), _ <OutAttribute> ByRef ifail As Integer _ ) |
Visual C++ |
---|
public: static void g13dj( int k, int n, array<double,2>^ z, array<String^>^ tr, array<int>^ id, array<double,2>^ delta, int ip, int iq, String^ mean, array<double>^ par, array<double,2>^ qq, array<double,2>^ v, int lmax, array<double,2>^ predz, array<double,2>^ sefz, array<double>^ dnref, [OutAttribute] int% ifail ) |
F# |
---|
static member g13dj : k : int * n : int * z : float[,] * tr : string[] * id : int[] * delta : float[,] * ip : int * iq : int * mean : string * par : float[] * qq : float[,] * v : float[,] * lmax : int * predz : float[,] * sefz : float[,] * dnref : float[] * ifail : int byref -> unit |
Parameters
- k
- Type: System..::..Int32On entry: , the dimension of the multivariate time series.Constraint: .
- n
- Type: System..::..Int32On entry: , the number of observations in the series, , prior to differencing.
- z
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, n]Note: dim1 must satisfy the constraint:On entry: must contain, , the th component of , for and .Constraints:
- if , ;
- if , , for and .
- tr
- Type: array<System..::..String>[]()[][]An array of size [k]On entry: indicates whether the th time series is to be transformed, for .
- No transformation is used.
- A log transformation is used.
- A square root transformation is used.
Constraint: , or , for .
- id
- Type: array<System..::..Int32>[]()[][]An array of size [k]On entry: must specify, , the order of differencing required for the th series.Constraint: , for .
- delta
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, dim2]Note: dim1 must satisfy the constraint:Note: the second dimension of the array delta must be at least , where .On entry: if , then must be set equal to , for and .If , delta is not referenced.
- ip
- Type: System..::..Int32On entry: , the number of AR parameter matrices.Constraint: .
- iq
- Type: System..::..Int32On entry: , the number of MA parameter matrices.Constraint: .
- mean
- Type: System..::..StringOn entry: , if components of have been estimated and , if all elements of are to be taken as zero.Constraint: or .
- par
- Type: array<System..::..Double>[]()[][]An array of size [lpar]On entry: must contain the parameter estimates read in row by row in the order , , .Thus,
- if , must be set equal to an estimate of the th element of , for , and ;
- if , must be set equal to an estimate of the th element of , for , and ;
- if , must be set equal to an estimate of the th component of , for .
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, k]Note: dim1 must satisfy the constraint:On entry: must contain an estimate of the th element of . The lower triangle only is needed.Constraint: must be positive definite.On exit: if , then the upper triangle is set equal to the lower triangle.
- v
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, dim2]Note: dim1 must satisfy the constraint:Note: the second dimension of the array v must be at least , where .On entry: must contain an estimate of the th component of , for and .If , v is not used.
- lmax
- Type: System..::..Int32On entry: the number, , of forecasts required.Constraint: .
- predz
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, lmax]Note: dim1 must satisfy the constraint:On exit: contains the forecast of , for and .
- sefz
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, lmax]Note: dim1 must satisfy the constraint:On exit: contains an estimate of the standard error of the forecast of , for and .
- dnref
- Type: array<System..::..Double>[]()[][]An array of size [lref]On exit: the reference vector which may be used to update forecasts using g13dk. The first elements contain the weight matrices, . The next elements contain the forecasts of the transformed series and the next contain the variances of the forecasts of the transformed variables. The last k elements are used to store the transformations for the series.
- ifail
- Type: System..::..Int32%On exit: unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).
Description
Let the vector , for , denote a -dimensional time series for which forecasts of are required. Let be defined as follows:
where is the differencing operator applied to the th series and where is equal to either , or depending on whether or not a transformation was required to stabilize the variance before fitting the model.
If the order of differencing required for the th series is , then the differencing operator for the th series is defined by where is the backward shift operator; that is, . The differencing parameters , for and , must be supplied by you. If the th series does not require differencing, then .
is assumed to follow a multivariate ARMA model of the form:
where , for , is a vector of residual series assumed to be Normally distributed with zero mean and positive definite covariance matrix . The components of are assumed to be uncorrelated at non-simultaneous lags. The and are by matrices of parameters. The matrices , for , are the autoregressive (AR) parameter matrices, and the matrices , for , the moving average (MA) parameter matrices. The parameters in the model are thus the ( by ) -matrices, the ( by ) -matrices, the mean vector and the residual error covariance matrix . The ARMA model (1) must be both stationary and invertible; see g13dx for a method of checking these conditions.
(1) |
The ARMA model (1) may be rewritten as
where and are the autoregressive and moving average polynomials and denotes the by diagonal matrix whose th diagonal elements is and
.
This may be rewritten as
or
where and is a vector of length .
Forecasts are computed using a multivariate version of the procedure described in Box and Jenkins (1976). If denotes the forecast of , then is taken to be that linear function of which minimizes the elements of where is the forecast error. is referred to as the linear minimum mean square error forecast of .
The linear predictor which minimizes the mean square error may be expressed as
The forecast error at for lead is then
Let , for . Unless the method requires estimates of , for , which are obtainable from
g13dd.
The terms are assumed to be zero, for . You may use g13dk to update these forecasts should further observations, , become available. Note that when or more further observations are available then g13dj must be used to produce new forecasts for , should they be required.
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).
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
Error Indicators and Warnings
Errors or warnings detected by the method:
Some error messages may refer to parameters that are dropped from this interface
(KMAX) In these
cases, an error in another parameter has usually caused an incorrect value to be inferred.
On entry, , or , or for some , or for some , or , or , or or , or , and , or and , or , and , or and , or , or , or lwork is too small, or liwork is too small.
On entry, at least one of the first elements of tr is not equal to "N", "L" or "S".
- On entry, one or more of the transformations requested cannot be computed; that is, you may be trying to log or square-root a series, some of whose values are negative.
- On entry, either qq is not positive definite or the autoregressive parameter matrices are extremely close to or outside the stationarity region, or the moving average parameter matrices are extremely close to or outside the invertibility region. To proceed, you must supply different parameter estimates in the arrays par and qq.
- This is an unlikely exit brought about by an excessive number of iterations being needed to evaluate the eigenvalues of the matrices required to check for stationarity and invertibility; see g13dx. All output parameters are undefined.
- This is an unlikely exit. For one of the series, overflow will occur if the forecasts are computed. You should check whether the transformations requested in the array tr are sensible. All output parameters are undefined.
Accuracy
The matrix computations are believed to be stable.
Parallelism and Performance
None.
Further Comments
The same differencing operator does not have to be applied to all the series. For example, suppose we have , and wish to apply the second order differencing operator to the first series and the first-order differencing operator to the second series:
Then , , and
Note: although differencing may already have been applied prior to the model fitting stage, the differencing parameters supplied in delta are part of the model definition and are still required by this method to produce the forecasts.