Detection of time reversibility in time series by ordinal patterns analysis J. H. Mart´ınez,1, a) J. L. Herrera-Diestra,2 and M. Chavez3 1)INSERM-UM1127, Sorbonne Universit´e,Institut du Cerveau et de la Moelle Epini`ere. France 2)ICTP South American Institute for Fundamental Research, IFT-UNESP. Brazil 3)CNRS UMR7225, HˆopitalPiti´eSalpˆetri`ere. France (Dated: 13 September 2018) Time irreversibility is a common signature of nonlinear processes, and a fundamental property of non- equilibrium systems driven by non-conservative forces. A time series is said to be reversible if its statistical properties are invariant regardless of the direction of time. Here we propose the Time Reversibility from Ordinal Patterns method (TiROP) to assess time-reversibility from an observed finite time series. TiROP captures the information of scalar observations in time forward, as well as its time-reversed counterpart by means of ordinal patterns. The method compares both underlying information contents by quantifying its (dis)-similarity via Jensen-Shannon divergence. The statistic is contrasted with a population of divergences coming from a set of surrogates to unveil the temporal nature and its involved time scales. We tested TiROP in different synthetic and real, linear and non linear time series, juxtaposed with results from the classical Ramsey’s time reversibility test. Our results depict a novel, fast-computation, and fully data-driven method- ology to assess time-reversibility at different time scales with no further assumptions over data. This approach adds new insights about the current non-linear analysis techniques, and also could shed light on determining new physiological biomarkers of high reliability and computational efficiency.

PACS numbers: 05.45.Tp, 05.70.Ln, 89.75.Kd, 87.23.-n, 87.19.le, 89.65.Gh, 87.10.Vg Keywords: Time reversibility, Time series, Ordinal patterns analysis, Nonlinearity, Surrogate data

