# naginterfaces.library.tsa.multi_​gain_​bivar¶

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

For a bivariate time series, multi_gain_bivar calculates the gain and phase together with lower and upper bounds from the univariate and bivariate spectra.

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

https://www.nag.com/numeric/nl/nagdoc_27.1/flhtml/g13/g13cff.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 holds the bandwidth.

Returns
gnfloat, ndarray, shape

The gain estimates, , at each frequency .

gnlwfloat, ndarray, shape

The lower bounds for the gain estimates.

gnupfloat, ndarray, shape

The upper bounds for the gain estimates.

phfloat, ndarray, shape

The phase estimates, , at each frequency .

phlwfloat, ndarray, shape

The lower bounds for the phase estimates.

phupfloat, ndarray, shape

The upper bounds for the phase estimates.

Raises
NagValueError
(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

In the NAG Library the traditional C interface for this routine uses a different algorithmic base. Please contact NAG if you have any questions about compatibility.

Estimates of the gain and phase of the dependency of series on series at frequency are given by

The quantities used in these definitions are obtained as in Notes for multi_spectrum_bivar.

Confidence limits are returned for both gain and phase, but should again be taken as very approximate when the coherency , as calculated by multi_spectrum_bivar(), is not significant. These are based on the assumption that both and are Normal with variance

Although the estimate of is always given in the range , no attempt is made to restrict its confidence limits to this range.

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