Image Image Image Image Image Image Image Image Image Image

Turing Finance | November 22, 2016

Scroll to top

Top

11 Comments

Perfect Imperfection, Agent Based Models

Perfect Imperfection, Agent Based Models

When I was 17 years old the Boy Scouts of America invited nine international delegates and I to present at a conference and partake in a 7-day 100 kilometer hike through the Rocky Mountains on the Philmont Scout Ranch. In the week prior to the conference we visited the beautiful little town of Santa Fe. Little did I know that in the future a handful of researchers at the Santa Fe Institute would could to shape my views on the markets.

Financial markets are complex adaptive systems. In my opinion markets are characterized by two biases: over-exaggeration and underestimation of available information especially in the presence of uncertainty. These biases allow unsubstantiated bubbles and excessive market crashes to occur. The 2008 financial crisis was partially brought about by underestimating the riskiness of credit derivatives (they were "not" risky at all and rated AAA) and over-exaggerating the dynamics of housing prices (home prices were assumed to always go up).

My opinion stands in direct contrast to the efficient market hypothesis. The efficient market hypothesis is a popular academic theory which, in its strongest form, argues that the market reacts to information efficiently so therefore prices are correct and reflect all available information about the security. A related academic theory is the random walk hypothesis, which argues that prices (returns) evolve according to a random walk a.k.a stochastic process over time. Both of these theories imply that it should be impossible to beat the market consistently.

Yet, empirically speaking there are many examples of practitioners and funds who have consistently beaten the market year-after-year. This argument is captured extremely well in a letter written by Warren Buffet entitled, The Superinvestors of Graham and Doddsville. In addition to this there is a vast amount of academic research into observable and quantifiable factors which drive market returns. Such factors include, but are not limited to, the value, momentum, firm-size, and mean-reversion factors. These factors bring into question the supposed unpredictability of market returns i.e. whether market returns are as random as we would like to believe. 

Why does any of this matter? It matters because there are disconnects between academic theory regarding how markets should behave and, as a result, the models we build for understanding the markets and their behaviour in reality. These disconnects contributed to the 2008 financial crisis are a major source of model risk. A challenge for all quantitative analysts is to improve our understanding of market dynamics. One alternative approach which I believe has shown promise is the use of artificial stock markets. Artificial stock markets are simulation models which consist of many heterogeneous agents which engage with one another to buy and sell securities.

Agent Based Models for Artificial Stock Markets

Agent based models are computational models of complex systems, such as the market, which use an individualistic approach (bottom-up) to simulate the systemic (emergent) effects caused by the actions and interactions between autonomous agents. For example, an agent based model consisting of two trading agents: trend-followers and value investors, may be useful for identifying the conditions under which bubbles (emergent characteristic) form.

Three concepts are central to all agent based models: agents as objects, emergence, and complexity. Agents as objects refers to the instantiation of classes, defined in a programming language, that encapsulate the memory and functions of intelligent agents. Emergence refers to complex patterns that arise from many relatively simple interactions, in this case between agents. And complexity is the study of complicated phenomena that emerge from a collection of interacting objects. Put simply, an agent based model works as follows,

  1. Initialize a population of autonomous agents (run-time objects) capable of making simple decisions in a domain. Create a population of autonomous trading agents that encapsulate functions, internal memory, and a trading strategy. Agents can follow different (heterogeneous) or the same (homogeneous) strategy.
  2. Create an environment in which the agents may interact with one another and make the environment sensitive to actions by the agent. Create a virtual market where securities can be bought and sold by the trading agents. Prices should be determined through supply and demand (market clearing) but some external stimuli which affect supply and demand e.g. interest rates could be simulated as random processes.
  3. Stream new information into the model, allow the agents to operate autonomously, and observe for emergent complex phenomena. Feed a stream of new data to the traders e.g. financial indicators used in their investment strategies. Watch as market bubbles and crashes occur (complex phenomena)
  4. Allow the agents to self-adapt to their changing environment through mechanisms such as machine learning or optimization algorithms. Allow each agent to use Evolutionary Programming (EP) to mutate their investment strategies such that back-test results are further optimized

The above approach is similar to the Santa Fe Institute Artificial Stock Market. This stock market was used to arrive at new market theories such as the adaptive market hypothesis. Yet despite the promising early results this model was not without its flaws. Firstly, autonomous agents do not cater for information sharing between agents (which happens in reality and is behind the crowding characteristic of markets), secondly, most agent based models suffer from high levels of parameterization and high sensitivity of the results to parameter values.


Problem #1 - Information Sharing

The flow of information between trading agents is not explicit in agent based models which use autonomous agents. As such, their investment strategies remain confidential throughout the simulation and strategies never become 'crowded'. This differs from reality where trading strategies slowly saturate the market through word-of-mouth and employee attrition. Crowding is when specific trades and trading strategies gain so much popularity that they eventually become unprofitable. In order for crowding to emerge, information about the agent's trading strategies needs to saturate between other agents. On the other hand, some trading strategies such as trend following are profitable if, and only if, other people identify the same trend and buy the security. Crowding and self-fulfilling prophecies cannot be replicated in an agent based model which uses autonomous agents.

