nag_tsa_multi_diff (g13dl) differences and/or transforms a multivariate time series.
It is intended to be used prior to
nag_tsa_multi_varma_estimate (g13dd) to fit a vector autoregressive moving average (VARMA) model to the differenced/transformed 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
.
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
function g13dl_example
fprintf('g13dl example results\n\n');
z = [-1.49, -1.62, 5.20, 6.23, 6.21, 5.86, 4.09, 3.18, 2.62, 1.49, 1.17, ...
0.85, -0.35, 0.24, 2.44, 2.58, 2.04, 0.40, 2.26, 3.34, 5.09, 5.00, ...
4.78, 4.11, 3.45, 1.65, 1.29, 4.09, 6.32, 7.50, 3.89, 1.58, 5.21, ...
5.25, 4.93, 7.38, 5.87, 5.81, 9.68, 9.07, 7.29, 7.84, 7.55, 7.32, ...
7.97, 7.76, 7.00, 8.35;
7.34, 6.35, 6.96, 8.54, 6.62, 4.97, 4.55, 4.81, 4.75, 4.76,10.88, ...
10.01, 11.62,10.36, 6.40, 6.24, 7.93, 4.04, 3.73, 5.60, 5.35, 6.81, ...
8.27, 7.68, 6.65, 6.08,10.25, 9.14,17.75,13.30, 9.63, 6.80, 4.08, ...
5.06, 4.94, 6.65, 7.94,10.76,11.89, 5.85, 9.01, 7.50,10.02,10.38, ...
8.15, 8.37, 10.73, 12.14];
tr = {'N'; 'N'};
id = [int64(1);1];
delta = [1; 1];
[w, nd, ifail] = g13dl( ...
z, tr, id, delta);
fprintf('Transformed/Differenced series\n');
fprintf('------------------------------\n');
for i = 1:2
fprintf('\nSeries %2d\n',i);
fprintf('-----------\n\n');
fprintf('Number of differenced values = %5d\n\n',nd);
fprintf('%9.3f%9.3f%9.3f%9.3f%9.3f%9.3f%9.3f%9.3f\n',w(i,:));
fprintf('\n');
end