NAG Library Routine Document
G13DLF differences and/or transforms a multivariate time series.
It is intended to be used prior to G13DDF
to fit a vector autoregressive moving average (VARMA) model to the differenced/transformed series.
|SUBROUTINE G13DLF (
||K, N, Z, KMAX, TR, ID, DELTA, W, ND, WORK, IFAIL)
||K, N, KMAX, ID(K), ND, IFAIL
||Z(KMAX,N), DELTA(KMAX,*), W(KMAX,*), WORK(K*N)
For certain time series it may first be necessary to difference the original data to obtain a stationary series before calculating autocorrelations, etc. This routine also allows you to apply either a square root or a log transformation to the original time series to stabilize the variance if required.
If the order of differencing required for the
th series is
, then the differencing operator is defined by
is the backward shift operator; that is,
denote the maximum of the orders of differencing,
, over the
series. The routine computes values of the differenced/transformed series
, as follows:
are the transformed values of the original
-dimensional time series
The differencing parameters , for and , must be supplied by you. If the th series does not require differencing, then .
Box G E P and Jenkins G M (1976) Time Series Analysis: Forecasting and Control (Revised Edition) Holden–Day
Wei W W S (1990) Time Series Analysis: Univariate and Multivariate Methods Addison–Wesley
- 1: K – INTEGERInput
On entry: , the dimension of the multivariate time series.
- 2: N – INTEGERInput
On entry: , the number of observations in the series, prior to differencing.
- 3: Z(KMAX,N) – REAL (KIND=nag_wp) arrayInput
On entry: must contain, , the th component of , for and .
- if , ;
- if , , for and .
- 4: KMAX – INTEGERInput
: the first dimension of the arrays Z
as declared in the (sub)program from which G13DLF is called.
- 5: TR(K) – CHARACTER(1) arrayInput
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.
, or , for .
- 6: ID(K) – INTEGER arrayInput
On entry: the order of differencing for each series, .
, for .
- 7: DELTA(KMAX,) – REAL (KIND=nag_wp) arrayInput
the second dimension of the array DELTA
must be at least
must be set equal to
, then DELTA
is not referenced.
- 8: W(KMAX,) – REAL (KIND=nag_wp) arrayOutput
the second dimension of the array W
must be at least
On exit: contains the value of , for and .
- 9: ND – INTEGEROutput
On exit: the number of differenced values, , in the series, where .
- 10: WORK() – REAL (KIND=nag_wp) arrayWorkspace
- 11: IFAIL – INTEGERInput/Output
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.
unless the routine detects an error or a warning has been flagged (see Section 6
6 Error Indicators and Warnings
If on entry
, explanatory error messages are output on the current error message unit (as defined by X04AAF
Errors or warnings detected by the routine:
|On entry,||, for some ,|
|or||, for some .|
|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 elements of Z
is invalid, for the transformation requested; that is, you may be trying to log or square root a series, some of whose values are negative.
The computations are believed to be stable.
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:
A program to difference (non-seasonally) each of two time series of length . No transformation is to be applied to either of the series.
9.1 Program Text
Program Text (g13dlfe.f90)
9.2 Program Data
Program Data (g13dlfe.d)
9.3 Program Results
Program Results (g13dlfe.r)