# Modeling the Stock Market prior to large crashes

## 1 General guidelines for stock market modeling

Self-organization : Recently, statistical evidence has shown that the largest stock market crashes are outliers . We have proposed that they have a different origin than the usual day-to-day variations of the stock market. Several groups have argued that these crashes have strong analogies to the critical points much studied in statistical physics \[2-13\]. The analogy is based on a large body of work exploiting the many similarities between statistical physics and the financial markets \[14-17\].

On what one might refer to as the “microscopic” level, the stock market has characteristics with strong analogies to well-known microscopic models in statistical physics. The individual trader has only $`3`$ possible actions (or “states”): selling, buying or waiting. The transformation from one of these states to another is furthermore a discontinuous process due to a threshold being exceeded, usually the price of the stock. The transition involves another trader and the process is irreversible, since a trader cannot sell the stock he or she bought back to the same trader at the same price. Furthermore, the individual traders only have information on the action of a limited number of other traders and in general only see the cooperative response of the market as a whole in terms of an increase or decrease in the value of the market.

Strong positive feed-back is also present and is usually referred to as trend-chasing. Even though one usually divides the market actors into two classes, typically referred to as fundamentalists<sup>1</sup><sup>1</sup>1Fundamentalists are traders, who base their expectations of the future stock value on economical criteria. and technical analysts, all participants must behave as trend-chasers to some extent in order to maximize profits<sup>2</sup><sup>2</sup>2An investor, who is continuously acting against the trend, will eventually lose his or her money.. This means that we are dealing with a system, where the actions of the trader(s) determine the value of the stock, which determines the actions of other traders and so forth. Hence, the stock market is a prime example of a self-organising system and it is thus natural to think of the stock market in terms complex systems with analogies to dynamically driven out-of-equilibrium systems such as earthquakes, avalanches, crack propagation etc.

Market structure : The stock market also differs from most spatially extended systems in several ways. First, there is the question of “distances”,i.e., when are two traders “close enough” to be influencing each other’s actions. As the present computerization of the trading clearly illustrates, this has certainly nothing to do with the $`2d`$ Euclidean space we inhabit and also previously the telephone, telegraph, Telex etc. made physical distances of minor importance. Furthermore, traders do not hold a “fixed position” in relation to other traders, but “move around” continuously interacting with other traders establishing new correlations. Second, there is the question of what is the effective drive of the stock market. Naturally, developments in the world economy play a significant role in determine the behaviour of the stock market (just as the motion of continental and sub-continental plates due to the heat-transfer from the interior of the earth plays a role for earthquakes ), but other factors, e.g., to what degree the relevant information is available or the present “signal-to-noise ratio”, play just as large or even larger role. The fundamental question is that since we are dealing with a social science, we enter a field that lacks “first principles” and where the fundamental equations are unknown. This has profound consequences and means that one must be very cautious in the choice of approach to the subject. Interesting enough, we may again turn to the field of statistical physics for inspiration and guidelines.

Landau expansion : A very powerful and general tool used in the studies of phase transitions is that of Landau expansions. In essence, Landau expansions amounts to assuming some functional relationship $`F\left(x\right)`$ between the relevant observable and the corresponding governing parameter. A general form of an evolution equation for $`F`$ is can then be derived by expanding $`F`$ around $`0`$ to arbitrary order 

$$\frac{d\mathrm{log}F\left(x\right)}{d\mathrm{log}x}=\alpha F\left(x\right)+\beta F^2\left(x\right)\mathrm{},$$
(1)   
where in general the coefficients may be complex. Using symmetry arguments, one may reduce the complexity of equation (1) by proving that certain coefficients in the expansion must be zero. Furthermore, conservation rules and equivalent arguments may further simplify the problem putting some bounds on the values of the remaining coefficients. Since this method only uses symmetry and conservation arguments, which are independent of the specific microscopic rules of the system, Landau expansion carries enough generality to be applied to a complex problem such as the stock market.

