naginterfaces.library.tsa.multi_varma_forecast¶
- naginterfaces.library.tsa.multi_varma_forecast(z, tr, dord, delta, ip, iq, mean, par, qq, v, lmax, lref)[source]¶
multi_varma_forecast
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 usingmulti_varma_estimate()
. 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 callingmulti_varma_update()
.For full information please refer to the NAG Library document for g13dj
https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/g13/g13djf.html
- Parameters
- zfloat, array-like, shape
must contain, , the th component of , for , for .
- trstr, length 1, array-like, shape
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.
- dordint, array-like, shape
must specify, , the order of differencing required for the th series.
- deltafloat, array-like, shape
If , then must be set equal to , for , for .
If , is not referenced.
- ipint
, the number of AR parameter matrices.
- iqint
, the number of MA parameter matrices.
- meanstr, length 1
, if components of have been estimated and , if all elements of are to be taken as zero.
- parfloat, array-like, shape
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 , for , for ;
if , must be set equal to an estimate of the th element of , for , for , for ;
if , must be set equal to an estimate of the th component of , for .
- qqfloat, array-like, shape
must contain an estimate of the th element of . The lower triangle only is needed.
- vfloat, array-like, shape
must contain an estimate of the th component of , for , for .
If , is not used.
- lmaxint
The number, , of forecasts required.
- lrefint
The dimension of the array .
- Returns
- qqfloat, ndarray, shape
If != 1, then the upper triangle is set equal to the lower triangle.
- predzfloat, ndarray, shape
contains the forecast of , for , for .
- sefzfloat, ndarray, shape
contains an estimate of the standard error of the forecast of , for , for .
- reffloat, ndarray, shape
The reference vector which may be used to update forecasts using
multi_varma_update()
. 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 elements are used to store the transformations for the series.
- Raises
- NagValueError
- (errno )
On entry, and the minimum size .
Constraint: .
- (errno )
On entry, , and .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, number of observations and number of parameters .
Constraint: number of of parameters.
- (errno )
On entry, is too small: and the minimum size .
- (errno )
On entry, is an invalid character.
Constraint: or .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, and is invalid.
Constraint: , or .
- (errno )
On entry, one (or more) of the transformations requested is invalid.
- (errno )
On entry, the MA parameter matrices are outside the invertibility region.
- (errno )
On entry, the AR parameter matrices are outside the stationarity region.
- (errno )
On entry, the covariance matrix is not positive definite.
- (errno )
An excessive number of iterations were needed to evaluate the eigenvalues of the matrices used to test for stationarity and invertibility.
- (errno )
The covariance matrix may be nearly non-positive definite.
- (errno )
The forecasts will overflow if computed.
- Notes
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 , for , 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 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 () -matrices, the () -matrices, the mean vector and the residual error covariance matrix . The ARMA model (1) must be both stationary and invertible; see
uni_arma_roots()
for a method of checking these conditions.The ARMA model (1) may be rewritten as
where and are the autoregressive and moving average polynomials and denotes the 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 function requires estimates of , for , which are obtainable from
multi_varma_estimate()
. The terms are assumed to be zero, for . You may usemulti_varma_update()
to update these forecasts should further observations, , become available. Note that when or more further observations are available thenmulti_varma_forecast
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