NAG C Library Function Document
nag_tsa_multi_diff (g13dlc)
1
Purpose
nag_tsa_multi_diff (g13dlc) differences and/or transforms a multivariate time series.
2
Specification
#include <nag.h> |
#include <nagg13.h> |
void |
nag_tsa_multi_diff (Integer k,
Integer n,
const double z[],
const Integer tr[],
const Integer id[],
const double delta[],
double w[],
Integer *nd,
NagError *fail) |
|
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 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
.
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:
– IntegerInput
-
On entry: , the dimension of the multivariate time series.
Constraint:
.
- 2:
– IntegerInput
-
On entry: , the number of observations in the series, prior to differencing.
Constraint:
.
- 3:
– const doubleInput
-
On entry: must contain the th series at time , for and .
- 4:
– 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:
– const IntegerInput
-
On entry: the order of differencing for each series, .
Constraint:
, for .
- 6:
– 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:
– doubleOutput
-
Note: the dimension,
dim, of the array
w
must be at least
, where
.
On exit: contains the value of , for and .
- 8:
– Integer *Output
-
On exit: the number of differenced values, , in the series, where .
- 9:
– NagError *Input/Output
-
The NAG error argument (see
Section 3.7 in How to Use the NAG Library and its Documentation).
6
Error Indicators and Warnings
- NE_ALLOC_FAIL
-
Dynamic memory allocation failed.
See
Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
- 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: .
On entry, , and .
Constraint: or .
On entry, .
Constraint: , or .
- 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.
See
Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
- NE_NO_LICENCE
-
Your licence key may have expired or may not have been installed correctly.
See
Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
- NE_TRANSFORMATION
-
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.
7
Accuracy
The computations are believed to be stable.
8
Parallelism and Performance
nag_tsa_multi_diff (g13dlc) 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 function. 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
Program Text (g13dlce.c)
10.2
Program Data
Program Data (g13dlce.d)
10.3
Program Results
Program Results (g13dlce.r)