nag_tsa_cross_corr (g13bcc) calculates cross-correlations between two time series.
Given two series
and
the function 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] – const doubleInput
On entry: the values of the series.
- 2:
y[nxy] – const doubleInput
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 – double *Output
On exit: the ratio of the standard deviation of the series to the standard deviation of the series, .
- 6:
r0 – double *Output
On exit: the cross-correlation between the and series at lag zero.
- 7:
r[nl] – doubleOutput
On exit: contains the cross-correlations between the and series at lags , , for .
- 8:
stat – double *Output
On exit: the statistic for testing for absence of cross-correlation.
- 9:
fail – NagError *Input/Output
-
The NAG error argument (see
Section 3.6 in the Essential Introduction).
All computations are believed to be stable.
Not applicable.