Rationality : Another basic principle which must be recognized in any modeling approach of the stock market is that of rationality. Contrary to the general perception in the physics community of the stock market as populated by irrational herds, traders in general do exhibit a rational behaviour where they try to optimize their strategies based on the available information. This one may refer to as “bounded rationality”  since not only is the available information in general incomplete, but stock market traders do also have limited abilities with respect to analysing the available information. This means that the process of decision making is essentially a “noisy process” and, as a consequence, that a probabilistic approach in stock market modeling is unavoidable. Clearly, a noise free stock market with all information available occupied by fully rational traders of infinite analysis abilities would have a very small trading volume, if any.

Statistical time asymmetry : A much neglected question in the modeling of the stock market is that of symmetry. Most models of the stock market, statistical, such as the GARCH model , or microscopical  are symmetric with respect to draw-downs and draw-ups i.e., that large/small price movements in either direction are typically followed by large/small price movements in either direction. The point we would like to stress here is that this symmetric behaviour of these artificial indices is not compatible with what is seen in the Dow Jones Average in general . Especially in the case of the large crashes analysed here, it is clear by just looking at the index that the build-up has been relatively slow and the crash quite rapid. In other words, “bubbles” are slow and crashes are fast. Furthermore, symmetry with respect to draw-downs and draw-ups is equivalent to a stock market dynamics which is invariant with respect to time reversal. That this should be the case is clearly absurd on any longer time scales<sup>3</sup><sup>3</sup>3Since any long term change is an accumulation of short term changes, symmetry of short term changes can only be a first approximation.. This means that not only must a long-term model of the stock market prior to large crashes be highly non-linear but it must also have a “time-direction” in the sense that the crash is “attractive” prior to the crash and “repulsive” after the crash. The importance and evidence of statistical time reversal symmetry breaking in the sense of Pomeau  is being increasingly studied .

Guidelines : Before we continue with the more technical aspects of our stock market analysis, let us list what we believe to be essential guidelines in the modeling of the financial markets:

* Since the fundamental equations governing the financial markets are unknown, it is essential that we a priori identify the symmetry and conservations laws that applies, if any.
* Since the participants of the financial markets are unable to fully optimize their strategies due to incomplete information and limited abilities with respect to analysing the available information, a probabilistic approach to stock market modeling is unavoidable.
* Without systematic comparison between the predictions of the model and real data, no validation is possible.
* Any long-term model of the stock market must address the time asymmetry of market fluctuations observed in the real stock market.

In the next section we will briefly describe a model which is based on these fundamental guidelines. In the third section, we compare the predictions of our model with real stock market data and briefly discuss an alternative approach to such data estimation. The last section concludes.

## 2 The model

The model is explained in detail in  and we briefly list the key-assumptions and basic components. The first is that a large crash is caused by local self-reinforcing imitation between traders. In the presence of noise, this self-reinforcing imitation process eventually leads to a bubble. If the tendency for traders to “imitate” their “friends” increases up to a certain point called the “critical” point, many traders may place the same order (sell) at the same time, thus causing a crash.

The interplay between the progressive strengthening of imitation and the ubiquity of noise requires a stochastic description. This means that a crash is not certain but that its probability can be characterized by a rate $`h(t)`$ equal to the probability per unit time that the crash will happen in the next instant if it has not happened yet.

Second, since the crash is not a certain deterministic outcome of the bubble, it remains rational for traders to remain invested provided they are compensated by a higher rate of growth of the bubble for taking the risk of a crash, because there is a finite probability of “landing” smoothly, i.e. of attaining the end of the bubble without crash. In this model, the ability to predict the critical date is perfectly consistent with the behavior of the rational agents: they all know this date, the crash may happen anyway, and they are unable to make any abnormal risk-adjusted profits by using this information. We emphasize that the model distinguishes between the end of the bubble and the time of the crash : the rational expectation constraint has the specific implication that the date of the crash must have some degree of randomness. Hence, the theoretical death of the bubble is not the time of the crash and the crash could happen at any time before, however not very likely. The death of the bubble is simply the most probable time for the crash.

