covar

covar(dt, z1, z2, axis=0, **kwargs)[source]

Return the covariance spectrum at a single lag or successive lags. Default behavior returns the lag-0 covariance.

Parameters
  • dt (float or array-like, optional) – The timestep or time series (from which the timestep is inferred).

  • z1 (array-like) – The input data.

  • z2 (array-like, optional) – The second input data. Must be same shape as z1.

  • axis (int, optional) – Axis along which covariance is taken.

  • lag (float, optional) – Return covariance for the single lag lag (must be divisible by dt).

  • ilag (int, optional) – As with lag but specifies the index instead of the physical time.

  • maxlag (float, optional) – Return lagged covariance up to the lag maxlag (must be divisible by dt).

  • imaxlag (int, optional) – As with maxlag but specifies the index instead of the physical time.

Returns

  • lags (array-like) – The lags.

  • result (array-like) – The covariance as a function of lag.

Notes

This function uses the following formula to estimate covariance at lag \(k\):

\[\dfrac{% \sum_{i=0}^{n-k} \left(x_t - \overline{x}\right) \left(y_{t+k} - \overline{y}\right) }{% n - k }\]

where \(\overline{x}\) and \(\overline{y}\) are the sample means.