# Nonlinear autocorrelation

## `trev`

**Naming info**: This matches the *hctsa* feature `CO_trev_1_num`

`trev` computes computes the average across the time series of the cube of successive time-series differences. It will be close to zero for time series for which the distribution of successive decreases in the time series matches the distribution of successive increases, but will be positive if increases tend to be larger in magnitude and negative if decreases tend to be larger in magnitude.

It is computed as:

$$
\langle (x\_{i+1} - x\_i)^3\rangle\_t,,
$$

for time-series values, *x*, averaged across all possible time point&#x73;*, t* (i.e., from index 1 to N-1, for a time series of length *N*).

It is based on a statistic used in nonlinear time-series analysis, cf. [Surrogate time series](https://doi.org/10.1016/S0167-2789\(00\)00043-9), Schreiber and Schmitz, *Physica D*, **142:** 346 (2000).

The original *hctsa* implementation is the code `CO_trev(x_z,1)` , for a *z*-scored time series, `x_z`.

For example, this Chua map time series has increments that are approximately symmetric (blue histogram), as are the cubic increments (orange histogram), and so this statistic has a value (the mean of the orange distribution) of approximately zero.

![](https://923954068-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MfHFY4lvzOz3IPaA3wm%2F-Mfl6bRDSx8zruWzAOZy%2F-Mfl9YMHrDI2l_ZflS7o%2Fimage.png?alt=media\&token=4c01c8f8-595b-4f99-9944-66b35b9eaeab)

This simple flow has a multi-modal distribution of successive increments (blue), with an asymmetry towards larger increases compared to smaller decreases. This is accentuated after taking a cube (orange), yielding a positive value of this statistic:

![](https://923954068-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MfHFY4lvzOz3IPaA3wm%2F-Mfl9jstSGYWbU-LBvfs%2F-Mfl9xcqQ2cCZ-8U2jzC%2Fimage.png?alt=media\&token=4deaea55-b945-4f28-9af7-36ec39e88814)

This Lozi map is an example of the opposite behavior: time-series decreases can be sudden and large in magnitude, whereas increases are relatively gradual. This leads to an asymmetry towards large negative values, leading to a negative value for this statistic.

![](https://923954068-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MfHFY4lvzOz3IPaA3wm%2F-Mfl9jstSGYWbU-LBvfs%2F-MflA_TyGRhHegXyIN7Q%2Fimage.png?alt=media\&token=1a615dab-4844-456c-abe6-5691cbdd3555)

## `ami2`

**Naming info**: Original name matched an earlier *hctsa* name `CO_HistogramAMI_even_2_5` but this feature has since been renamed in current *hctsa* library to more clearly describe the binning, as `CO_HistogramAMI_even_5bin_ami2`

`ami2` is a nonlinear version of the autocorrelation function: using a nonlinear correlation metric (mutual information) instead of a conventional linear correlation metric, evaluated using a histogram with 5 bins and at a time delay *τ* = 2 (from the *hctsa* code `CO_HistogramAMI(x_z,2,'even',5)`).

This feature gives high values to time series like this Chaotic Web map:

![](https://923954068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfHFY4lvzOz3IPaA3wm%2Fuploads%2FUSMOuPBQm2kszyrXleUB%2Fimage.png?alt=media\&token=8a750554-1b64-4c5a-a37f-7ca5940538fc)

, which has clear dependence structure of the time-series value at the current point, $$x\_t$$, and the value two time points ahead, $$x\_{t+2}$$*,* yielding a high value for this feature of 1.25:

&#x20;![](https://923954068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfHFY4lvzOz3IPaA3wm%2Fuploads%2FQ3Ym9eutTgGBlK8o3DW6%2Fimage.png?alt=media\&token=21d2c49e-f69d-41d5-a0d0-2bd28743a001)

This Tent map also has a clear (nonlinear) dependence of present time-series value with that two-steps into the future (and a moderate value of this feature, `ami2 = 0.473`):

![](https://923954068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfHFY4lvzOz3IPaA3wm%2Fuploads%2FNBuEvmyYVx6D1kPuawE1%2Fimage.png?alt=media\&token=b6c287bc-426c-4c6f-933f-599f29656977)

as seen in its embedding:

![](https://923954068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfHFY4lvzOz3IPaA3wm%2Fuploads%2Fyzej59qrgJeZhm8Uw91s%2Fimage.png?alt=media\&token=9f36604e-5df2-408e-89b1-513fc15a3b10)

And a moderate value (`ami2 = 0.25`) for this heart rhythm:

![](https://923954068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfHFY4lvzOz3IPaA3wm%2Fuploads%2FTP4SBtMGc7lXlOy2vMJu%2Fimage.png?alt=media\&token=cce27c5b-bb18-4d64-b7ce-4d5ab7692f6e)

![](https://923954068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfHFY4lvzOz3IPaA3wm%2Fuploads%2FL1CfdTwZ12iaeAtbiQZi%2Fimage.png?alt=media\&token=d3373fd4-bc1a-469f-9bd7-fe1d62b48268)

But a low value (`ami2 = 0.02`) for this earthquake time series:

![](https://923954068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfHFY4lvzOz3IPaA3wm%2Fuploads%2FKW4eLng585aNOKDOCteI%2Fimage.png?alt=media\&token=816abd79-26ad-4ee1-ade2-932cc2a7b2b7)

![](https://923954068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfHFY4lvzOz3IPaA3wm%2Fuploads%2FiUluyEFv4a0mMhKt8JD8%2Fimage.png?alt=media\&token=a0fe1304-c8e8-4276-9f7c-2b64601b6f5c)

## `ami_timescale`

**Naming info**: This feature matches the *hctsa* feature called `IN_AutoMutualInfoStats_40_gaussian_fmmi`

`ami_timescale` outputs a measure of the timescale of (potentially nonlinear) autocorrelation in the time series, as the minimum of the automutual information function. This is a conventional way of selecting the timescale for a time-delay embedding.

Automutual information is estimated here using a Gaussian assumption on the data (and is thus a nonlinear transformation of the linear autocorrelation function). The *hctsa* version maxes out at 40.