The model does not impose any constraint on the amplitude of the crash. We have considered two possibilities, which offers a plausible scenario for bubbles on long and short time scales, respectively. If we assume that the size of the crash is proportional to the current price level, then the natural variable is the logarithm of the price. This is the hypothesis which was pursued in  considering build-ups over $`8`$ years. If instead, we assume that the crash amplitude is a finite fraction of the gain observed during the bubble, then the natural variable is the price itself. This hypothesis should apply to relatively short time scales of about two years and was pursued in .

A crash happens when a large group of agents place sell orders simultaneously, which brings us to the question of how the agents interact. We have proposed the following description : all the traders in the world are organised into networks of family, friends, colleagues, etc. Hence, the opinion of a trader is influenced by (a) the opinions of these people and (b) an idiosyncratic signal that the trader alone generates.

The last ingredient of the model is to recognize that the stock market is made of actors which differ in size by many orders of magnitudes ranging from individuals to gigantic professional investors, such as pension funds. Structures at even higher levels, such as currency influence spheres (US$, Euro, YEN …), exist and with the current globalisation and de-regulation of the market one may argue that structures on the largest possible scale, i.e., the world economy, are beginning to form. This means that the structure of the financial markets have features which resemble that of hierarchical systems with “agents” on all levels of the market. (Of course, this does not imply that any strict hierarchical structure of the stock market exists.) Models  of imitative interactions on hierarchical structures predicts that the first order expansion of the general solution for the crash hazard rate is then

$$h(t)B_0(t_ct)^\alpha +B_1(t_ct)^\alpha \mathrm{cos}[\omega \mathrm{log}(t_ct)\psi ^{}]$$
(2)   
and similarly that the evolution of the price before the crash and before the critical date is given by:

$$p(t)p_c\frac{\kappa }{\beta }\left\{B_0(t_ct)^\beta +B_1(t_ct)^\beta \mathrm{cos}[\omega \mathrm{log}(t_ct)\varphi ]\right\}$$
(3)   
where $`\varphi `$ is another phase constant. The key feature is that log-periodic oscillations appear in the price of the asset before the critical date $`t_c`$. These oscillations are controlled by a prefered scaling ratio $`\lambda =e^{2\pi /\omega }`$ characterising the hierarchical structure of the stock market. Including the next order term in the expansion is useful for analyzing data over long period of times  for which the relevant observable is the logarithm of the price :

$$\mathrm{log}\left[\frac{p(t)}{p_c}\right]\frac{(t_ct)^\beta }{\sqrt{1+\left(\frac{t_ct}{\mathrm{\Delta }_t}\right)^{2\beta }}}\left\{B_0+B_1\mathrm{cos}\left[\omega \mathrm{log}(t_ct)+\frac{\mathrm{\Delta }_\omega }{2\beta }\mathrm{log}\left(1+\left(\frac{t_ct}{\mathrm{\Delta }_t}\right)^{2\beta }\right)\varphi \right]\right\}.$$
(4)   
## 3 Data analysis

### 3.1 Previous results

In a series of work  it has been shown that the time-evolution of the stock market index prior to the 1929, 1987 and 1998 crashes on Wall Street and the 1997 crash in Hong-Kong are in very good agreement with the predictions of the model presented in the previous section. Specifically, the Dow Jones and the S&P 500 was well-described  by equation (3) over a time interval approximately $`2.5`$ years prior to the four crashes mentioned. Furthermore, for the 1929 and 1987 crashes on Wall Street this time interval could be extended to almost $`8`$ years using equation (4).

