NAG FL Interface
g13dlf (multi_diff)
1
Purpose
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.
2
Specification
Fortran Interface
Subroutine g13dlf ( |
k, n, z, kmax, tr, id, delta, w, nd, work, ifail) |
Integer, Intent (In) |
:: |
k, n, kmax, id(k) |
Integer, Intent (Inout) |
:: |
ifail |
Integer, Intent (Out) |
:: |
nd |
Real (Kind=nag_wp), Intent (In) |
:: |
z(kmax,n), delta(kmax,*) |
Real (Kind=nag_wp), Intent (Inout) |
:: |
w(kmax,*) |
Real (Kind=nag_wp), Intent (Out) |
:: |
work(k*n) |
Character (1), Intent (In) |
:: |
tr(k) |
|
C Header Interface
#include <nag.h>
void |
g13dlf_ (const Integer *k, const Integer *n, const double z[], const Integer *kmax, const char tr[], const Integer id[], const double delta[], double w[], Integer *nd, double work[], Integer *ifail, const Charlen length_tr) |
|
C++ Header Interface
#include <nag.h> extern "C" {
void |
g13dlf_ (const Integer &k, const Integer &n, const double z[], const Integer &kmax, const char tr[], const Integer id[], const double delta[], double w[], Integer &nd, double work[], Integer &ifail, const Charlen length_tr) |
}
|
The routine may be called by the names g13dlf or nagf_tsa_multi_diff.
3
Description
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
, where
is the backward shift operator; that is,
. Let
denote the maximum of the orders of differencing,
, over the
series. The routine computes values of the differenced/transformed series
, for
, as follows:
where
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 .
4
References
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
5
Arguments
-
1:
– Integer
Input
-
On entry: , the dimension of the multivariate time series.
Constraint:
.
-
2:
– Integer
Input
-
On entry: , the number of observations in the series, prior to differencing.
Constraint:
.
-
3:
– Real (Kind=nag_wp) array
Input
-
On entry: must contain, , the th component of , for and .
Constraints:
- if , ;
- if ,
, for and .
-
4:
– Integer
Input
-
On entry: the first dimension of the arrays
z,
delta and
w as declared in the (sub)program from which
g13dlf is called.
Constraint:
.
-
5:
– Character(1) array
Input
-
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 .
-
6:
– Integer array
Input
-
On entry: the order of differencing for each series, .
Constraint:
, for .
-
7:
– Real (Kind=nag_wp) array
Input
-
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.
-
8:
– Real (Kind=nag_wp) array
Output
-
Note: the second dimension of the array
w
must be at least
, where
.
On exit: contains the value of , for and .
-
9:
– Integer
Output
-
On exit: the number of differenced values, , in the series, where .
-
10:
– Real (Kind=nag_wp) array
Workspace
-
-
11:
– 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 .
Constraint: .
On entry, and .
Constraint: .
-
On entry, and is invalid.
Constraint: , or .
-
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.
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 computations are believed to be stable.
8
Parallelism and Performance
g13dlf 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.
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
10
Example
A program to difference (non-seasonally) each of two time series of length . No transformation is to be applied to either of the series.
10.1
Program Text
10.2
Program Data
10.3
Program Results