Most time series observed from real systems are non-conservative forces (memory)5, therefore, it is ex- inherently nonlinear, thus detecting this property pected to be present in the scalar observation of different is of full interest in natural or social sciences. One biological and physical systems. Indeed, time irreversibil- feature that ensures the nonlinear character of a ity has been reported in ecological and epidemiologi- system is the time irreversibiliity. A time series is cal time series6,7, in tremor time series of patients with said to be reversible if its statistical properties are Parkinson’s disease8, in electroencephalographic (EEG) invariant regardless of the direction of time. Here recordings of epileptic patients9–11, or in cardiac inter- we propose the Time Reversibility from Ordinal beat interval time series extracted from patients and Patterns (TiROP) method to assess the tempo- healthy subjects under different cardiac conditions12–15. ral symmetry of linear and nonlinear time series Any time series that is a realisation of a stationary, at different scales. Our approach is based on a linear is time reversible, because of the fast-computing symbolic representation of the ob- symmetry of their covariance functions16–18. Neverthe- served data. Here, TiROP is compared with a less, a non-Gaussian amplitude distribution could be due classical time-reversibility test in a rich variety to a static nonlinear transformation of a stationary lin- of synthetic and real time series from different ear Gaussian process, and by itself is no proof of tempo- systems, including ecology, epidemiology, econ- ral irreversibility. Furthermore, non-Gaussian processes omy and neuroscience. Our results confirm that modeled as outputs of linear systems are reversible19. TiROP has a remarkable performance at unveil- In contrast, the output of a non-linear system excited ing the time scales involved in the temporal irre- by non-Gaussian noises is time irreversible20. Non-linear versibility of a broad range of processes. and non-Gaussian linear models typically have temporal directionality as a property of their higher-order depen- dency18. The study of time reversibility properties of time series might therefore provide meaningful insights I. INTRODUCTION into the underlying nonlinear mechanisms of the observed arXiv:1809.04377v1 [.data-an] 12 Sep 2018 data. A time series is said to be reversible if its statisti- Classical time reversibility tests require higher-order 21–23 cal properties are invariant regardless of the direction of moments of the studied signal Xt to be finite . Other time. Time irreversibility is a fundamental property of tests have been devised by directly comparing the dis- 1–3 4,9,24 non-equilibrium systems and dynamics resulting from tribution of vectors {Xt,Xt+1, ··· ,Xt+D} and its time-reversed version {Xt+D,Xt+D−1, ··· ,Xt}, or from the projection of dynamics onto a finite number of planes14,25. In the last years, some works have proposed a)Electronic mail: [email protected] statistical tests for irreversibility based on the so-called visibility graphs26, i.e., the mutual visibility relationships 2 between points in a one-dimensional landscape represent- (a) 27–29 ing Xt . These works show that irreversible dynamics results in an asymmetry between the probability distri- ´ butions of graph properties (e.g. links or paths-based Xt Xt characteristics). Recently, this approach has been ex- tended for the study of non-stationary processes30,31. original time series time-reversed signal For real-valued time series, some studies have proposed (b) time-reversibility tests based on different symbolization procedures to characterize the dimensional phase spaces 12,32,33 � of Xt and its time-reversed version . These sym- bolic transformations are generally done by defining a (c) ´ quantization procedure to transform the time series into �(P(�),P(�)) a discrete sequence of unique patterns or symbols13,15,34. P(�) P(´�) Some of these reversibility tests use a priori binomial statistics to assess statistical significance of findings32,33. Nevertheless, such tests assume independence of the ob- served symbols, which is unlikely to occur in real data �1 �2 �3 �4 �5 �6 �1 �2 �3 �4 �5 �6 with temporal correlations. In case of such serial correla- tions, a rigorous theoretical framework cannot be derived FIG. 1. Main steps of the TiROP algorithm for evaluating the time-reversibility of a time series Xt. (a) (Left) Original and Monte Carlo simulations (e.g. parametric or non- time series represented in blue. (Right) The time reversed sig- parametric re-sampling) must be performed to estimate 0 nal Xt represented in orange. (b) Patterns π’s extracted from the significance level of time reversibility tests12,13,15. 0 Xt and Xt for D = 3. (c) Probability distributions P (π) and 0 0 In this work we propose a novel procedure, the Time P (π) extracted from Xt and Xt, respectively. The Jensen- Reversibility from Ordinal Patterns method (TiROP), Shannon δ captures the dissimilarity between the information that compares the empirical distributions of the forward content in both distributions and backward statistics of a time series. To estimate the asymmetry between both probability distributions we 40 use the ordinal symbolic representations35,36. In contrast proposals , we considered here the dynamical transfor- 35 with other approaches based on symbolic analysis, the or- mation by Band and Pompe . This method maps a dinal patterns analysis used here is fully data-driven, i.e., time series Xt with t = 1,...,T to a finite number of pat- the symbolic transformation does not require any a pri- terns that encode the relative amplitudes observed in the ori threshold, or any knowledge about the data sequence. D-dimensional vector Xt = {Xt,Xt+τ ,...,Xt+(D−1)τ }. We complete our time reversibility test with surrogate The elements of the vector Xt are mapped uniquely onto data analysis without making assumptions on the under- the permutation π = (π0, π1, . . . , πD−1) of (0, 1,...,D − 37,38 lying generating process . 1) that fulfills Xt+π0τ 6 Xt+π1τ , 6 ... 6 Xt+πD−1τ . The proposed framework is validated on synthetic data Each order pattern (permutation) represents thus a sub- simulated with linear, nonlinear, non-Gaussian stochas- set of the whole embedding state space. tic and deterministic processes. The method is also illus- The set of all possible ordinal patterns derived from trated on a collection of different real time series. The a time series is noted as St, whose cardinality is D! at reliability and performances of our method are also com- most. The whole sequence of ordinal patterns extracted pared with those obtained by a classical moment-based from Xt is known as the symbolic representation of the method. The remainder of the paper is organized as time series. The information content of Xt is captured by follows: Section II describes the proposed framework, the probability density P (π) of finding a particular pat- as well as the comparative method used to benchmark tern of order D in St. The higher the order is, the more our solution. Experimental results and evaluation of the information is captured from the time series. To sam- method in synthetic time series are in Section III; while ple the empirical distribution of ordinal patterns densely the evaluation of the test on real data is provided in Sec- enough for a reliable estimation of its probability distri- 41 tion IV. Finally, we conclude the paper with a discussion bution we follow the condition T > (D + 1)! in Section V. The analysis of ordinal representations has some prac- tical advantages36: i) it is computationally efficient, ii) it is fully data-driven with no further assumptions about II. METHODS the data range to find appropriate partitions and, iii) a small D is generally useful in descriptive data analysis35. Capturing information dynamics from time series Furthermore, this symbolisation method is known to be relatively robust against noise, and useful for time series with weak stationarity39,42–46. Symbolisation procedures map a time series Xt onto a discretized symbols sequence by extracting its am- plitudes’ information39. Among several symbolisation 3

