pyhctsa.operations.correlation.embed2

pyhctsa.operations.correlation.embed2(y, tau='tau')

Statistics of the time series in a 2-dimensional embedding space.

Embeds the (z-scored) time series in a two-dimensional time-delay embedding space with a given time-delay, tau, and outputs a set of statistics about the structure in this space, including angular distribution, stationarity, Euclidean distances from the origin, and statistics on outliers.

Parameters:
y : array-like

The input time series.

tau : int or str, optional

The time delay: an integer number of samples, or a rule that sets it from the series: 'tau' (or 'ac'; the first zero crossing of the autocorrelation function), 'ac1e' (the floor of its first 1/e crossing) or 'mi' (the smaller of the first minimum of the Kraskov automutual information and the 'ac1e' delay); see get_tau(). A delay set by a rule is capped at N/10; if it cannot be set the output is NaN. Default is 'tau'.

Returns:

Dictionary containing:
  • Distribution of angles between successive points in the embedding space.

  • Stationarity of the angular distribution (across segments).

  • Euclidean distances from the origin (mean, std, etc.).

  • Statistics on outliers in the embedding space (e.g., area ratios).

Return type:

dict

Notes

The angle of the step between two successive embedded points that coincide (which needs repeated values in the series) is undefined (0/0). All statistics of the angles use only the defined angles:

  • theta_mean and theta_std are their mean and standard deviation.

  • hist10std and histent are computed from the proportions of the defined angles in 10 equal bins on (-pi/2, pi/2), and stdb1-stdb4 from the proportions of the defined angles of each fifth of the sequence in 4 bins, so the proportions sum to 1. They are NaN if there are no defined angles (stdb1-stdb4: if some fifth has none).

  • theta_ac1-theta_ac3 are autocorrelations of the angle sequence in which each lagged product is taken only over pairs of angles that are both defined, at their original separation in the sequence: the angles either side of an undefined one are not treated as neighbors. With d the deviations of the defined angles from their mean, the lag-k autocorrelation is the sum of the products d_t d_{t+k} over the pairs k apart that are both defined, divided by the sum of d_t^2 over all defined angles. It always lies in [-1, 1] (it is the standard estimator applied to the deviations with the undefined angles set to zero), and it shrinks toward 0 as more angles are undefined, since fewer pairs contribute to the numerator. It is NaN if no pair at that lag is defined (e.g. when every other angle is undefined, at lag 1).

With no undefined angles all of these are the usual statistics of the full sequence (the autocorrelation is then the standard estimator, sum_t d_t d_{t+k} / sum_t d_t^2).