Characterizing Complexity Changes in Chinese Stock Markets by Permutation Entropy

: Financial time series analyses have played an important role in developing some of the fundamental economic theories. However, many of the published analyses of ﬁnancial time series focus on long-term average behavior of a market, and thus shed little light on the temporal evolution of a market, which from time to time may be interrupted by stock crashes and ﬁnancial crises. Consequently, in terms of complexity science, it is still unknown whether the market complexity during a stock crash decreases or increases. To answer this question, we have examined the temporal variation of permutation entropy (PE) in Chinese stock markets by computing PE from high-frequency composite indies of two stock markets: the Shanghai Stock Exchange (SSE) and the Shenzhen Stock Exchange (SZSE). We have found that PE decreased signiﬁcantly in two signiﬁcant time windows, each encompassing a rapid market rise and then a few gigantic stock crashes. One window started in the middle of 2006, long before the 2008 global ﬁnancial crisis, and continued up to early 2011. The other window was more recent, started in the middle of 2014, and ended in the middle of 2016. Since both windows were at least one year long, and proceeded stock crashes by at least half a year, the decrease in PE can be invaluable warning signs for regulators and investors alike.


Introduction
Financial time series analyses are of enormous theoretical and practical importance.There are a few main efforts.One effort concerns the distribution of the time series and the dynamical evolution of the distributions.Another effort concerns the correlations.If the efficient market hypothesis (EMH) is of some relevance to reality, then a market will be very unpredictable due to its capability to instantly digest any new information [1][2][3][4][5].As a consequence, correlation analysis would be a less important issue than distribution analysis [6].Indeed, extensive literature exists on distribution analysis of financial time series.Representative ones include Gaussian [7], Lévy [6,8], leptokurtic [9,10], truncated Lévy [11], and Tsallis distribution [12].
The third effort concerns stock crashes and financial crises, which are among the most terrifying events in the financial world.On the one hand, such events challenge the EMH, as they often induce panic and herding behavior.On the other hand, they have motivated many interesting empirical studies on the collapse of a financial system or the entire market (i.e., the systemic risks).This is especially true after the 2008 global financial crisis.Important works along this line include studies on bank contagion [13,14], bank capital ratios and bank liabilities [15,16], contagion, spill-over effects, and co-movement in financial markets [17][18][19][20], forewarning of financial crises [19][20][21][22][23][24][25][26], and structural changes of financial networks [26][27][28][29].
The above three efforts are related to the EMH in one way or another.For ease of discussion, we need to distinguish among three forms of EMH [1][2][3][4][5].One is the "weak" form, which states that prices on traded assets fully reflect all past publicly available information.The second is the "semi-strong" form, which states that not only prices fully reflect all publicly available information, but also that prices instantly change to reflect new public information.The third is the "strong" form, which states that prices instantly reflect even hidden "insider" information.Thus, whatever form of efficiency is referred to, if a market behaves as the EMH stipulates, the market will be fully random without memory and the variation of price will be very unpredictable.These properties form the basis for testing whether EMH holds or not.
Empirical studies testing the validity of EMH in various markets include the use of traditional statistical analysis such as computing autocorrelation, variance ratio, delay, etc. [30][31][32][33][34], and using metrics from complexity science.By the nature of EMH discussed above, the notion of deterministic complexity is more pertinent than structural complexity in testing the validity of EMH, since deterministic complexity measures the randomness of the data and is a nondecreasing function of the entropy rate (e.g., Shannon entropy or Kolmogorov-Sinai entropy), while structural complexity is maximized for neither high nor low randomness [35][36][37][38][39].In this paper, by market complexity, we mean the deterministic complexity, and by market complexity change, we mean deviations of the market from a complete randomness as stipulated by EMH.Mechanisms responsible for this behavior could be multiple, including policy-induced nonlinear effects.We emphasize that the randomness discussed here pertains to the entire market, though it can be readily extended to study individual companies.The distinction between the entire market and individual companies of the market is that a composite index of a stock market is inherently more random than stock prices of some of the companies, since the index is a weighted average of the prices of all the companies listed in the market.It is more difficult for the entire market to deviate from EMH than for an individual company to do so.
Three good ways have been developed from complexity science for testing the validity of EMH.One is to directly measure the memory in the market.An apt measure of memory is the Hurst parameter H, which lies in the unit interval.Depending on whether H is smaller than, equal to, or larger than 1/2, a system is said to have anti-persistent, short-term, or persistent long-range correlations [36,40].Deviations of H from 1/2 is strong evidence of inconsistency with the EMH [41][42][43][44][45][46][47][48][49].Another approach is to use the Lempel-Ziv complexity (LZ) [38,39,50,51].Here, it is particularly worth noting that there appears to be more predictability in individual stock returns when using high-frequency instead of low-frequency daily data [38,39].The third approach is to use permutation entropy (PE), which quantifies the deviation of a market from a fully random state.Interesting prior research suggests that emerging markets are less efficient than developed ones [52][53][54].PE was first introduced in [55] as a measure of the departure of a time series under study from a completely random one: the closer the value of the PE to 1, the more stochastic the time series is.Since then, many important works have been developed to enrich the study of PE [56][57][58][59][60][61][62].Over the last decade, besides applications in econophysics, PE and related metrics have been extensively used to study various kinds of biological time series [59,[63][64][65][66][67][68][69][70][71][72][73].
Many published works along the line of distribution analysis and testing for the validity of EMH focus on the gross property of some economic variables in a given long time span, sometimes with quasi-universal features that are shared by many different markets.While in physics those features may be associated with the invariants of the financial system (and hence are extremely important), in finance they amount to average behavior, and thus may not shed much light on the temporal evolution of a market.Consequently, they cannot help much with the studies of stock crashes and financial crises.To overcome this difficulty, in this paper we propose to work with high-frequency financial data instead of low-frequency (such as daily) data.We examine whether PE can be further utilized to quantify complexity changes of the two stock markets in China-namely, the Shanghai Stock Exchange (SSE) and the Shenzhen Stock Exchange (SZSE).
The remainder of the paper is organized as follows.In Section 2 , we describe the data used in the study, the algorithm of PE for detecting the dynamical changes in time series, and a nonlinear adaptive filter for determining a trend signal from a highly fluctuating signal.In Section 3, We compute PE day by day, then examine the dynamic changes of complexity in Chinese stock markets.In Section 4, we make concluding discussions.

Data
We analyze the high-frequency (per minute) composite indices of SSE and SZSE from January 2, 2003 to August 8, 2016.In China, the trading time of a trading day for both markets is from 9:30 to 11:30 in the morning and 13:00 to 15:00 in the afternoon from Monday to Friday.Thus there are 240 data points for each trading day.
Concretely, we examine the minutely logarithmic yields of the composite indices of SSE and SZSE,

PE for Detecting Dynamical Changes in a Time Series
PE is a measure from chaos theory that can tell how much a time series deviates from a completely random one [55,59].It can be described as follows.
Given a time series {x(i where m is the embedding dimension and L is the delay time.The elements of X i can be sorted in ascending order as [x(i + (j In case an equality occurs (e.g., x(i + (j k1 − 1)L) = x(i + (j k2 − 1)L)), then these two elements are ordered according to whose j's are smaller: if j k1 < j k2 , then we write x(i + (j k1 − 1)L) ≤ x(i + (j k2 − 1)L).Therefore, the vector X i is mapped onto (j 1 , j 2 , • • • , j m ), which is one of the m! permutations.There will be at most m! different (j 1 , j 2 , • • • , j m ), since some of them can be the same.Denote the number of distinct (j 1 , j 2 , • • • , j m ) by K, which cannot be greater than m!.Let the probability for each one of them be denoted by P 1 , P 2 , • • • , P K .The permutation entropy (denoted by E p ) of the time series The maximum of E P (m) is ln(m!) when To detect interesting dynamical changes in a time series, one can partition a time series into overlapping or non-overlapping segments of short length, compute PE from each segment, and examine how PE changes with the segments.This approach was first introduced in [59].Here, we apply this approach to compute PE from the minutely logarithmic yields of the composite indices of SSE and SZSE on each day, then check how PE varies with time.

Detrending Method
The detrending method to be used here is based on a nonlinear adaptive multiscale decomposition [74][75][76][77].It first partitions a time series into segments of length w = 2n + 1, where neighboring segments overlap by n + 1 points (this introduces a time scale of w+1 2 τ = (n + 1)τ, where τ is the sampling time).
Each segment is then fitted with an optimal polynomial function.We denote the fitted polynomials for the i-th and (i + 1)-th segments by y (i) (l 1 ) and y (i+1) (l 2 ), respectively, where l 1 , Then, we obtain a single function for the overlapped part by weighting the consecutive segments as follows: where and w 2 = l−1 n are weights measuring how close between the lth point of the overlapped part and the centers of y (i) and y (i+1) , respectively.Such a weighting can maximally suppress the effect of complex nonlinear trends on the scaling analysis.This filter has been shown to be excellent in determining a trend, removing noise, and performing fractal and multifractal analysis.

Dynamic Changes of Markets' Complexity
For a number of embedding dimensions m and delay time 1, we have computed the value of the PE for the per-minutedata of SSE and SZSE on each day.The shape of the curve for the temporal variations of the PE for different m is similar.Below, we use m = 5 for illustration.The results are shown in Figures 1 and 2 for the two markets, respectively, as the blue curves.For ease of interpretation, the trend signals are obtained using the nonlinear adaptive filter described above (with a temporal resolution of 131 days) and plotted in each figure as the red curves.To compare with the composite indices of the two markets, they are re-normalized and plotted there as the black curves.We clearly observe that the curves of PE for the two markets exhibit a significant downhill and uphill during two periods: one is from the middle of 2006 to the end of 2010, and the other is from the middle of 2014 to the beginning of 2016.During both periods, China's stock markets encountered serious systemic risks.Therefore, a significant decrease in PE can be readily related to the change of markets' complexity.Specifically, on the one hand, the first dramatic decrease of PE in either period coincided with the initiation of bull markets; on the other hand, the significant decrease and subsequent recovering of PE strongly suggest that the stock markets in China are far less developed, since the PE is very close to 1 for those developed markets, as shown in [61].Further, we compared the difference of PE between the normal periods and the turbulent periods.There were two turbulent periods.They were not defined based on the curves shown in Figures 1  and 2. Rather, they were defined by general understanding and accepted by relevant governmental agencies in China.The first one was from the end of 2006 to the end of 2010.It started with a strong bull market until October 2007.Then came a series of stock crashes, followed by a gigantic impact from the global financial crisis.Although the Chinese government allocated 4 trillion funds to stimulate the economy, the effect of the global financial crisis lasted until the end of 2010, when the US economy largely recovered [24].The other turbulent period was more recent, which was from the second half of 2014 to February 2016.This period was also characterized by an unusually strong bull market until June of 2015, then came a few gigantic stock crashes until the market was finally stabilized around February of 2016.All other periods are collectively called "normal periods" in this paper.We have computed the probability density function (PDF) for the PE in these two types of periods.The results are shown in Figure 3. Visually, the distributions in the two periods are very different.This is formerly tested by conducting a Kolmogorov-Smirnov test (K-S test).The P-value of the K-S test is far below 0.01, meaning that the distributions of PE for normal periods and turbulent periods are significantly different.Moreover, a t-test is conducted to examine whether the mean value of PE in turbulent periods is significantly smaller than that in normal periods.The mean value of PE for SSE in turbulent periods is 0.83, while in normal periods it is 0.96, and the P-value of our t-test is far less than 0.01, meaning that the PE in turbulent periods is significantly smaller than that in normal periods.Therefore, the market complexity in turbulent periods can be concluded to be significantly different from that in normal periods-clearly, significantly smaller than that in normal periods.

Shenzhen vs. Shanghai Market
As can be clearly seen from Figures 1 and 2, the values of PE for the SSE and SZSE are different.To quantify how different they are, we have further computed the probability that the PE of the SSE is smaller than that of the SZSE.This can be computed by the following ratio: Probability(Pe sh > Pe sz ) = Number o f days when (Pe shanghai > Pe shengzhen )/Total number o f days (5) We find Probability(Pe sh > Pe sz ) = 83%.Therefore, for most trading days, the PE in the Shenzhen market was smaller than that in the Shanghai market, suggesting that the Shanghai market is relatively more stochastic than Shenzhen market (i.e., the Shenzhen market is a little more structured and predictable).This reflects the fact that the Shenzhen market consists most of the medium-to small-sized companies in China; they are relatively less stable than the large companies.

Surrogate Data Analysis
To better appreciate how significantly the PE of the composite indices are smaller than 1 for the SSE and SZSE, for each trading day we have also computed PE for the shuffled surrogate of the original series.Due to the similarity, only the the result for SZSE is shown in Figure 4 as the green curve.Clearly, the PE of the shuffled data is very close to 1, and on most days larger than the daily PE based on the original high-frequency stock index data.As expected, the results based on the shuffled data are similar to the results reported in [61] based on low-frequency daily data.

Concluding Discussions
Financial time series analyses have played an important role in developing some fundamental economic theories.However, many of the analyses of financial time series published so far focus on the long-term behavior of a market.While in mathematics and physics, the long-term behaviors are associated with invariants of the system and are therefore are of fundamental importance, in finance, long-term behaviors amount to average behavior, and thus shed little light on the temporal evolution of a market.However, a market is a wild beast, consisting of strong bull markets which offer investors (big or small), opportunities to make huge profits, and stock crashes and financial crises, which often wipe out enormous wealth on paper.Intrigued by the question of whether a market's complexity may change during a stock crash or financial crisis, we have sought to analyze high-frequency stock indices using the PE.By examining the temporal variation of the PE in the two Chinese stock markets (SSE and SZSE), we have found that PE decreases significantly in two significant time windows-each encompassing a rapid market rise and then a few gigantic stock crashes.One window started in the middle of 2006, long before the 2008 global financial crisis, and continued up to early 2011.The other window was more recent, starting in the middle of 2014, and ending in the middle of 2016.
Our result has a few important implications.First, since both windows with significant drop in the PE were at least one year long, and proceeded stock crashes by at least a half year, the decrease in PE can be an invaluable warning sign for regulators and investors alike.Second, the US stock market is generally thought to be efficient [2].Indeed, we have applied the same approach to the high-frequency data of Dow Jones Industrial Average (DJIA), and found that the PE of DJIA is close to 1, even during the 2008 global financial crisis.This is in stark contrast with the results shown for the Chinese stock market, which has not been efficient most of the time in the past 13 years, especially in the two long turbulent time periods identified here.Thus, our result constitutes one of the most compelling pieces of evidence that emerging markets like those in China deviate significantly from what the EMH has stipulated-especially during stock crashes and financial crisis.Much of this structural change may be attributed to governmental interference [5].Third, our finding may contain some universal element, in the sense that the phenomenon identified is not unique to China but shared by many emerging markets and even some developed markets.This issue can be readily sorted out by joint efforts from an international community.

Figure 1 .Figure 2 .
Figure 1.Dynamic changes of the Shanghai market's complexity characterized by the permutation entropy (PE; the blue curve) and its trend (the red curve); the rescaled Shanghai Stock Exchange (SSE) Composite Index is presented as the black curve.The smallest PE occurred on January 4 and 7, 2016, when the market was closed due to crashes triggered by the implementation of the circuit breaker mechanism; soon after, the circuit breaker approach was abandoned.

Figure 3 .
Figure 3.A comparison of probability density function (PDF) for PE between the normal periods (blue) and the turbulent periods (red) for (a) SSE and (b) SZSE.

Figure 4 .
Figure 4.The PE of SZSE (the blue curve) and its trend (the red curve); as a comparison, PE of shuffled data for SZSE is also shown as the green curve.