version 1.2 (16 MB) by
Valentina Unakafova

Permutation entropy for ordinal patterns with tied ranks from 1D time series in sliding windows

function ePE = PEeq( x, delay, order, windowSize )

efficiently [UK13] computes permutation entropy [BKP02] for the case of ordinal patterns with tied ranks [BQM2012,UK13,U15] in maximally overlapping sliding windows (see more ordinal-patterns based measures at http://www.mathworks.com/matlabcentral/fileexchange/63782-ordinal-patterns-based-analysis--beta-version-) for orders=1...7 of ordinal patterns with tied ranks.

NOTES

1 Order of ordinal patterns is defined as in [1,3,7,8], i.e. order = n-1 for n defined as in [UK13]

2 The values of permutation entropy are normalised by log((order+1)!) so that they are from [0,1] as proposed in the original paper [BKP02].

CITING THE CODE

[1] Unakafova, V.A., Keller, K., 2013. Efficiently measuring complexity on the basis of real-world data. Entropy, 15(10), 4392-4415.

[2] Unakafova, V.A. (2015). Fast permutation entropy, MATLAB Central File Exchange. Retrieved Month Day, Year.

INPUT

- indata - considered time series

- delay - delay between points in ordinal patterns with tied ranks (delay = 1 means successive points)

- order - order of the ordinal patterns with tied ranks (order+1 - number of points in ordinal patterns with tied ranks)

- windowSize - size of sliding window

OUTPUT

- outdata - values of permutation entropy for ordinal patterns with tied ranks

EXAMPLE OF USE (with a plot):

indata = rand( 1, 7777 ); % generate random data points

for i = 4000:7000 % generate change of data complexity

indata( i ) = 4*indata( i - 1 )*( 1 - indata( i - 1 ) );

end

delay = 1; % delay 1 between points in ordinal patterns (successive points)

order = 3; % order 3 of ordinal patterns (4-points ordinal patterns)

windowSize = 512; % 512 ordinal patterns in one sliding window

outdata = PEeq( indata, delay, order, windowSize );

figure;

ax1 = subplot( 2, 1, 1 ); plot( indata, 'k', 'LineWidth', 0.2 );

grid on; title( 'Original time series' );

ax2 = subplot( 2, 1, 2 );

plot( length(indata) - length(outdata)+1:length(indata), outdata, 'k', 'LineWidth', 0.2 );

grid on; title( 'Values of permutation entropy for ordinal patterns with tied ranks' );

linkaxes( [ ax1, ax2 ], 'x' );

The method is based on precomputing values of successive ordinal patterns of order d, using the fact that they are "overlapped" in d points, and on precomputing successive values of the permutation entropy related to "overlapping" successive time-windows [1].

CHOICE OF ORDER OF ORDINAL PATTERNS

The larger order of ordinal patterns is, the better permutation entropy estimates complexity of the underlying dynamical system [KUU14]. But for time series of finite length too large order of ordinal patterns leads to an underestimation of the complexity because not all ordinal patterns representing the system can occur [KUU14]. Therefore for practical applications, orders = 3...7 are often used [BP02,RMW13,ZZR12].

In [AZS08] the following rule for choice of order is recommended:

5*(order + 1)! < windowSize.

CHOICE OF SLIDING WINDOW LENGTH

Window size should be chosen in such way that time series is stationary within the window (for example, for EEG analysis 2 seconds sliding windows are often used) so that distribution of ordinal patterns would not change within the window [BKP02,KUU14(Section 2.2),U15(Section 5.1.2)].

CHOICE OF DELAY BETWEEN POINTS IN ORDINAL PATTERNS

I would recommend choosing different delays and comparing results (see, for example, [KUU14, Section 2.2-2.4] and [U15, Chapter 5] for more details) though delay = 1 is often used for practical applications.

Choice of delay depends on particular data analysis you perform [RWM13,KUU14] and on sampling rate of the data. For example, if you are interested in low-frequency part of signals it makes sense to use larger delays.

REFERENCES

[BKP02] Bandt C., Pompe B., 2002. Permutation entropy: a natural complexity measure for time series. Physical review letters, APS

[BQM2012] Bian, C., Qin, C., Ma, Q.D. and Shen, Q., 2012. Modified permutation-entropy analysis of heartbeat dynamics. Physical Review E, 85(2), p.021906.

[UK13] Unakafova, V.A., Keller, K., 2013. Efficiently Measuring Complexity on the Basis of Real-World Data. Entropy, 15(10), 4392-4415.

[U15] Unakafova, V.A., 2015. Investigating measures of complexity for dynamical systems and for time systems (Doctoral dissertation, Lübeck, Univ., Diss., 2015).

Valentina Unakafova (2020). Permutaton entropy with tied ranks (fast algorithm) (https://www.mathworks.com/matlabcentral/fileexchange/63794-permutaton-entropy-with-tied-ranks-fast-algorithm), MATLAB Central File Exchange. Retrieved .

Created with
R2013b

Compatible with any release

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!Create scripts with code, output, and formatted text in a single executable document.

ervin