G13BCF calculates cross-correlations between two time series.
Given two series
and
the routine calculates the cross-correlations between
and lagged values of
:
where
and similarly for
.
The ratio of standard deviations
is also returned, and a portmanteau statistic is calculated:
Provided
is large,
much less than
, and both
are samples of series whose true autocorrelation functions are zero, then, under the null hypothesis that the true cross-correlations between the series are zero,
STAT has a
-distribution with
degrees of freedom. Values of
STAT in the upper tail of this distribution provide evidence against the null hypothesis.
- 1: X(NXY) – REAL (KIND=nag_wp) arrayInput
On entry: the values of the series.
- 2: Y(NXY) – REAL (KIND=nag_wp) arrayInput
On entry: the values of the series.
- 3: NXY – INTEGERInput
On entry: , the length of the time series.
Constraint:
.
- 4: NL – INTEGERInput
On entry: , the maximum lag for calculating cross-correlations.
Constraint:
.
- 5: S – REAL (KIND=nag_wp)Output
On exit: the ratio of the standard deviation of the series to the standard deviation of the series, .
- 6: R0 – REAL (KIND=nag_wp)Output
On exit: the cross-correlation between the and series at lag zero.
- 7: R(NL) – REAL (KIND=nag_wp) arrayOutput
On exit: contains the cross-correlations between the and series at lags , , for .
- 8: STAT – REAL (KIND=nag_wp)Output
On exit: the statistic for testing for absence of cross-correlation.
- 9: IFAIL – INTEGERInput/Output
-
On entry:
IFAIL 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.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
All computations are believed to be stable.