Forecasting Financial Extremes: A Network Degree Measure of Super-exponential Growth

Investors in stock market are usually greedy during bull markets and scared during bear markets. The greed or fear spreads across investors quickly. This is known as the herding effect, and often leads to a fast movement of stock prices. During such market regimes, stock prices change at a super-exponential rate and are normally followed by a trend reversal that corrects the previous over reaction. In this paper, we construct an indicator to measure the magnitude of the super-exponential growth of stock prices, by measuring the degree of the price network, generated from the price time series. Twelve major international stock indices have been investigated. Error diagram tests show that this new indicator has strong predictive power for financial extremes, both peaks and troughs. By varying the parameters used to construct the error diagram, we show the predictive power is very robust. The new indicator has a better performance than the LPPL pattern recognition indicator.


Introduction
Many models are designed to describe the dynamics of financial bubbles and crashes, among which the log-periodic power law (LPPL) (also known as the Johansen-Ledoit-Sornette (JLS)) model [1][2][3][4] stating that bubbles are generated by behaviors of investors and traders that create positive feedback in the valuation of assets. Therefore, bubbles are not characterized by an exponential increase of prices but rather by a faster-than-exponential growth of prices. This unsustainable growth pace often ends with a finite-time singularity at some future time t c . After t c , the old regime with a faster-than-exponential growth rate is broken, and often but not always, the new regime is a dramatic fall over a short period, a financial crash. Yan et. al [5] extended the JLS model by introducing the concept of "negative bubbles" as the mirror image of standard financial bubbles. They found that positive feedback mechanisms also exist in negative bubbles, which are in general associated with large rebounds or rallies. Therefore, before financial extremes, like crashes and rebounds, a super-exponential growth in price is often observed. Measuring super-exponential growth in financial time series can be used to forecast financial extremes. Empirical observations of this super-exponential growth before crashes and rebounds in order to predict the turning points have been presented in many papers. For example, the 2006-2008 oil bubble [6], the Chinese index bubble in 2009 [7], the real estate market in Las Vegas [8], the U.K. and U.S. real estate bubbles [9,10], the Nikkei index anti-bubble in 1990-1998 [11], the S&P 500 index anti-bubble in 2000-2003 [12], the South African stock market bubble [13] and the US repurchase agreements market [14].
In 2008, Lacasa et. al [15] presented an algorithm which converts a time series into a network. The constructed network inherits many properties of the time series in its structure. For example, fractal time series are converted into scale-free networks, which confirm that power law degree distributions are related to fractality. This method has been applied to the financial time series, [16] as well as the energy dissipation process in turbulence [17].
In this paper, we combine the two powerful tools above and construct an indicator to measure the magnitude of the super-exponential growth of the stock price, by measuring the degree of the price network, generated from the price time series. By investigating twelve major international stock indices, we show that our indicator has strong power to forecast financial extremes.

