## Bubble research and markov models

#1

In 2001, we explored the concept of game theory and discussed how it would become a prime area of research in the subsequent decade. This assessment proved true, particularly in the area of high-frequency trading (HFT). Many HFT techniques are directly or indirectly based on game theory.

However, that does not necessarily mean these tools and their automation are at the fingertips of most traders. Our focus now is on the technologies and combinations of technologies that will bring this methodology to the masses.

Traders, just like physicists, electrical engineers and mathematicians, take observational information and build simple models that capture one or more subsets of what they are measuring.

One area is modeling market bubbles. On June 3, 2013, Amundi Asset Management published “Bubbles and Regimes: Two Complementary Approaches.” Economists have long theorized that the financial crisis happened because of asset bubbles. The article attempted to build a model to detect them. Another hot topic is regime change, particularly in the context of risk-on/risk-off situations and how they affect the markets. Amundi’s researchers also studied this, ultimately constructing a model to predict at what price/time an asset bubble will burst.

Consider the power of this information. Alone, such knowledge could make you rich. Since January 2000, we have had three major crises: The dot-com collapse, the housing bubble and the start of the Greek crisis in 2011 (see “Short and timely,” below). Accurately predicting the bursting point and going short at the right time could have earned you a fortune once every five to eight years (as well as the subsequent rebound).

Their research used a model developed by Didier Somette in 1999. His idea was to apply a function to intensifying growth directly on the price series. When his model is applied to the main bubbles in 2000 and the equity bubble in 2008, the resulting curve shows outpaced growth followed by increasing corrections as we get close to the bubble bursting.

The regime-switching portion of the model focused on two simplified modes: Either the market goes up and volatility is low, or the market goes down and volatility is high. First, the regimes must be identified. One method uses current asset prices compared to past asset prices to determine these states with no thresholds set in advance. This is called the Markov regime-switching model. The Amundi model tried to determine the probability of being in a given mode in the future.

### Consistent performers

While bubble research is important, the problem with bubbles is they don’t happen often. It would be more helpful to develop a model that can identify trending vs. non-trending regimes. For this, we can turn to George Soros and the general theory of reflexivity.

Originally described by William Thomas in the 1920s as the Thomas theorem, the principle was simply defined as “the situations that men define as true, become true for them.”

If the above quote sounds vaguely familiar, that’s because sociologist Robert Merton built upon that in the 1940s and coined the term “self-fulfilling prophecy.” The theory was that people would accommodate their behaviors so that a prediction became true. In this way, prophecy has an effect on the outcome and can drastically alter the course of history.

In a 1994 speech, Soros attempted to explain his concept of reflexivity:

“There is an active relationship between thinking and reality, as well as the passive one, which is the only one recognized by natural science and, by way of false analogy, also by economic theory. I call the passive relationship the “cognitive function” and the active relationship the “participating function,” and the interaction between the two functions “reflexivity.”

Reflexivity is, in effect, a two-way feedback mechanism in which reality helps shape the participants’ thinking, which helps shape reality in an unending process.

This concept applies to the markets in the case of both bubbles and regime detectors. People see the market move up, for example, and this move accelerates as more people notice and don’t want to miss the trend. When the move ends, either no one is left to buy, or the risk of holding a position becomes too great.

A few years ago, I built an adaptive trend-following system based on cycle analysis. A simple model was added to detect the point at which traders noticed the trend and followed it. This greatly helped performance. On a basket of 25 futures markets, the system profited on more than half of all trades on a backtest from Jan. 3, 1991 through Aug. 20, 2015. “Normal” trend-following systems average win percentages between 25% and 35% over this basket and time frame.

But how do we better define these regime changes using new trading technologies? One area of research is big data. Another is looking at the market as a psychological model. For example, we could show 100 different trade charts (real or artificial data) and let traders tell you when they first detect trends and would attempt to buy. We could stop there or seek to identify the variables that traders use to identify these trends.

### Hidden Markov models

To understand Hidden Markov Models, we first need to understand Markov processes.

The key in a Markov process is that the future is independent of the past given the present. This means everything from the past is encoded into the current state of the world; the most accurate forecast of tomorrow is today. This is used in many fields from weather forecasting to finance to language processing.

Let’s assume we have a random process (see “Eye on tomorrow,” below). There is a 50% chance of moving one unit up and a 50% chance of moving one unit down. This is a kind of Brownian motion example because we have discrete time and space. The Markov process is illustrated beneath the scatter plot.

Note that this model has a potentially infinite number of states. For a real discussion of price signals, we may consider only prices in unit dollar amounts from $1 to $100. This gives us 100 states and a price that jumps up and down with 50% probabilities for each. The assumption that this price follows a Markov model reproduces the apparent randomness or “noise” of the day-to-day signal, while at the same time it is mathematically simple enough that it is possible to have practical algorithms for making real probabilistic predictions of future behaviors based on past results.

One of the classic examples of the power of Markov chains comes from two popular soft drinks, Coca-Cola and Pepsi. Let’s assume there are two facts: Given that a person’s last cola purchase was Coke, there is a 90% chance that that same person’s next purchase will also be Coke; and given that a person’s last cola purchase was Pepsi, there is an 80% chance that person’s next purchase will be Pepsi.

We can build a transition matrix from this (see “No Pepsi, Coke,” below). Notice how each row in the matrix adds up to 1.0. The top row is the last purchase being Coke and the bottom row is the last purchase being Pepsi. The first column is for the current purchase being Coke and the second column is for Pepsi. We also can represent this as a state transition diagram.

Now, we’re going to ask the following question: “Bob is a Pepsi purchaser. What is the probability that Bob will buy a Coke two purchases from now?”

The probability of buying a Coke two purchases from now is the probability of buying a Pepsi, Coke, then Coke plus the probability of buying a Pepsi, Pepsi, then Coke. Put formally:

Pr[Pepsi, x, Coke] = Pr[Pepsi, Pepsi, Coke] + Pr[Pepsi, Coke, Coke] = 0.8 * 0.2 + 0.2 * 0.9 = 0.34

So there is a 34% chance that Bob, a Pepsi purchaser, will buy a Coke two purchases from now.

We also can take a look at this buy squaring our transition matrix.

For this example, we are looking at the bottom left number in z. The bottom row is the first purchase being Pepsi, and the first column is the current purchase being Coke. As we can see from the matrix to the left, it is 34%.