pyhctsa.operations.correlation.remove_points

pyhctsa.operations.correlation.remove_points(y, remove_how='absfar', p=0.1, remove_or_saturate='remove', random_seed=None)

How the autocorrelation of a time series changes when a set of points is removed or clipped.

A proportion, p, of the points of the (z-scored) series are removed, or saturated, according to a rule (see bf_remove_points()), and the autocorrelation structure is compared before and after the change. Removing deletes the chosen points and closes up the rest into a shorter series, which splices together points that were not neighbors. Saturating keeps them in place but clips their values to the most extreme value among the points kept. The order-free statistics of the same transformation (mean, median, standard deviation, skewness and kurtosis) are in remove_points().

Port of hctsa’s CO_RemovePoints (split from a single function, DN_RemovePoints, that returned both sets of outputs).

Parameters:
y : array-like

The input time series (should be z-scored).

remove_how : {'absclose', 'absfar', 'min', 'max', 'random'}, optional

How to choose the points to remove:

  • ’absclose’: those closest to the mean,

  • ’absfar’: those furthest from the mean (default),

  • ’min’: the lowest values,

  • ’max’: the highest values,

  • ’random’: at random.

p : float, optional

The proportion of points to remove. Default 0.1.

remove_or_saturate : {'remove', 'saturate'}, optional

Whether to remove the points (‘remove’, the default) or to saturate their values (‘saturate’; not possible with ‘absclose’ or ‘random’).

random_seed : int, optional

Seed of the random ordering for remove_how='random' (see pyhctsa.robust.bf_random_seed(); default 0).

Returns:

Statistics of the changed series, relative to the original:

  • fzcacrat: the ratio of the first zero-crossing of the autocorrelation function (changed to original);

  • ac1diff, ac2diff, ac3diff: the absolute differences in the autocorrelation at lags 1, 2 and 3;

  • sumabsacfdiff: the sum over lags 1 to 8 of the absolute differences in the autocorrelation.

Return type:

dict

Notes

Only the first zero-crossing is a ratio: its original value is an interpolated lag of at least 0.5, so the ratio is always well defined. The autocorrelation outputs are differences, because the original autocorrelation can be near 0, where a ratio is unstable.