autocovar

autocovar(dt, z, axis=0, **kwargs)[source]

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

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

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

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

  • lag (float, optional) – Return autocovariance 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 autocovariance 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 autocovariance as a function of lag.

Notes

This function uses the following formula to estimate autocovariance 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.