As discussed in the previous section, within the framework of the model presented here as well as from general arguments, the exponent in equations (3) and (4) must obey the inequalities $`0<\beta <1`$. The first inequality ensures that the stock market index remains finite. The second inequality describes an acceleration of the bubble and of the crash hazard rate. In the case of the four crashes mentioned above, we consistently found  values for $`\omega `$ in the range $`\left[6.4:7.9\right]`$ corresponding to a preferred scaling ratio of $`\lambda =e^{2\pi /\omega }=2.45\pm 0.25`$ governing the log-periodic oscillations. For the exponent we found a somewhat broader range of values with $`\beta _{29}=0.45`$, $`\beta _{87}=0.33`$, $`\beta _{97}=0.34`$ and $`\beta _{98}=0.60`$. That the values of the preferred scaling ratio is within $`10\%`$ for the four large crashes in this century is in fact quite amazing a priori and reassuring from a theoretical point of view. Also the larger fluctuations in the value of the exponent can be explained within the proposed framework, since it is known that noise will renormalize the exponent. In Ref., it is shown that the exponent $`\beta `$ is realization dependent and obeys the following equation :

$$\lambda ^\beta =\mu ,\mathrm{leading}\mathrm{to}\beta =\frac{1}{2\pi }\omega \mathrm{ln}\mu ,$$
(5)   
where $`\lambda =e^{2\pi /\omega }`$. The parameter $`\mu `$ is a scaling factor for the observable. Expression (5) shows that realization dependent fluctuations of $`\omega `$ and $`\mathrm{ln}\mu `$ contribute multiplicatively to the fluctuations of $`\beta `$. If the relative magnitude of the fluctuations $`\frac{\mathrm{\Delta }\mathrm{ln}\mu }{\mathrm{ln}\mu }`$ of $`\mathrm{ln}\mu `$ is of the same order as $`\frac{\mathrm{\Delta }\omega }{\omega }=\frac{\mathrm{\Delta }\lambda }{\lambda }10\%`$, we obtain the estimation $`\frac{\mathrm{\Delta }\beta }{\beta }20\%`$, which may rationalize the range of values $`0.330.45`$ found for $`\beta `$ for three of the crashes at the exclusion of the most recent one in August 1998. A possible explanation for the anomalously large value $`\beta _{98}=0.60`$ is the “grey-monday” Oct. 1997 –$`7\%`$-correction– on Wall Street, which clearly decreased the acceleration of the index.

These fluctuations in the exponent $`\beta `$ have led other groups to suggest a different scenario than the one proposed by equation (3). In two recent papers  N. Vandewalle al. suggest that equation (3) should be replaced with

$`F\left(t\right)`$ $`=`$ $`A+B\mathrm{ln}\left({\displaystyle \frac{t_ct}{t_c}}\right)\left[1+C\mathrm{cos}\left(\omega \mathrm{ln}\left({\displaystyle \frac{t_ct}{t_c}}\right)+\varphi \right)\right].`$ (6)   
Equation (6) is well-known in statistical physics where it describes a special class of phase transitions characterized by a logarithmic divergence.

There are a number of implications involved in replacing equation (3) with equation (6) not explicitly considered by N. Vandewalle al. In their papers, they state that equation (6) correspond to equation (3) in the limit $`\beta 0`$. This is not entirely true, which can easily be seen by rewriting the leading term of equation (3) substituting $`x=t/t_c`$

