Computing the Fractal Dimension of Stock Market Indices Melina Kompella, COSMOS 2014 Chaos is an ancient idea that only recently was developed into a field of mathematics. Before the development of scientific and mathematical thought, the universe was seemingly impossible to predict, but as these fields progressed, order was assigned to more aspects of nature. The development of calculus, specifically, led to the idea of a deterministic, and therefore predictable, universe. This idea was called the strict causality law, summarized by Heisenberg -- in the same paper in which he disproved it -- as, When we know the present precisely, we can calculate the future. 1 However, Heisenberg s uncertainty principle disproved this statement s validity by proving its premise to be impossible. The failure of the strict causality law was followed by the weak causality law, the idea of prediction of the approximate future based on knowledge of the approximate present. However, as the system progressed, its predictions grew increasingly unreliable, or chaotic, leading to Ed Lorenz s 1960 definition of chaos: Chaos occurs when the error propagation, seen as a signal in a time process, grows to the same size or scale as the original signal. 2 Despite their intrinsically unpredictable nature, chaotic systems can have local randomness and global determinism. 3 This structure is present in fractal systems, which are complex but self-similar repeating patterns. Fractals are most often created on a two dimensional surface using one dimensional lines, which would generally lead to their characterization as one dimensional objects. However, the one dimensional curve of a fractal fills a two dimensional space, giving a fractal structure a dimension that is neither one nor two. The exact dimension of a specific fractal, D, or the self-similarity dimension, can be calculated using the formula 4 : (magnification factor) D = number of smaller copies that fit in the larger copy
Where D is the dimension of the object in question. Before we apply this to a fractal structure, we can apply it to a simpler structure, a square for example. When a square is magnified by a factor of 3, the final copy can fit 9 of the original squares, and since a square is a two dimensional object, the equation is true. The same works for a three dimensional cube, which when magnified by a factor of 3 fits 27 original cubes. When applied to a fractal, specifically the Cantor set, 5 shown below, in which each line is magnified by a factor of 3 and produces 2 copies, the equation is given by 6 : 2 D = 3, or D = log(2)/log(3).6309 Fractal dimension is present in all fractal systems, even ones that are not computergenerated, and therefore imperfect. One such system is the stock market, which can be analyzed as a fractal and assigned a fractal dimension. The fractal structure of the stock market comes in contrast with the Efficient Market Hypothesis, which assumes that markets follow a random walk, making the impact of any new information essentially unpredictable. 7 However, rescaled range (R/S) analysis shows that the stock market, like many other systems, is not completely random, but has a long term memory that links patterns in its behavior over time, giving it a fractal structure. To analyze the stock market s fractal structure, we have to view it as a time series, or a series of points spaced out evenly in time, each having a value that corresponds to the behavior of the stock market at that point in time. We begin by demonstrating the process of R/S analysis, which was developed by H. E. Hurst, and originally applied to determine fluctuations in reservoir capacity. The equation we begin with in R/S analysis is 8 : N X(t,N) = (et MN) t = 1
Where et is the amount of water the reservoir accepts in a year t, and MN is the average amount of water it discharges per year over a number of years N. (Note that in an ideal reservoir 9 MN will be equal to the average et over N years, meaning the system will discharge as much water as it accepts.) This way, X(t,N) gives the deviation over N years. From this equation, we can find the range of deviations, R, by subtracting the minimum X(t,N) from the maximum X(t,N). Then, we divide R by the standard deviation of et, which we call S. Another, more general way to view this same equation is as a time series x = x1, x2,..., xn, with xm being the mean. We can define Z1 = (x1 xm), Z2 = (x2 xm),..., Zn = (xn xm). The numbers given by (xn xm) in this equation correspond to the numbers given by (et MN) in the reservoir equation. To imitate taking the summation of these numbers, we use Y1 = Z1, Y2 = (Z1 +Z2),..., Yn = (Z1 + Z2 +... + Zn). In this equation R = max (Y1, Y2,..., Yn) min (Y1, Y2,..., Yn), which again gives the range of deviations. This time, we divide R by the standard deviation of the time series x = x1, x2,..., xn, which we call S. 10 Both of these processes give us R/S, the rescaled range, for either a reservoir or any time series. Hurst created an equation to estimate R/S, which is given by 11 : R/S = c N H where c is a constant, 0<H<1, and H is the Hurst exponent. The value of Hurst s exponent can be used to predict the behavior of a system. If H = 1/2, the system will behave randomly. If 0<H<1/2, the system will most likely exhibit anti-persistent behavior, meaning it will behave in the opposite way than it has been behaving. If 1/2<H<1, the system s behavior will most likely be persistent, and it will continue to behave in the way it has been. Another way to demonstrate the meaning of H for the prediction of a system s behavior is with the equation 12 : C = 2 (2H 1) 1
With C being the correlation between the behavior of the system at different times. H equal to 1/2 gives C = 0, indicating no correlation between the system s past and future behavior. Where C<0 (or 0<H<1/2), the system behaves differently at different points in time, while where C>0 (or 1/2<H<1), the system behaves similarly at different points. These equations can be applied to find H for monthly S&P 500 returns using data from an extended period of time. R/S is calculated using the same equation used to calculate R/S for reservoirs, for many different N. In the example used in Peters s analysis of S&P returns, the data was collected over a 463 month period, calculating R/S for N between 463 and 6, as shown in table I below. Mandelbrot simplified the equation R/S = c N H to R/S = N H, from which we get H = log(r/s)/log(n). 13 So, on the graph of log(r/s) and log(n), (shown below in Figure A), H is approximately equal to the slope of the points plotted. Table and graph from Peters analysis of S&P monthly returns over a 463-month period 14
The final value for H that Peters calculated was 0.61 (plus or minus 0.03). 15 His calculation of H >1/2 means that the behavior of the stock market does not follow a random walk, but instead depends on its past behavior, giving the stock market a fractal structure. The significance of the Hurst exponent, H, is its direct correlation to the fractal dimension, D, which are related by the equation: 16 D = 2 H. The relationship between these values is a very strong indicator of the fractal structure of the stock market time series. In conclusion, chaos theory can be applied to assign order and detect patterns even in seemingly random systems, such as the stock market. R/S analysis, combined with the view of markets as time series, brings a new way to interpret patterns in stocks and prices as fractal structures. Analysis of the fractal dimension of the stock market as a whole may eventually lead the way to prediction of the market s behavior.
Endnotes: 1) Heinz-Otto Peitgen, Hartmut Jürgens, and Dietmar Saupe, Chaos and Fractals: New Frontiers of Science (New York, NY: Springer-Verlag New York Inc., 1992), 12. 2) Peitgen, Jürgens, and Saupe, Chaos and Fractals, 14. 3) Edgar E. Peters, Fractal Market Analysis: Applying Chaos Theory to Investment and Economics (New York, NY: John Wiley & Sons, Inc., 1994), 7. 4) David P. Feldman, Chaos and Fractals: An Elementary Introduction (Oxford, UK: Oxford University Press, 2012), 164. 5) Image taken from: David P. Feldman, Chaos and Fractals: An Elementary Introduction (Oxford, UK: Oxford University Press, 2012), 165. 6) Feldman, Chaos and Fractals, 166. 7) Edgar E. Peters, Fractal Structure in the Capital Markets, Financial Analysts Journal 45, no. 4 (Jul - Aug, 1989): 32, accessed 28 Jul, 2014, http://www.jstor.org/stable/4479238. 8) Peters, Fractal Structure in the Capital Markets, 33. 9) Peters, Fractal Structure in the Capital Markets, 33. 10) Peters, Fractal Market Analysis, 56. 11) Peters, Fractal Market Analysis, 56. 12) Peters, Fractal Structure in the Capital Markets, 34. 13) Peters, Fractal Structure in the Capital Markets, 34. 14) Images taken from: Peters, Fractal Structure in the Capital Markets, 35. 15) Peters, Fractal Structure in the Capital Markets, 35. 16) Malhar Kale and Ferry Butar, Fractal Analysis of Time Series and Distribution Properties of Hurst Exponent, Journal of Mathematical Sciences and Mathematics Education 5, no. 1 (Feb, 2010): 9, accessed 28 Jul, 2014, http://w.msme.us/2011-1-2.pdf.
Bibliography: Feldman, David P. Chaos and Fractals: An Elementary Introduction. Oxford, UK: Oxford University Press, 2012. Kale, Malhar and Ferry Butar. Fractal Analysis of Time Series and Distribution Properties of Hurst Exponent. Journal of Mathematical Sciences and Mathematics Education 5, no. 1 (Feb, 2010): 8-19. Accessed 28 Jul, 2014. http://w.msme.us/2011-1-2.pdf. Peitgen, Heinz-Otto, Hartmut Jürgens, and Dietmar Saupe. Chaos and Fractals: New Frontiers of Science. New York, NY: Springer-Verlag New York Inc., 1992. Peters, Edgar E. Fractal Market Analysis: Applying Chaos Theory to Investment and Economics. New York, NY: John Wiley & Sons, Inc., 1994. Peters, Edgar E. Fractal Structure in the Capital Markets. Financial Analysts Journal 45, no. 4 (Jul - Aug, 1989): 32-37. Accessed 28 Jul, 2014. http://www.jstor.org/stable/4479238. Images taken from: Feldman, David P. Chaos and Fractals: An Elementary Introduction. Oxford, UK: Oxford University Press, 2012. Peters, Edgar E. Fractal Structure in the Capital Markets. Financial Analysts Journal 45, no. 4 (Jul - Aug, 1989): 32-37. Accessed 28 Jul, 2014. http://www.jstor.org/stable/4479238.