naginterfaces.library.tsa.multi_​spectrum_​bivar¶

naginterfaces.library.tsa.multi_spectrum_bivar(xg, yg, xyrg, xyig, stats)[source]

For a bivariate time series, multi_spectrum_bivar calculates the cross amplitude spectrum and squared coherency, together with lower and upper bounds from the univariate and bivariate (cross) spectra.

For full information please refer to the NAG Library document for g13ce

https://www.nag.com/numeric/nl/nagdoc_27.3/flhtml/g13/g13cef.html

Parameters
xgfloat, array-like, shape

The univariate spectral estimates, , for the series.

ygfloat, array-like, shape

The univariate spectral estimates, , for the series.

xyrgfloat, array-like, shape

The real parts, , of the bivariate spectral estimates for the and series. The series leads the series.

xyigfloat, array-like, shape

The imaginary parts, , of the bivariate spectral estimates for the and series. The series leads the series.

Note: the two univariate and the bivariate spectra must each have been calculated using the same method of smoothing.

For rectangular, Bartlett, Tukey or Parzen smoothing windows, the same cut-off point of lag window and the same frequency division of the spectral estimates must be used.

For the trapezium frequency smoothing window, the frequency width and the shape of the window and the frequency division of the spectral estimates must be the same.

The spectral estimates and statistics must also be unlogged.

statsfloat, array-like, shape

The four associated statistics for the univariate spectral estimates for the and series. contains the degrees of freedom, and contain the lower and upper bound multiplying factors respectively and contains the bandwidth.

Returns
cafloat, ndarray, shape

The cross amplitude spectral estimates at each frequency of .

calwfloat, ndarray, shape

The lower bounds for the cross amplitude spectral estimates.

caupfloat, ndarray, shape

The upper bounds for the cross amplitude spectral estimates.

tfloat

The critical value for the significance of the squared coherency, .

scfloat, ndarray, shape

The squared coherency estimates, at each frequency .

sclwfloat, ndarray, shape

The lower bounds for the squared coherency estimates.

scupfloat, ndarray, shape

The upper bounds for the squared coherency estimates.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

Warns
NagAlgorithmicWarning
(errno )

A bivariate spectral estimate is zero.

(errno )

A univariate spectral estimate is negative.

(errno )

A univariate spectral estimate is zero.

(errno )

A calculated value of the squared coherency exceeds .

Notes

Estimates of the cross amplitude spectrum and squared coherency are calculated for each frequency as

where

and are the co-spectrum and quadrature spectrum estimates between the series, i.e., the real and imaginary parts of the cross spectrum as obtained using multi_spectrum_lag() or multi_spectrum_daniell();

and are the univariate spectrum estimates for the two series as obtained using uni_spectrum_lag() or uni_spectrum_daniell().

The same type and amount of smoothing should be used for these estimates, and this is specified by the degrees of freedom and bandwidth values which are passed from the calls of uni_spectrum_lag() or uni_spectrum_daniell().

Upper and lower confidence limits for the cross amplitude are given approximately by

except that a negative lower limit is reset to , in which case the approximation is rather poor. You are, therefore, particularly recommended to compare the coherency estimate with the critical value derived from the upper point of the -distribution on degrees of freedom:

where is the degrees of freedom associated with the univariate spectrum estimates. The value of is returned by the function.

The hypothesis that the series are unrelated at frequency , i.e., that both the true cross amplitude and coherency are zero, may be rejected at the level if . Tests at two frequencies separated by more than the bandwidth may be taken to be independent.

The confidence limits on are strictly appropriate only at frequencies for which the coherency is significant. The same applies to the confidence limits on which are however calculated at all frequencies using the approximation that is Normal with variance .

References

Bloomfield, P, 1976, Fourier Analysis of Time Series: An Introduction, Wiley

Jenkins, G M and Watts, D G, 1968, Spectral Analysis and its Applications, Holden–Day