$`p\left(t\right)`$ $`=`$ $`A+B\left(1x\right)^\beta =A+Be^{\beta \mathrm{ln}\left(1x\right)}`$ (7)   
$``$ $`A^{}+B^{}\mathrm{ln}\left(1x\right)\text{ for }\beta \mathrm{ln}\left(1x\right)1`$ (8)   
Hence the expansion above is valid in the limit $`\beta 0`$ provided the term $`\mathrm{ln}\left(1x\right)`$ remains finite. This touches with a rather troublesome feature of equation (6). Going from equation (3) to equation (6) implies that the value of the stock market index at the time of the crash $`t_c`$ is no longer finite but diverges, i.e., in the two cases we have $`lim_{tt_c}F\left(t\right)=A`$ and $`lim_{tt_c}F\left(t\right)=\mathrm{}`$, respectively<sup>4</sup><sup>4</sup>4N. Vandewalle al. report incorrectly the sign of the exponent in their reference of our previous work and hence erroneously conclude that the proposed relation (3) diverges for $`t=t_c`$. Let us also note that equation (3) in  should read $`\frac{t_{n+1}t_n}{t_nt_{n1}}=\lambda `$ which is an example of Shank’s transformation for the acceleration of the convergence approximately geometric series . Last, the correct relation between $`\lambda `$ and $`\omega `$ is $`\omega \mathrm{ln}\lambda =2\pi `$ and not $`\mathrm{ln}\lambda =\omega /2\pi `$ as reported in .. The notion of the stock market index going to infinity seems rather unrealistic for the following reasons. A stock market with infinite prices means that all traders must have infinite wealth, not only one. If we assume steady cash-flow and not hyper-inflation this is clearly impossible. Furthermore, if we believe Pareto’s law with its finite first moment to be a valid discription of wealth distribution, prices cannot go to infinity.

Another theoretical objection to equation (6) comes from the fact that we are considering a very special class of models with logarithmic divergences. If, as we believe, phase transitions provides a valid framework for the description of certain dynamical features in the financial markets, it seems very difficult to justify that the analogies between phase transitions and large stock market crashes should be limited to a very special class characterized by logarithmic divergens. On the contrary, we have above proposed a model which does not make unrealistic assumptions about the dynamics of the stock market nor contains economical abnormalities such as an infinite stock market index.

### 3.2 Which universality class?

As previously mentioned, the two equations do have a similar behaviour for $`\beta \mathrm{ln}\left(1t/t_c\right)1`$. Hence, from a technical trading point of view it might be interesting to compare the numerical performance of equations (3) and (4) on one hand and (6) on the other. Especially, the condition $`\beta \mathrm{ln}\left(1t/t_c\right)1`$ need to be quantified, i.e., when are we too close to $`t_c`$ for equation (6) to be a good approximation. In order to do so in a consistent way, we have implemented equation (6) in the same numerical algorithm used in  in fitting equation (3) and its second order extension to the stock market index, equation (4). We emphasize that contrary to the view expressed in , the numerical estimation procedure of fitting equation(3) used does not involve a 7-parameter nonlinear fit. This, since any linear parameter in a fitting function can be expressed in terms of the nonlinear parameters by demanding that the chosen cost-function has a zero derivative in a minimum with respect to the linear variables. This means that fitting equations (6), (3) and (4) simply amounts to a 3-, 4- and 6-parameter nonlinear fit, respectively. Among these, the phase $`\varphi `$ is simply a time-unit and has no influence on the value of the other parameters<sup>5</sup><sup>5</sup>5This can easily be verified by a change in time-unit from, e.g., days to months: the value of $`\varphi `$ is changed, but the value of the other parameters remains the same..

Before we proceed with the data analysis, let us briefly comment on the numerical work presented in . The authors claim that one of the advantages of equation (6) over equation (3) is that the number of parameters to fit is reduced by one yet they do not fit equation (6) to the stock market index. Instead they truncate equation (6) and only fit the leading term setting $`C=0`$. This fit is then compared with a pure power law plus a constant, i.e., equation (3) with $`C=0`$. The period of the log-periodic oscillations is instead estimated by localizing in a non-systematic way, specifically by eye-balling, the local extrema of the log-periodic oscillations. This procedure will in general introduce some systematic errors. First, since the logarithmic law (or for that sake a pure power law) can only capture the average rise in the data, the fit becomes sensitive to whether we use a minimum or a maximum as the starting point for the data set. Specifically, the fit of the S&P500 with a pure logarithmic rise gives $`t_c=87.96`$ using the minimum of $`80.0`$ as first point and $`t_c=88.07`$ using the following maximum of $`81.24`$ as first point, i.e. a difference of $`35`$ days. For a much shorter time series the effect is of course much more dramatic. Second, estimating maxima and minima by eye-balling may be quite reasonable as a first estimate. However, pattern recognition in general must be based on a deterministic algorithm in order to carry any real weight. Furthermore, it is not possible to compare the performance of different fitting functions if there are not implemented using more or less the same standard procedures. Needless to say, the eye-balling performed in  is not such a standard procedure.

