pyhctsa.operations.stationarity.local_distributions¶
-
pyhctsa.operations.stationarity.local_distributions(y, num_segs=
5, each_or_par='par', num_bins=10)¶ Compares the distribution in consecutive time-series segments.
Breaks the time series into
num_segsconsecutive segments of equal length and measures how different the distributions of values in two segments are as the total variation distance between their histograms: half the sum of the absolute differences between the proportions of values in each bin (0 for identical distributions, 1 for distributions with no bin in common). The bins are common to all segments and equiprobable for the full series (edges at its quantiles,pyhctsa.robust.bf_quantile_edges()), so the measure has no smoothing parameter and does not depend on the scale of the data. Either each segment is compared to the parent (full time series) distribution, or each to all other segments.- Parameters:¶
- y : array-like¶
The input time series.
- num_segs : int, optional¶
The number of segments to break the time series into. Default is 5.
- each_or_par : {'par', 'each'}, optional¶
‘par’: compares each local distribution to the parent (full time series) distribution.
’each’: compares each local distribution to all other local distributions.
Default is
'par'.- num_bins : int, optional¶
The number of equiprobable bins (fewer if values are tied at a quantile). Default is 10.
- Returns:¶
Mean (meandiv) and standard deviation (stddiv) of the total variation distances between distributions across the different pairwise comparisons. (For ‘each’ with two segments, the single distance is returned as a float.)
- Return type:¶
dict