pyhctsa.operations.stationarity.local_global¶
-
pyhctsa.operations.stationarity.local_global(y, subset_how=
'l', n=None, random_seed=None)¶ Compare local statistics to global statistics of a time series.
- Parameters:¶
- y : array-like¶
The time series to analyse.
- subset_how : str, optional¶
The method to select the local subset of time series:
’l’: the first n points in a time series
’p’: an initial proportion of the full time series (round(N*n) points, halves rounded up)
’unicg’: n evenly-spaced points throughout the time series
’randcg’: n randomly-chosen points from the time series (chosen with replacement)
Default is
'l'.- n : int or float, optional¶
The parameter for the method specified by subset_how.
Default None is 100 samples or 0.1 (10% of time series length) if proportion.
- random_seed : int, str or None, optional¶
Seed for the ‘randcg’ option: an integer,
Noneor'default'for seed 0, or'none'for a seed drawn from NumPy’s global random state. The points come from the portable generatorpyhctsa.robust.bf_random()(uniform on the indices, with repeats), so they depend on the seed alone. Default None is seed 0.
- Returns:¶
A dictionary of measures comparing the subset to the full time series:
absmean, std, median: the subset’s absolute mean, standard deviation and median (for a z-scored series the full-series values are 0, 1 and near 0).
iqr, kurtosis: the absolute relative deviation,
|1 - subset/full|, of the subset’s interquartile range and (Pearson) kurtosis from the full-series values. iqr is NaN when the full-series interquartile range is zero.skewness, ac1: the absolute difference,
|subset - full|, of the skewness and of the lag-1 autocorrelation. Both are dimensionless and zero for many ordinary series (symmetric, uncorrelated), where a ratio to the full-series value has no stable value.
- Return type:¶
dict