pyhctsa.operations.medical.pol_var

pyhctsa.operations.medical.pol_var(x, d=1, D=6, tau=1)

Compute the POLVARd measure of a time series.

The POLVARd (also called Plvar) measure quantifies the probability of obtaining a sequence of consecutive ones or zeros in a symbolic sequence derived from the input time series.

This measure was originally introduced in [1].

The original implementation applied this measure to RR interval sequences (typically in milliseconds), with the symbolic threshold d representing raw amplitude differences. This implementation generalizes it to z-scored time series, such that d is specified in units of standard deviation.

The function is derived from the MATLAB implementation by Max A. Little (2009) and Ben D. Fulcher.

Port of hctsa’s MD_PolVar, Copyright (C) 2016 Max A. Little and Ben D. Fulcher (GNU GPL, version 3 or later).

References

Parameters:
x : array-like

The input time series.

d : float

Symbolic coding threshold in units of standard deviation. Default is 1.

D : int

Word length for detecting consecutive sequences. Default is 6.

tau : int or str, optional

The step, in samples: an integer, or a rule for get_tau() (e.g. 'ac1e'). The symbols code the changes |x_{t+tau} - x_t| at every t; runs are counted along each chain t = p, p + tau, ... (the series sampled every tau samples, from each of the tau phases), and the pooled count of D-runs is divided by the number of symbols. Default 1. NaN when a rule cannot set the delay.

Returns:

The probability of obtaining a sequence of D consecutive ones or zeros.

Return type:

float

Notes

The value depends on the fraction of changes that reach the threshold, which is set by the lag-1 autocorrelation and the distribution of the increments, as well as on the clustering of large and small changes. pol_var_resid() sets the threshold from AR(2) residuals, which removes the first two dependences.