esmtools.stats.autocorr

esmtools.stats.autocorr(ds, dim='time', nlags=None)[source]

Compute the autocorrelation function of a time series to a specific lag.

Note

The correlation coefficients presented here are from the lagged cross correlation of ds with itself. This means that the correlation coefficients are normalized by the variance contained in the sub-series of x. This is opposed to a true ACF, which uses the entire series’ to compute the variance. See https://stackoverflow.com/questions/36038927/ whats-the-difference-between-pandas-acf-and-statsmodel-acf

Parameters:
  • ds (xarray object) – Dataset or DataArray containing the time series.
  • dim (str, optional) – Dimension to apply autocorr over. Defaults to ‘time’.
  • nlags (int, optional) – Number of lags to compute ACF over. If None, compute for length of dim on ds.
Returns:

Dataset or DataArray with ACF results.