One approach to dealing with this limitation is to incorporate some of the components from cultural algorithms into the agent based model. Cultural algorithms extend the basic functionality of Genetic Algorithms with a knowledge component called the belief space. The belief space stores information captured from profitable trading agents about what they believe the optimal trading strategy is. These fit agents are chosen using an acceptance function. The belief space would then randomly alter other agents in the population such that their strategies more closely resemble the fitter agents. Extending the agent based model with a belief space would allow trading strategies to slowly saturate between all of the agents thereby emulating the crowding effect.

At this point, some readers may think that using the belief space would cause all of the agents to converge onto the same trading strategy. This is where the importance of crowding comes in. As more and more agents use the same investment strategy, the opportunities for that trading strategy will 'dry up' and the agent's will eventually become unprofitable. Alternatively, bubbles will form and some external stimuli will cause them to collapse. Either way agents with contrarian investment strategies (assuming they are still liquid) would begin to alter the belief space and the population would diverge. It would be important that the diversity of the population be maintained so as to avoid stagnation. This can be achieved through introducing new agents to the model over time.

Agent-based Computational Economic (ACE) model, using Cultural Algorithms

Agent-based Computational Economic (ACE) model, using Cultural Algorithms


Problem #2 - High level of parameterization and sensitivity to configuration

Having a high level of parameterization is problematic because there are many parameter configurations which may result in the simulated market not resembling the real market. In other words, just like all other complex adaptive systems agent based models models are highly sensitive to their initial configuration. One possible way of mitigating this risk is to run extensive simulations aimed at estimating the optimal ranges and choices for some parameters. This was the approach taken in the Santa Fe Institute's Artificial Stock Market.

Parameters can be classified as model, learning, or strategic parameters. Model parameters configure the environment in which simulations run; learning parameters configure the learning and optimization algorithms used by the agents; and strategic parameters configure the basic assumptions of the model.

  • Model Parameters: agents per population, iterations per simulation, exchange setup, selection of traded securities, available liquidity, inflation rate, interest rate on non-invested money, leverage limits, etc.
  • Learning Parameters: crossover strategy, crossover probability, mutation strategy, mutation probability, selection strategy, acceptance function, etc.
  • Strategic Parameters: agent rationality (information available to each agent), investment holding periods, investment strategies (technical, fundamental, quantitative, or sentiment), asset allocations, etc.

Empirically testing each set of parameters would be ambitious and is no guarantee of success. However, by augmenting the agent based model with another belief space the complexity involved in configuring learning parameters could be reduced. This is achieved by randomizing the parameters in the initial population, and accepting the fittest agents to update the belief space regarding what the optimal ranges for learning parameters might be. Model parameters would ideally need to be tested empirically. Strategic Parameters should be initialized as close to real-world market conditions as possible a.k.a they should be calibrated to the market. The values could then be left to optimize i.e. the model would converge on optimal parameter configurations.


Conclusion

Despite being relatively unpopular in quantitative finance I believe that agent based models have a lot of potential. One of the realizations post the 2008 financial crisis was that existing, over-simplified economic models are ineffective for making monetary and fiscal policy decisions. Many of the causes of the 2008 financial crisis can be attributed to poor decision making by the Federal Reserve Bank and the United States and other governments. I believe that these organizations are handicapped by the models they use. One of the best applications of realistic agent based models could be the forward testing of policy decisions prior to their implementation.  

Additionally, agent based models explicitly cater for imperfection. They allow us to move away from assumptions such as the rational investor, efficient market hypothesis, and the random walk hypothesis. When calibrated artificial markets can be more realistic and exhibit some of the statistical characteristics of real markets such as fat tails and excess kurtosis. They are also built from first principles such as supply and demand up rather than on a bed of questionable assumptions. For these reasons I believe agent based models may become considerably more useful in the future than traditional models although I suspect that this will take a few decades to come true.

Comments

  1. Doyne Farmer has some interesting research reports on agent based systems.

    I also recommend the book "The Crisis of Crowding". A lot of extreme market behavior takes place when multiple agents have the same position and attempt to get out of the position at the same time.

    • Thanks Ian. I really appreciate your comment, I will get a copy of those reports and go through them soon. I'll probably end up writing an update to this article sometime afterwards with more information and challenges to any of the assumptions I made.

  2. Gabriel Durkin

    I enjoy reading all your blog articles, but man, you gotta learn how to use apostrophes. *It's* very distracting from the blog content to repeatedly see "it's" used as a possessive. As a quant, I am sure attention to detail is everything. You should employ the same stringency in your language usage.

    • Noted, thanks for pointing that out 🙂

  3. Alex

    Great write-up! I think agent-based economic models are currently primarily used for simulation-based macroeconomic experimentation. While there is potential (and a need) for their application in policy making, I struggle to wrap my head around how a simulated stock market would look like which incorporates the type of emergent behavior that financial markets often display. Particularly, what could an ABM of financial markets look like in order to be useful for asset price forecasting? How do you figure out which parameters (exogeneous and endogenous) should be included and how do you go about calibrating them?

    Do you have any insights in this regard? Maybe there already is some research in this area (apart from the Santa Fe Institute) that you think could be worth a look? Perhaps you have a rough idea how you would approach this if you were to build such a model?

  4. Это удовольствие, я надеюсь, вам понравилась статья 🙂 (Извините, если это русский плохо я использую Google Translate)
    It's a pleasure, I hope you enjoyed the article 🙂 (Sorry if this Russian is bad I am using Google translate)

Submit a Comment