pyhctsa.operations.stationarity.ramping_windows

pyhctsa.operations.stationarity.ramping_windows(y, num_seg=10, asym_tau=1)

Monotonic trend (‘ramping’) in windowed statistics.

Splits the time series into num_seg non-overlapping segments, computes the mean, variance, skewness, kurtosis, and lag-1 autocorrelation (AC1) within each segment, and quantifies whether each of these quantities trends monotonically across the segments (e.g., a variance that ramps up steadily across the series, rather than merely fluctuating).

The asymmetric autocorrelation ‘asymAC1’ is mean(x_t * x_{t+tau} * (x_{t+tau} - x_t)) with x z-scored within each segment. It is antisymmetric under time reversal, so it is zero in expectation for any time-reversible process, and a trend in it flags a trend in the series’ local time-asymmetry/nonlinearity. The lag tau can be set from the series’ own correlation time (asym_tau='ac1e') so that the statistic is not dominated by smoothness when the series is oversampled.

Parameters:
y : array-like

The input time series.

num_seg : int, optional

The number of non-overlapping segments to divide the time series into. Non-overlapping segments are used deliberately (rather than sliding_window()’s overlapping windows): overlap between windows would induce artificial serial correlation between adjacent window-statistics, which would inflate the apparent monotonic trend independent of any real ramping in the data. Default is 10.

asym_tau : int or str, optional

The lag, tau, of asymAC1: an integer number of samples, or a rule for pyhctsa.utils.get_tau() (e.g., 'ac1e', the floor of the first 1/e crossing of the autocorrelation function of the whole series; at least 1). The asymac1_* outputs are NaN if tau cannot be set from the series, or if tau >= segment length - 1 (too few pairs). Default is 1.

Returns:

Kendall’s tau and Pearson’s r (each with its p-value) between segment index and each windowed statistic. Returns NaN if the time series is too short for the requested number of segments.

Return type:

dict