pyhctsa.operations.correlation.nonlinear_autocorr

pyhctsa.operations.correlation.nonlinear_autocorr(y, taus, absval=None)

Compute a custom nonlinear autocorrelation of a time series.

Nonlinear autocorrelations generalize the usual (two-point) autocorrelation to higher-order products evaluated at multiple lags. In general,

\[\left\langle \prod_{k=0}^{m} x_{i-\tau_k} \right\rangle,\]

where \(\langle \cdot \rangle\) denotes the time average. The usual two-point autocorrelation is recovered when \(m=1\) with \(\tau_0 = 0\) and \(\tau_1 = \tau\):

\[\langle x_i\, x_{i-\tau} \rangle.\]
Parameters:
y : array-like

The z-scored input time series (1D array).

taus : array-like of int

Vector of time delays (lags) \(\{\tau_k\}\) defining the product.

Examples:

  • [2] computes \(\langle x_i\, x_{i-2} \rangle\).

  • [1, 2] computes \(\langle x_i\, x_{i-1}\, x_{i-2} \rangle\).

  • [1, 1, 3] computes \(\langle x_i\, x_{i-1}^2\, x_{i-3} \rangle\).

  • [0, 0, 1] computes \(\langle x_i^3\, x_{i-1} \rangle\).

absval : bool or None, optional

Whether to apply an absolute value before the final mean.

  • If True, takes the absolute value before averaging (often useful when

the product has an even number of terms). - If None (default), sets absval=True when len(taus) is even and absval=False when len(taus) is odd.

Returns:

The computed nonlinear autocorrelation.

Return type:

float