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:
  
      – const doubleInput
- 
On entry: the  values of the  series. 
- 2:
  
      – const doubleInput
- 
On entry: the  values of the  series. 
- 3:
  
      – IntegerInput
- 
On entry: , the length of the time series. Constraint:
  .
 
- 4:
  
      – IntegerInput
- 
On entry: , the maximum lag for calculating cross-correlations. Constraint:
  .
 
- 5:
  
      – double *Output
- 
On exit: the ratio of the standard deviation of the  series to the standard deviation of the  series, . 
- 6:
  
      – double *Output
- 
On exit: the cross-correlation between the  and  series at lag zero. 
- 7:
  
      – doubleOutput
- 
On exit:  contains the cross-correlations between the  and  series at lags , , for . 
- 8:
  
      – double *Output
- 
On exit: the statistic for testing for absence of cross-correlation. 
- 9:
  
      – NagError *Input/Output
- 
The NAG error argument (see  Section 3.7 in How to Use the NAG Library and its Documentation). 
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 function. Please also consult the 
Users' Note for your implementation for any additional implementation-specific information.