pyhctsa.operations.symbolic.binary_stats

pyhctsa.operations.symbolic.binary_stats(y, binary_method='diff')

Compute statistics on a binary symbolisation of the input time series.

The time series is first symbolized as a binary string of 0s and 1s using a specified coarse-graining (symbolisation) method. Then, various statistics are computed to characterize the structure of the resulting binary sequence.

Parameters:
y : array-like

The input time series.

binary_method : str, optional

The binary symbolisation rule. One of:

  • ’diff’: Encode as 1 if the time-series difference is positive, and 0 otherwise.

  • ’mean’: Encode as 1 if the value is above the mean, 0 otherwise.

  • ’median’: Encode as 1 if the value is above the median, 0 otherwise.

  • ’iqr’: Encode as 1 if the value is within the interquartile range (above the 25th percentile and below the 75th), 0 otherwise.

Default is 'diff'.

Returns:

Statistics computed on the binary symbolisation. pupstat2 measures the stationarity of the symbols: with p1 and p2 the proportions of 1s in the first and second halves of the string, it is the contrast (p2 - p1) / (p2 + p1), between -1 (all the 1s in the first half) and 1 (all in the second half), 0 when the two halves have the same proportion, and NaN if there are no 1s. The standard deviations of the stretch lengths are NaN if there are fewer than two stretches of that symbol. diff21stretch1 (diff21stretch0) is the proportion of the stretches of 1s (0s) that have length 2 minus the proportion that have length 1; it is NaN if the symbol does not occur (e.g. no 0s in the 'diff' coding of an increasing series).

Return type:

dict