pyhctsa.operations.symbolic.transition_matrix¶
-
pyhctsa.operations.symbolic.transition_matrix(y, how_to_cg=
'quantile', num_groups=2, tau=1)¶ Transition probabilities between time-series states. The time series is coarse-grained according to a given method.
The input time series is transformed into a symbolic string using an equiprobable alphabet of num_groups letters. The transition probabilities are calculated at a lag tau.
Related to the idea of quantile graphs from time series, cf. [1]
References
- Parameters:¶
- y : array-like¶
Input time series.
- how_to_cg : str, optional¶
The method of discretization:
'quantile'(equiprobable, the default) or'updown'(a true binary up/down split by the sign of each increment: NOT equiprobable, and requiresnum_groups=2; seecoarse_grain()).'diff'(equiprobable by increment) is also accepted.- num_groups : int, optional¶
number of groups in the course-graining. Default is 2.
- tau : int or str, optional¶
analyze transition matrices corresponding to this lag. We could either downsample the time series at this lag and then do the discretization as normal, or do the discretization and then just look at this dicrete lag. Here we do the former. Can also set tau to a string that sets it from the series:
'ac'(the first zero-crossing of the autocorrelation function),'ac1e'(the floor of its first 1/e crossing) or'mi'(the smaller of the first minimum of the Kraskov automutual information and the ‘ac1e’ delay; seepyhctsa.utils.get_tau()). All three are capped at floor(N/50). Default is 1.
- Returns:¶
A dictionary including the transition probabilities themselves, as well as the trace of the transition matrix, measures of asymmetry (
symdiff,symsumdiffand the Kullback-Leibler divergencetransKLdivbetween the matrix and its transpose), eigenvalues of the transition matrix (includingsecondeig,specgapandlam2mod, the modulus of the second-largest-modulus eigenvalue of the row-normalized matrix), and the Miller-Madow-corrected conditional entropy of the next statetransEntropy. NaN is returned if tau cannot be determined. Note that the matrix is normalized by the number of transitions, so it holds joint (not row-normalized) probabilities.- Return type:¶
dict