Given two series
${x}_{1},{x}_{2},\dots ,{x}_{n}$ and
${y}_{1},{y}_{2},\dots ,{y}_{n}$ the routine calculates the crosscorrelations between
${x}_{t}$ and lagged values of
${y}_{t}$:
where
and similarly for
$y$.
The ratio of standard deviations
${s}_{y}/{s}_{x}$ is also returned, and a portmanteau statistic is calculated:
Provided
$n$ is large,
$L$ much less than
$n$, and both
${x}_{t},{y}_{t}$ are samples of series whose true autocorrelation functions are zero, then, under the null hypothesis that the true crosscorrelations between the series are zero,
stat has a
${\chi}^{2}$distribution with
$L$ degrees of freedom. Values of
stat in the upper tail of this distribution provide evidence against the null hypothesis.
 1: $\mathbf{x}\left({\mathbf{nxy}}\right)$ – Real (Kind=nag_wp) arrayInput

On entry: the $n$ values of the $x$ series.
 2: $\mathbf{y}\left({\mathbf{nxy}}\right)$ – Real (Kind=nag_wp) arrayInput

On entry: the $n$ values of the $y$ series.
 3: $\mathbf{nxy}$ – IntegerInput

On entry: $n$, the length of the time series.
Constraint:
${\mathbf{nxy}}\ge 2$.
 4: $\mathbf{nl}$ – IntegerInput

On entry: $L$, the maximum lag for calculating crosscorrelations.
Constraint:
$1\le {\mathbf{nl}}<{\mathbf{nxy}}$.
 5: $\mathbf{s}$ – Real (Kind=nag_wp)Output

On exit: the ratio of the standard deviation of the $y$ series to the standard deviation of the $x$ series, ${s}_{y}/{s}_{x}$.
 6: $\mathbf{r0}$ – Real (Kind=nag_wp)Output

On exit: the crosscorrelation between the $x$ and $y$ series at lag zero.
 7: $\mathbf{r}\left({\mathbf{nl}}\right)$ – Real (Kind=nag_wp) arrayOutput

On exit: ${\mathbf{r}}\left(\mathit{l}\right)$ contains the crosscorrelations between the $x$ and $y$ series at lags $L$, ${r}_{xy}\left(\mathit{l}\right)$, for $\mathit{l}=1,2,\dots ,L$.
 8: $\mathbf{stat}$ – Real (Kind=nag_wp)Output

On exit: the statistic for testing for absence of crosscorrelation.
 9: $\mathbf{ifail}$ – IntegerInput/Output

On entry:
ifail must be set to
$0$,
$1\text{ or}1$. If you are unfamiliar with this argument you should refer to
Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
$1\text{ or}1$ is recommended. If the output of error messages is undesirable, then the value
$1$ is recommended. Otherwise, if you are not familiar with this argument, the recommended value is
$0$.
When the value $\mathbf{1}\text{ or}\mathbf{1}$ is used it is essential to test the value of ifail on exit.
On exit:
${\mathbf{ifail}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see
Section 6).
If on entry
${\mathbf{ifail}}=0$ or
$1$, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
All computations are believed to be stable.
Please consult the
X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the
Users' Note for your implementation for any additional implementationspecific information.