Methods
Lacasa et. al presented an algorithm which converts a time series into a network, called visibility algorithm. The detailed construction method is as follows: consider each pair of points in the time series, note these two points as (t i , y i ) and (t j , y j ), where i < j. Then if all the data points between them are below the line which connect these two points, make a link between these two points. In other words, there is a link between two points (t i , y i ) and (t j , y j ), if and only if: The intuition of this algorithm is simple. Consider each point of the time series as a wall located at the x-axis value t and with the height of the wall is equal to the y-axis value y. Assume someone standing on the top of the wall at (t i , y i ), if she can see the top of the wall at (t j , y j ), then we make a link between these two points. Of course, the height of this person is ignored here. In this paper, we extend the above construction to a new algorithm which can be called the absolute invisibility algorithm. This is just the opposite of the visibility algorithm. Consider two points (t i , y i ) and (t j , y j ), where i < j. Then, if all the data points between these two points are above the line which connect them, make a link between these two points: To First we start to build the connection between the LPPL model and the visibility/absolute invisibility algorithms. Then, we will explain how to use these two powerful tools to predict financial extremes.
The LPPL model claims that during the bubble or negative bubble regime, the stock price grows or declines at a super-exponential rate, i.e. in a bubble regime, both the derivative and the second derivative of the log-price time series are positive; while in a negative bubble regime, both the derivative and the second derivative of the log-price time series are negative.
The trick here is to use log-prices instead of normal prices. We know that an exponentially growing time series in a logarithmic-linear scale is represented as a straight line. Therefore, a super-exponentially increasing time series in a log-linear scale is represented as a convex line with a positive slope. In contrast, a super-exponentially decreasing time series in a log-linear scale is represented as a concave line with a negative slope.
At this point, it is easy to find the connection between the LPPL model and the visibility/ absolute invisibility algorithms. The networks, which are constructed by the visibility/absolute invisibility algorithms, contain the information about the super-exponential growth of a time series. In more detail, suppose that an observer stands on the point (t i , y i ) in a log-linear scaled wall array, if he or she has the visibility of another point (t j , y j ) from here, we can roughly conclude that the growth rate between these two points is super-exponential. The more points that (t i , y i ) can see, the higher the confidence that the time series grows in a super-exponential rate at (t i , y i ). The number of the points that (t i , y i ) can see is exactly the degree of the visibility network at point (t i , y i )!
Based on the LPPL model, herding effect and imitation behavior generates super-exponential growth in stock market prices. The fast growth makes the financial system unstable and eventually leads to a sudden regime change, which is often, but not always, a crash in bubble regimes and rebound in negative bubble regimes. In consequence, the confidence of the superexponential growth rate should be a good proxy to measure how close it is to the point of the regime shift-the financial extremes. We therefore use the degree of visibility/absolute invisibility network to predict the peaks and troughs in the financial market prices.
However, in order to predict financial extremes, the degree of the visibility/absolute invisibility networks is not sufficient. We still need three more criteria: 1. To ensure the prediction condition, for any point in the time series, only the links to its left can be counted. The reason is obvious: at time t i , we do not know the "future" information {t j , y j }, j = i + 1, i + 2, Á Á Á.

2.
To ensure the extreme condition, the time series should be increasing before the peaks and decreasing before the troughs. Therefore, the link between (t i , y i ) and (t j , y j ) (suppose t i > t j ) is made only if y i > y j in a visibility network and y i < y j in a absolute invisibility network.
3. To ensure the normalization condition, the same scope should be applied for all the points. There is no link between (t i , y i ) and (t j , y j ) if ji − jj > S, even though all the other conditions are satisfied.
We build the financial extreme indicators based on the above discussion. A peak degree at time t i , i > S, noted as D peak (i), is defined as the number of js, where j satisfies: doi:10.1371/journal.pone.0128908.g002 By definition, D peak (i) 2 (0, S]. The peak indicator is defined as Similarly, the trough indicator at time t i is defined as I trough (i) = D trough (i)/S, where D trough (i), is the number of js, where j satisfies:

Results
We . We construct the peak/trough indicators for each of these indices. In this paper, the look-back scope S is set to be 262, since normally one calendar year has about 262 trading days. We take Hong Kong Hang Seng Index (HSI) as an example to give a general idea on how the indicators look like. Fig 3 shows the peak and trough indicators of HSI between Jul. 8,1994 and Jul. 7, 2014 (due to the construction, as the look-back scope S = 262, the indicators of the first 262 data points are not available). From the figure, one can easily find that when the peak indicator is high, the stock index is usually very close to a local peak; and when the trough indicator is high, the stock index is usually very close to a local trough. To better present this view, We also present the predictability of the indicators quantitatively by introducing the error diagram method [18,19].
In order to implement the error diagram, we have to define peaks/troughs first. For one stock index, the peaks/troughs are defined as the points which have the maximum/minimum value in b days before and a days after. Here we use b = 131 and a = 45, which correspond to half a year and two months in trading days respectively.
To give a brief idea that how the peaks and troughs look like in reality, we show the four most important examples: S&P 500, FTSE 100, STOXX Europe 600, and Hong Kong Hang Seng. In Figs 5-8, we display the index values together with the peak/trough indicators. At the same time the peaks and troughs defined by Eqs (9) and (10) are marked by red circles and green crosses respectively. The time when peaks and troughs occurred are also indicated in vertical dash-dotted lines and dashed lines respectively.
An error diagram for predicting peaks/troughs of a stock index is created as follows: 1. Count the number of peaks defined as expression Eq (9) or troughs defined as expression Eq (10).
2. Take the peak/trough indicator time series and sort the set of all indicator values in decreasing order. Consider that we have to use the first look-back scope days S to generate the indicator and a days in the end where we cannot define peaks/troughs (since we need a days in the future to confirm whether today is a peak/trough or not). The indicator time series here we used is actually I peak (i) and I trough (i), where S + 1 i T − a.
3. The largest value of this sorted series defines the first threshold.
4. Using this threshold, we declare that an alarm if the peak/trough indicator time series exceeds this threshold. Then, a prediction is deemed successful when a peak/trough falls inside the alarm period.
5. If there are no successful predictions at this threshold, move the threshold down to the next value in the sorted series of indicator. 6. Once a peak/trough is predicted with a new value of the threshold, count the ratio of unpredicted peaks/troughs (unpredicted peaks (troughs) / total peaks (troughs) in set) and the ratio of alarms used (duration of alarm period / prediction days, where prediction days equals to T − a − S). Mark this as a single point in the error diagram.
7. In this way, we continue until all the peaks/troughs are predicted.
The aim of using such an error diagram in general is to show that a given prediction scheme performs better than random. A random prediction follows the line y = 1 − x in the error diagram. This is simple because that if there is no correlation between the fraction of the predicted events should be proportional to the fraction of the alarms activated during the whole period. A set of points below this line indicates that the prediction is better than randomly choosing alarms. The prediction is seen to improve as more error diagram points are found near the origin (0, 0). The advantage of error diagrams is to avoid discussing how different observers would rate the quality of predictions in terms of the relative importance of avoiding the occurrence of false positive alarms and of false negative missed peaks/troughs. By presenting the full error diagram, we thus sample all possible preferences and the unique criterion is that the error diagram curve be shown to be statistically significantly below the anti-diagonal y = 1 − x.     It is very clear that all these curve, both for peaks and troughs, are far below the random prediction line y = 1 − x. This means our indicators are very powerful in predicting financial extremes. In general, troughs are better predicted than peaks. This might be due to the fact that stock moves are often wilder when investors panic.
An error diagram curve always starts at the point (0, 1) and ends at the point (1,0). In between, a random error diagram curve could be any monotone function in the unit square. Therefore, the p-values of our financial extreme indicators should be: where A is the area which is determined by the error diagram curve of the peak/trough indicator, the x-axis and the y-axis. Table 1 shows the p-values of peak/trough predictions for all the tested stock indices. The average p-value for peaks and troughs are 0.0991 and 0.0262 respectively. This means that the predictability of our peak/trough indicators are significant in a significance level 10% and 3% respectively.
One may doubt that the selection of the parameters S, a and b are arbitrary here. In fact, the selection above is only a reasonable practical decision as S = 262, b = 131 and a = 45 represents the number of trading days of one year, six months and two months respectively. The prediction power of the indicator is generally very strong no matter how we choose the parameters.    , which market we are measuring, and which type of extremes (peaks or troughs) we are testing, the preditability of our indicator is constantly strong. The mean of the median p-value of peaks and troughs for all the stock indices are 0.0982, 0.0288 respectively. That means the predictability of our peak/trough indicators are significant in a significance level 10% and 3% respectively.

Discussion
In this section, we will compare this new indicator with the LPPL pattern recognition indicator. The LPPL pattern recognition indicator is first presented by Sornette and Zhou [20]. By introducing the pattern recognition method developed by Gelfand et. al [21], Sornette and Zhou transform the probability prediction of the financial critical time in the standard LPPL model into a quantitative indicator of financial bubbles and crashes. Yan el. al extended this indicator to financial "negative bubbles" and rebounds [5], and made thorough tests on many major stock indices of the world [22]. Although the p-values of the predictability of this indicator are not clearly calculated in those papers, one can easily make an estimation from the error diagrams in these papers using Eq (11). Given that the mean of the median p-value of peaks and troughs for all the stock indices are 0.0982, 0.0288 respectively for our new network indicator, we could conclude that on average the new indicator has a better predictive power than the LPPL pattern recognition indicator.
In summary, we have constructed an indicator of financial extremes via the magnitude of the super-exponential growth of the stock price, by measuring the degree of the price network generated by visibility/absolute non-visibility algorithms with constrains. This new indicator has been applied to twelve major international stock indices. The peaks and troughs of the tested indices over the past 20 years can be effectively predicted by our indicator. The predictability of the indicator has been quantitatively proved by error diagrams. The performance of the indicator is robust to the parameters, and on average better than the LPPL pattern recognition indicator.