nag_tsa_multi_diff (g13dlc) differences and/or transforms a multivariate time series.
For certain time series it may first be necessary to difference the original data to obtain a stationary series before calculating autocorrelations, etc. This function 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 function computes values of the differenced/transformed series
, for
, as follows:
where
are the transformed values of the original
-dimensional time series
.
- 1:
k – IntegerInput
-
On entry:
, the dimension of the multivariate time series.
Constraint:
.
- 2:
n – IntegerInput
On entry:
, the number of observations in the series, prior to differencing.
Constraint:
.
- 3:
z[] – const doubleInput
-
On entry: must contain the th series at time , for and .
- 4:
tr[k] – const IntegerInput
On entry:
indicates whether the
th series is to be transformed, for
.
- A square root transformation is used.
- No transformation is used.
- A log transformation is used.
Constraint:
, or , for .
- 5:
id[k] – const IntegerInput
On entry: the order of differencing for each series, .
Constraint:
, for .
- 6:
delta[] – const doubleInput
-
Note: the dimension,
dim, of the array
delta
must be at least
, where
.
On entry: if then must be set to , for and .
- 7:
w[] – doubleOutput
-
Note: the dimension,
dim, of the array
w
must be at least
, where
.
On exit: contains the value of , for and .
- 8:
nd – Integer *Output
On exit: the number of differenced values, , in the series, where .
- 9:
fail – NagError *Input/Output
-
The NAG error argument (see
Section 3.6 in the Essential Introduction).
- NE_ALLOC_FAIL
Dynamic memory allocation failed.
- NE_BAD_PARAM
On entry, argument had an illegal value.
- NE_INT
On entry, .
Constraint: .
On entry, .
Constraint: .
- NE_INT_ARRAY
On entry, , and .
Constraint: , for .
On entry, and .
Constraint: , or , for .
- NE_INT_ARRAY_ELEM_CONS
On entry, element
of
id is greater than or equal to
n.
On entry, element
of
id is less than zero.
- 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.
- NE_TRANSFORMATION
On entry, one (or more) of the transformations requested is invalid.
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:
Then
,
, and