pyhctsa.operations.stationarity.spread_random_local

pyhctsa.operations.stationarity.spread_random_local(y, l=100, num_segs=100, random_seed='default')

How local statistics vary across many overlapping segments of the time series.

num_segs time-series segments of length l are selected from the time series (with start points spread evenly over it; segments can overlap) and in each segment some statistic is calculated: mean, standard deviation, skewness, kurtosis, PermEn(3,1), AC(1), AC(2), and the first zero-crossing of the autocorrelation function. Outputs summarize how these quantities vary in different local segments of the time series, as the standard deviation of each across the segments. (The mean of each set is not output, since it just re-estimates the corresponding global statistic, already covered elsewhere, rather than measuring stationarity.) Returns NaN if l is longer than 90% of the time series.

Parameters:
y : array-like

The input time series.

l : int or str, optional

The length of local time-series segments to analyze, as a positive integer, or:

  • ’ac2’: twice the first zero-crossing of the autocorrelation function,

  • ’ac5’: five times the first zero-crossing of the autocorrelation function.

Default is 100.

num_segs : int, optional

The number of local segments to analyze. Default is 100.

random_seed : int, str or None, optional

Not used: the segment start points are floor((N - l + 1) u_j) with u_j the golden-ratio (Weyl) sequence frac(j*phi), evenly spread and deterministic, as in hctsa. Kept so that existing calls still work.

Returns:

  • ‘stdmean’, ‘stdstd’, ‘stdskew’, ‘stdkurt’: the standard deviation, across segments, of the segment mean, standard deviation, skewness, and kurtosis,

  • ’stdpermen’: the standard deviation of the normalized permutation entropy PermEn(3,1),

  • ’stdac1’, ‘stdac2’: the standard deviation of the autocorrelation at lags 1 and 2,

  • ’stdtaul’: the standard deviation of the first zero-crossing of the autocorrelation function (interpolated, in samples).

Return type:

dict