TABLE I. Synthetic models. LGP and AR(2) are two linear reversible processes. The non-linear (non-reversible) AR models are driven by a Laplacian and bimodal noise distribution, respectively. Two Self-Exciting Threshold AutoRegressive models, SETAR(2; 2,2) and SETAR(2; 3,2), are non linear models with regime switching behavior. The last two models, R¨osslerand Lorenz oscillators, are set under chaotic regime. Model Equation LGP Gaussian noise with distribution N (0, 1) a AR(2) xt+2 = 0.7xt+1 + 0.2xt + t x = 0.5x − 0.3x + 0.1y + 0.1x2 + 0.4y2 + 0.0025η0 N-AR(2)b t t−1 t−2 t−2 t−2 t−1 t 00 yt = sin(4πt) + sin(6πt) + 0.0025ηt ( a 0.62 + 1.25xt−1 − 0.43xt−2 + 0.0381t if xt−2 ≤ 3.25 SETAR(2; 2,2) xt = 2.25 + 1.52xt−1 − 1.24xt−2 + 0.0626t otherwise ( a 0.733 + 1.047xt−1 − 0.007xt−2 + 0.242xt−3 + 0.0357t if xt−2 ≤ 3.083 SETAR(2; 3,2) xt = 1.983 + 1.52xt−1 − 1.162xt−2 + 0.0586t otherwise x˙ = −y − z R¨ossler y˙ = x + 0.2y z˙ = 0.2 + z(x − 5.7) x˙ = 10(y − x) Lorenz x˙ = x(28 − z) − y x˙ = xy − 2.6667z a t denotes processes. b 0 00 noises {ηt,ηt } are iid. See main text for the parameters

Assessing time reversibility higher-order moments of Xt to be finite, which may rule out many real time series23. Furthermore, it is quite pos- sible to encounter a situation in which the individual test A time series Xt is said to be time-reversible if the statistics are significant for some lags but insignificant for joint distributions of vectors Xt = {Xt,Xt+1, ··· ,Xt+D} 0 others. and Xt = {Xt+D,Xt+D−1, ··· ,Xt} for D are equal for all t, i.e., the statistical properties of the process are In this work, we propose the Time Reversibility from the same forward and backward in time. All Gaus- Ordinal Patterns method (TiROP) as a procedure to as- sian processes (and all static transformations of a lin- sess for time-irreversibility with no assumptions about ear Gaussian process) are time-reversible since their joint the process or the observed signal Xt (see the general distributions are determined by the covariance function scheme in Fig. 1). Ordinal symbolic representations are which is symmetric17,19. On the contrary, linear pro- not symbols ad hoc, but they encode information about cesses driven by non-Gaussian innovations and the non- the temporal structure of the underlying data. Instead of linear processes with regime-switching structures, such as comparing empirical distributions from Xt and its time- 0 the self-exciting threshold autoregressive (SETAR) pro- reversed version Xt, we compare the permutation parti- cess47, are generally time irreversible47–50. tion (i.e., the symbolic representation) of the embedding 0 Time reversibility implies that the differences of the se- state spaces spanned by Xt and Xt. The idea behind ries being tested have symmetric marginal distributions, TiROP is to compare the distribution P (π) of ordinal patterns obtained from the original signal, i.e., the distri- i.e. if Xt is time reversible, the distribution of Yt,τ = 16 bution of the ordinal transformation of vectors X ; with Xt − Xt−τ is symmetric about the origin for every τ . t 0 Time reversibility also implies that all the odd moments the probability P (π) resulting from its time reversed ver- 16 sion X0 . of Yt,τ , if exist, are zero . A simple measure for a de- t viation from reversibility for a certain time lag τ was in- To quantify the (dis)-similarity between both informa- 54 troduced by Ramsey22. Time reversibility is assessed by tion contents, we use the Jensen-Shannon divergence 0 1 1 0 checking the difference between the sample bi-covariances δ(P (π),P (π)) = 2 D(P (π),M(π)) + 2 D(P (π),M(π))), 2 2 1 0 for zero mean time series γ(τ) = hXt Xt−τ i − hXtXt+τ i. where M(π) = 2 (P (π) + P (π)) and D(U, W ) = This method is a benchmark test for time-reversibility P U(i) i U(i) log W (i) is the divergence from distribution U to and it has been proved to be effective at detecting non- W . Time reversibility implies that distributions of vec- linearity and reversibility in different time series, such as 0 tors Xt and Xt, and therefore the distributions of their hearth rates, economical data, or even in SETAR mod- ordinal transformations, are the same. 51–53 els . Nevertheless, moment-based tests for time re- To rule out the possibility that large values of δ could versibility are not really applicable because they require account for non-Gaussian distributions, or large autocor- 4 (a) (b) (c) (d) 0.25 0.25 0.25 **** 0.25 ****

0.2 0.2 0.2 0.2

0.15 0.15 0.15 0.15

0.1 0.1 0.1 0.1

0.05 0.05 0.05 0.05

0 0 0 0 3 4 5 6 7 3 4 5 6 7 3 4 5 6 7 3 4 5 6 7 dimension D (e) (f) (g) (h) ***** ******* ******* * distances 0.6 0.6

0.5 0.5 0.1 0.1

0.4 0.4

0.3 0.3 0.05 0.05 0.2 0.2

0.1 0.1

0 0 0 0 3 4 5 6 7 3 4 5 6 7 3 4 5 6 7 3 4 5 6 7 dimension D

FIG. 2. TiROP test applied to synthetic models. Yellow dots indicate the original δ values for each D. Dashed red lines are visual guides but do not represent continuity. Blue dots represent the distributions of {δs} at different scales. Black asterisks indicate the dimension D for which the value of δ is statistically different from {δs}. The different models are: (a) Linear Gaussian process; (b) linear ; (c) non-linear AR model driven by a Laplacian noise; (d) non-linear system excited by a noise with a bi-modal distribution; (e) SETAR with two regimes, each one with second order delays; (f) SETAR model with two regimes, with delays of third and second order; (g) chaotic R¨osslersystem; and (h) chaotic Lorenz model.

relation values at different time lags in signal Xt, the sta- III. TIME REVERSIBILITY IN SYNTHETIC TIME tistical significance of δ values is assessed by a z-test to SERIES quantify the statistical deviation from values obtained in 38,55–57 s an ensemble of surrogate data . An ensemble {Xt } In this section, we evaluate the performance of the of surrogate time series are created directly from the orig- TiROP method on synthetic time series, simulated with inal dataset through replication of the linear autocor- different classes of models (see Table. I): relation and amplitudes distribution. In this work, we Time-reversible linear systems: a linear Gaussian use the so-called Iterative Amplitude Adjusted Fourier process (LGP), and a linear auto-regressive model of sec- Transform (IAAFT)37,58 that preserves power spectrum ond order driven by a white noise. density and amplitude distribution of original data, while Non-reversible coupled non-linear systems: Two all other higher-order statistics are destroyed. For each non-reversible nonlinear AR models (N-AR) driven by s 20 Xt , we repeat the procedure of Fig. 1 to compute a non-Gaussian noises . We first consider a non-linear set of {δs} dissimilarities. If the original dissimilarity is system driven by Laplacian noises drawn from the dis- statistically distant from the distribution of {δs} we can 1  −|η−µ|  tribution p(η) = 4b exp b , with µ = 0 and assume that Xt comes from a nonlinear system with a b = 1. Then, we use the same non-linear model ex- time irreversible dynamics. 59 The reliability and performances of our TiROP method cited by a noise that follows the bi-modal distribution are also compared with those obtained by the Ramsey’s p(η) = 0.5N (η|µ, σ) + 0.5N (η| − µ, σ), with µ = 0.63, time-reversibility test γ(τ) based on moments and dis- σ = 1. cussed above22. All significance tests are set at p < 0.05, Non-reversible switched nonlinear systems: Bonferroni-corrected for multiple comparisons (dimen- Two processes from the family of Self-Exciting Thresh- sions D or time lags τ). old AR (SETAR) models, which are largely used to model ecological systems and are characterized for having jumps between different non-linear regimes, each one with dif- 5 (a) (b) (c) (d) ** *** 0.06 0.06 0.06 0.05

0.04 0 0.04 0.04 0.02 -0.05 0.02 0.02 0 -0.1 0 0 -0.02 -0.15 -0.02 -0.02 -0.04 -0.2 -0.04 -0.04 -0.06 -0.25 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 delay (e) (f) (g) (h) 0.8 0.8 ********** ********** 0.05 ********* 0.05 **********

0.6 0.6 0 0 0.4 0.4 -0.05 -0.05 0.2 0.2 -0.1 -0.1 0 0 -0.15 -0.15 -0.2 -0.2 -0.2 -0.2 -0.4 -0.4

1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 delay

FIG. 3. Ramsey’s reversibility test of synthetic models. Blue dots indicate the original γ values for each time-lag τ. Dashed red lines are visual guides but do not represent continuity. Distributions of {γs} at different scales are represented by the points inside the yellow plots. Black asterisks indicate at which time-lag, γ is statistically different from γs. Same stipulations as in the caption of Fig. 2.

48,50,52,60 ferent delays . The fifth model is a SETAR with {δs} for all surrogate time series considered. We calcu- two regimes, each one with second order delays. The δ−h{δs}i late a z-statistics for each D as | σ({δ }) | and we check sixth one is a SETAR with two regimes with delays of s for irreversibility by testing the null hypothesis H0 of third and second order. a time-reversible process with significance level α 6 0.5 Chaotic, non-reversible systems: The last two (corrected by Bonferroni). We repeat the procedure with models are the classical R¨oslerand Lorenz systems in Ramsey’s test, taking into account the first ten time-lags their corresponding chaotic regimes . The analyzed time τ’s. Fig. 2 (3) shows the results for TiROP (Ramsey) series correspond to the evolution of the y and z vari- methodology along different scales (delays). ables, from the R¨osslerand Lorenz systems, respectively. As expected, the statistical properties of the LPG pro- For each model, the length of each time series is set to cess are the same forward and backward in time and thus 4 T = 10 , after discarding the first 1000 points to avoid the null hypothesis of reversibility is never rejected by possible transients. Contrary to phase state reconstruc- both tests. Interestingly, whereas the TiROP method tion, which requires to select a dimension D and time correctly diagnoses the AR model as a reversible pro- delay τ embedding according to some criteria, in ordinal cess, Ramsey’s statistics yields false positives and falsely time-series analysis the criteria are computational cost rejects H0 in two non-continuous delays. and statistical significance in view of the amount of data Whereas non-Gaussian processes modeled as outputs 36,39 available . We therefore do not make any assump- of linear systems are reversible19, the output of a non- tion regarding the dimension, and use different values of linear system excited by non-Gaussian noises is time ir- D depending on the data length. Although, larger de- reversible. For the case of non-linear AR (N-AR) process lays can provide additional scale-dependent information excited by a Laplacian noise, the null hypothesis of time- about the time series under study, we set τ = 1 through- reversibility is correctly rejected by our TiROP method, 36,39 out this work . while Ramsey’s test fails to detect time-irreversibility For the assessment of statistical significance we gener- along all time-lags. Similar to the previous, the output of ate 50 surrogates from each original sequence. For dif- the N-AR model driven by a bi-modal noise is detected ferent scales (D = 3, ..., 7), we obtain δ and the set of as irreversible by TiROP for all dimensions D > 1, while 6 (a) (b)

0.25 **10 y 0.2 ** 1 y * 2000 lynx 103 cases 0.2 0.15 0.15 0.1 0.1 0.05 0.05

0 0 3 4 3 4 5 dimension D dimension D (c)

distances 0.4 ** ** * 102 days 500 USD 0.3

0.2

0.1

0 3 4 5 6 7 dimension D

FIG. 4. Time-reversibility test on different real data. Insets shows the collection of samples of each process, its temporal and amplitude scales. (a) Time series of lynx returns. (b) Weekly Mexican reported cases of dengue. (c) Daily S&P closing prices. Yellow dots indicate the original δ values for each D. Dashed red lines are visual guides but do not represent continuity. Blue dots represent the distributions of {δs} at different scales. Black asterisks indicate the dimension D for which the value of δ is statistically different from {δs}.

Ramsey’s test only detects irreversibility in the first three IV. TIME REVERSIBILITY IN REAL DATA delays. For the SETAR and chaotic models, both TiROP and To further demonstrate the potentials of our test, we Ramsey’s tests correctly reject the time-reversible hy- apply it to real data of different nature: ecology (the time pothesis, in agreement with previous studies at iden- series of lynx abundance), epidemiology (dengue preva- tifying the intrinsic time irreversibility of such mod- lence), economy (the S&P price-index series) and neu- 48,50,52,60,65 els . To notice, however, that Ramsey’s statis- roscience (electroencephalographic data from an epilep- tics yields a false negative at the first delay for the R¨ossler tic patient). As data have different length we apply system. TiROP in different dimensions, following the condition41 To further evaluate the performance of the TiROP T > (D + 1)! method, we consider short sample sizes. Numerical simu- Inset in Fig. 4-(a) shows the well-known time series xt lations show that our TiROP test can correctly detected of fur returns of the Canadian lynx, a valuable collection irreversibility in SETAR and chaotic models when the representing the regularity and rhythm of lynx popula- data length is, at least, ten times the fundamental pe- tion in Canada. Each amplitude represents the amount riod T0 of SETAR (T0 ' 9 samples) and twelve times of lynx furs that trappers caught and brought into posts the period of chaotic systems (T0 ' 52 samples). For in the same hunting season. T = 114 samples were col- these sample sizes, the Ramsey’s method increases dra- lected during 1821-1914 near Mackenzie river region61. matically the number of incorrect rejections of true null Notice that this dataset was used to fit the SETAR mod- hypothesis, as well as the number of false negatives in els’ parameters used in this work48. Before applying the chaotic systems. time-reversibility test, we applied the variance stabiliz- 49 ing transformation yt = log10(xt +1). Despite its short data length, our results suggest irreversibility in this time series, in full agreement with previous works18,50,52,60. Inset in Fig. 4-(b) depicts M = 678 epidemiologi- cal weeks of reported cases of Dengue in Mexico dur- 7 ing the years 2000-201562. As for the lynx time series, V. CONCLUSIONS time reversibility was assessed on the transformed data yt = log10(xt + 1). Based on nonlinear prediction tech- In this work we have addressed the problem of detect- niques, different studies have proposed evidence for time ing, from scalar observations, the time scales involved reversibility in different ecological and epidemiological in temporal irreversibility. Based on the ordinal pat- 6,7 time series . For the time series of dengue prevalence terns analysis, the TiROP method compares the infor- considered here, the TiROP method rejects the null hy- mation content of the symbolic representation of Xt and pothesis of time reversibility for all scales. This result in- 0 the counterpart of its time-reversed version Xt. In con- dicates that such dengue’s dynamics cannot be analyzed trast with other approaches based on symbolic analysis, by conventional linear models. the approach proposed here has the key practical advan- The inset in Figure 4-(c) shows M = 5444 samples tage that it is fully data-driven and it does not require from the Standard & Poor’s Index encompassing the any a priori thresholds, or any knowledge about the data daily historical closing prices from January 1990 to Au- sequence for its symbolic representation, which is very 63 gust 2011 . This is the most representative index of useful in real-world data analysis. the real situation of market in USA based on the cap- Results confirm that TiROP provides an interesting italization of 500 large companies with common stocks and promising approach to the analysis of complex time in NYSE and NASDAQ. Although S&P-500 time se- series. The applicability and advantages of our method 64 ries has been suggested to be irreversible and chaotic , was demonstrated by many examples from synthetic and some works have showed that moment-based methods real, linear and nonlinear models. The method outper- 65 fail at detecting irreversibility . To account for the non- forms a classical moment-based test, which often fails stationarity of original data, we extracted the log-returns to detect time-irreversibility along different time-lags. yt = log(xt+1) − log(xt), and then we checked for time- Our results confirm temporal irreversibility in economical reversibility at different scales up to D = 7. Our method time series, and suggest this property as a common signa- rejects the hypothesis of a time-reversible process, which ture in epidemiological data. This would imply that ad- agrees with previous findings suggesting that irreversibil- ditional nonlinear analysis techniques should be applied ity in economical time series is a rule instead of a simple for a more complete characterization of such time series. 28,49 exception . The results indicates that time irreversibility can also be observed at scalp EEG recordings of epileptic seizures in (a) (b) **** humans. To conclude, this study shows that the detection of temporal irreversibility in time series can be successfully addressed using ordinal symbolic representation. The main advantage of our proposal relies on its simplicity, reliability and computational efficiency thanks to the or- dinal patterns transformation and analysis. The detec- tion of temporal irreversibility in other data (e.g. cardiac distances or climate time series) might provide meaningful insights into the underlying process generating the observed time series. This framework could also add new functional- ity to current non-linear analysis techniques, but also it dimension D dimension D could open the way to define physiological biomarkers. FIG. 5. Time-reversibility test on EEG data. Insets show ten seconds in the same scales (a) before and (b) during the epileptic episode. Same stipulations as in the caption of Fig. 4 ACKNOWLEDGMENTS

As many others time series in biology and medicine, JHM and MC are grateful to members of Gnonga-Tech electroencephalographic (EEG) signals display strong for useful and valuable suggestions. JLHD is supported nonlinearities during different cognitive or pathological by the S˜aoPaulo Research Foundation (FAPESP) under states66. Time-reversibility can be a useful property of grants 2016/01343-7 and 2017/00344-2. interictal EEG signals, as it can serve as a marker of the 1J. S. W. Lamb and J. A. G. Roberts, Physica D. 112, 1–39 9–11 epileptogenic zone . Here, we applied our TiROP test (1998). to scalp EEG recordings from a pediatric subject with 2I. Prigogine and I. Antoniou, Ann. N.Y. Acad. Sci. 879, 8–28 intractable epileptic seizures67–69. Figs. 5(a)-(b) show (1999). 3 the time series corresponding to the interictal and ictal D. Andrieux, P. Gaspard, S. Ciliberto, N. Garnier, S. Joubaud and A. Petrosyan, Phys. Rev. Lett. 98 (15), 150601 (2007). (seizure) periods, respectively. Our results confirm pre- 4A. Porporato, J. R. Rigby and E. Daly, Phys. Rev. Lett. 98, vious findings suggesting that interictal EEG dynamics 094101 (2007). can be associate to a reversible linear process, whereas 5A. Puglisi and D. Villamaina, EPL 88, 30004 (2009). time irreversibility characterizes epileptic seizures9–11. 8

6B. T. Grenfell, A. Kleczkowski, S. P. Ellner and B. M. Bolker, 37T. Schreiber and A. Schmitz, Phys. Rev. Lett. 77, 635–638 Phil. Trans. R. Soc. Lond. A 348, 515–530 (1994). (1996). 7L. Stone, G. Landan and R. M. May, Proc R Soc Lond B. 263, 38T. Schreiber and A. Schmitz, Physica D. 142, 346–382 (2000). 1609–1513 (1996). 39J. M. Amig´o, Permutation complexity in dynamical systems: or- 8J. Timmer, C. Gantert, G. Deuschl and J. Honerkamp, Biol Cy- dinal patterns, permutation and all that (Springer Sci- bern. 70, 75–80 (1993). ence & Business Media 2010). 9M. J. van der Heyden, C. Diks, J. P. M. Pijn and D. N. Velis, 40C. S. Daw, C. E. A. Finney and E. R. Tracy, Rev Sci Instrum. Physics Letters A. 216, 283–288 (1996). 74, 915–930 (2003). 10J. P. M. Pijn et al., Brain Topogr. 9(4), 249–270 (1997). 41J. M. Amig´o,S. Zambrano and M. A. F. Sanju´an, EPL. 79, 50001 11K. Schindler et al., Clin Neurophysiol. 127, 3051–3058 (2016). (2007). 12M. Costa, A. L. Goldberger and C. K. Peng, Phys Rev Lett. 95, 42K. Keller, A.M. Unakafov and V. A. Unakafova, Entropy. 16(2), 198102 (2005). 6212–6239 (2014). 13A. Porta, K.R. Casali, A.G. Casali, T. Gnecchi-Ruscone, E. To- 43B. Cazelles, Ecol Lett. 7, 755-763 (2015). baldini, N. Montano, S. Lange, D. Geue, D. Cysarz and L.P. Van, 44J.H. Mart´ınezet al, Nat. Sci. Rep. 8, 10525 (2018). Am J Physiol Regul Integr Comp Physiol. 295(2), R550–R557 45M. Zanin, L. Zunino, O. A. Rosso and D. Papo, Entropy. 14, (2008). 1553–1577 (2012). 14 K. R. Casali et al., Phys Rev E. 77, 066204 (2008). 46O. A. Rosso, H. A. Larrondo, M. T. Mart´ın,A. Plastino and M. 15 A. Porta, G. D. Addio, T. Bassani, R. Maestri and G. D. Pinna, A. Fuentes, Phys. Rev. Lett. 99, 154102 (2012). Philos. Trans. Math. Physi. Eng. Sci. 367 (1892), 1359–1375 47H. Tong and K. S. Lim, J. R. Statist. Soc. B 42, 245–292 (1980). (2009). 48H. Tong, Threshold Models in Non-Linear time Series Analysis 16 D. R. Cox, Scan J. Stat. 8, 93–115 (1981). (Springer 1983). 17 M. Hallin, C. Lefevre and L. Puri, Biometrika. 75, 170–171 49H. Tong, Nonlinear time Series. A Dynamic Systems Approach (1988). (Oxford University Press 1983). 18 A. J. Lawrance, Int Stat Rev. 59, 67–69 (1991). 50H. Tong, Stat. Its Interface. 4, 107–118 (2011). 19 G. Weiss, J. Appl. Prob. 12, 831–836 (1975). 51C. Braun et al, Am J Physiol Heart Circ Physiol. 275(5), H1577– 20 P. S. Rao and D. H. Johnson, International Conference on Acous- H1584 (1998). tics, Speech, and Signal Processing (ICASSP-88). 3, 1534–1537, 52P. Rothman, J. Appl. Econom. 7, S187–S195 (1992). NY (1998). 53J. Belaire-Franch and D. Contreras, Econ Lett. 81, 187–195 21 Y. Pomeau, J. Phys. 43, 859–867 (1982). (2003). 22 J. B. Ramsey and P. Rothman, “Characterization of the time ir- 54J. Lin, IEEE Trans Inf Theory. 37(1), 145–151 (2012). reversibility of economic time series: Estimators and test statis- 55D. Kugiumtzis, in Modelling and Forecasting Financial Data. tics”, Working Papers (C.V. Starr Center for Applied Economics, Studies in Computational Finance Vol. 2, edited by A. S. Soofi, New York University1998). L. Cao (Springer 2002). 13, pp. 267-282. 23 P. J. F. de Lima, J. Econom. 76, 251–280 (1997). 56A. G. Barnett and R. D Wolff, IEEE Trans. Signal Process. 24 C. Diks, J. C. van Houwelingen, F. Takens, J. DeGoede, Physics 53(1), 26-33 (2005). Letters A. 201, 221–228 (1995). 57R. Engbert, Chaos Solitons Fractals. 13, 79–84 (2002). 25 P. Guzik, J. Piskorski, T. Krauze, A. Wykretowicz and H. 58A. Leontitsis, Math. Comput. Modelling. 38, 33–40 (2003). Wysocki, Biomed. Tech. 51, 530–537 (2006). 59D. Hern´andez-Lobato,P. Morales-Mombiela, D. Lopez-Paz and 26L. Lacasa, M.A. Nu˜nez, E.´ Rold´an,J.M.R. Parrondo and B. A. Su´arez,J. Mach. Learn. Res. 17, 1–39 (2016). Luque, Eur. Phys. J. B. 85, 217 (2012). 60J. D. Petruccelli, J Forecast. 9, 25–36 (1990). 27J. F. Donges, R. V. Donner and J. Kurths, EPL. 102(1), 10004 61E. Charles and M. Nicholson, J Anim Ecol. 11, 215–244 (1942). (2013). 62Ministerio de Salud Secretar´ıa de Salud. Gobierno de 28R. Flanagan and L. Lacasa, Phys. Lett. A. 380, 1689–1697 M´exico (https://www.gob.mx/salud/acciones-y-programas/ (2016). direccion-general-de-epidemiologia-boletin-epidemiologico.) 29J. Li and P. Shang, Physica A. 502, 248–255 (2018). 63S&P500 historical prices were obtained from the YAHOOFinance 30L. Lacasa and R Flanagan, Phys Rev E. 92(2), 022817 (2015). website (https://finance.yahoo.com.) 31L. Rong and P. Shang, Physica A. 512, 913–924 (2018). 64M. D. Vamvakaris, A. A. Pantelous and K. K. Zuev, Physica A. 32C. S. Daw, C. E. A. Finney and M. B. Kennel, Phys. Rev. E. 497, 41–51 (2018). 62(2), 1912 (2000). 65J. S. Racine and E. Maasoumi, J Econom. 138, 547–567 (2007). 33M. Zanin, A. Rodr´ıguezGonz´alez,E. Menasalvas Ruiz and D. 66C. J. Stam, J. P. M. Pijn, W. S. Pritchard, Physica D. 112, Papo, Preprints. 2018080083 (2018). 361–380 (1998). 34M. B. Kennel, Phys Rev E. 69, 056208 (2004). 67The EEG data was obtained from the open repository CHB- 35C. Bandt and B. Pompe, Phys. Rev. Lett. 88, 174102 (2002). MIT Scalp EEG Database (https://www.physionet.org/pn6/ 36J. M. Amig´o,K. Keller and V. A. Unakafova, Phil. Trans. R. chbmit/) Soc. A. 373, 20140091 (2015). 68A. L. Goldberger et al, Circulation 101, e215 (2000). 69A. Shoeb, Ph.D. Thesis, Massachusetts Institute of Technology. (2009).