naginterfaces.library.tsa.multi_xcorr¶
- naginterfaces.library.tsa.multi_xcorr(x, y, nl)[source]¶
multi_xcorr
calculates cross-correlations between two time series.For full information please refer to the NAG Library document for g13bc
https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/g13/g13bcf.html
- Parameters
- xfloat, array-like, shape
The values of the series.
- yfloat, array-like, shape
The values of the series.
- nlint
, the maximum lag for calculating cross-correlations.
- Returns
- sfloat
The ratio of the standard deviation of the series to the standard deviation of the series, .
- r0float
The cross-correlation between the and series at lag zero.
- rfloat, ndarray, shape
contains the cross-correlations between the and series at lags , , for .
- statfloat
The statistic for testing for absence of cross-correlation.
- Raises
- NagValueError
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, and .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
One or both of the and series have zero variance.
- Notes
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, has a -distribution with degrees of freedom. Values of in the upper tail of this distribution provide evidence against the null hypothesis.
- References
Box, G E P and Jenkins, G M, 1976, Time Series Analysis: Forecasting and Control, (Revised Edition), Holden–Day