In order to have a completely deterministic algorithm, we have fitted the stock market data using the same standard numerical algorithms as in our previous work (see  for details). In order to fully compare the two approaches, we have chosen two large crashes with an almost $`8`$ years build-up as our test sample. Specifically, we have fitted the index almost 8 years prior to the 1929 and 1987 crashes on Wall Street with equations (6) and equation (4). In addition, we have tested the prediction of the “grey-monday” Oct. 1997 –$`7\%`$-correction– on Wall Street by N. Vandewalle et al. fitting the full equation (6) on the time-interval used in . We have also compared equation (6) with equation (3) on shorter time intervals of $`23`$ years analysed for four crashes in . As indicated by the expansion (8) and shown in figures 1-4, equation (6) does not perform very well “close” to the crash. Hence, the results from fitting equation (6) with these shorter time intervals were not convincing at all and we have not included the analysis on the shorter time intervals in the present paper.

#### 3.2.1 Fitting stock markets data

In figures 1-4 we see the relative error $`E`$ of the fitting function $`f`$ to the data $`y`$ defined as

$$E\left(t\right)=\frac{y\left(t\right)f\left(t\right)}{y\left(t\right)}$$
(9)   
as a function of $`\mathrm{log}\left(t_{crash}t\right)`$ for the 1929 and 1987 crashes on Wall Street. The interval fitted starts almost $`8`$ years prior to the two crashes and ends at the date where the index has achieved its maximum. In order to compare the fits of equations (6) and (4), we have used $`t_c=t_{crash}`$ in estimating the relative error of the fits to the data. Specifically, the dates used as $`t_{crash}`$ for the three data sets was $`29.81`$, $`87.79`$ and $`97.81`$,

In the case of the 1987 crash, the best fit also gave the most accurate estimate for $`t_{crash}`$ for both formulas. In the case of the 1929 crash, we show the two best fit of equation (6) together with the best fit of equation (4) according to the criterions described in . A few things are worth stressing:

* The fit with equation (6) overshoots $`t_{crash}`$ significantly more than reported in .
* The values obtained for $`\lambda `$ fitting equation (6) fluctuates by $`\pm 40\%`$, which is considerably more than the $`\pm 10\%`$ that is experienced with (3) and equation (4) <sup>6</sup><sup>6</sup>6The $`40\%`$ is also considerably larger than found in  using eye-balling..
* Equation (6) does not seem to capture the log-periodic oscillations very effectively.
* The error between the data and equation (6) grows significantly as $`t_{crash}`$ is approached.

What is interesting in this comparison is not so much the larger error by equation (6) compared to equation (4) for the 1929 and 1987 crashes, since this is to be expected due to the larger number of free parameters in the fit (3 against 6). The really interesting difference between the two approaches are the last two items above, and especially the fact that the error start to grow around nine month prior to $`t_{crash}`$ or earlier. This clearly shows that equation (6) is only a good approximation far from $`t_{crash}`$. The only possible conclusion in our opinion is that the time-dependent acceleration of the market price is not logarithmic and that the range where expansion (8) is valid is surprisingly restricted.

## 4 Conclusion

We have proposed a general set of simple guidelines for the modeling of financial markets. Using these guidelines, we have highlighted the key ingredients of a rational expectation model of the stock market. We find an excellent agreement between the predictions of the model and the evolution of the Dow Jones and S&P 500 indices prior to the largest crashes of this century. Last, we have shown that the proposition of N. Vandewalle al. of stock market crashes not only leads to economical abnormalities but also do not perform well when compared to data.

Acknowledgment

The authors are grateful to O. Ledoit and Dietrich Stauffer for many stimulating discussions.