Boids Algorithm in Economics and Finance a Lesson from Computational Biology
Total Page:16
File Type:pdf, Size:1020Kb
University of Amsterdam Faculty of Economics and Business Master's thesis Boids Algorithm in Economics and Finance A Lesson from Computational Biology Author: Pavel Dvoˇr´ak Supervisor: Cars Hommes Second reader: Isabelle Salle Academic Year: 2013/2014 Declaration of Authorship The author hereby declares that he compiled this thesis independently, using only the listed resources and literature. The author also declares that he has not used this thesis to acquire another academic degree. The author grants permission to University of Amsterdam to reproduce and to distribute copies of this thesis document in whole or in part. Amsterdam, July 18, 2014 Signature Bibliographic entry Dvorˇak´ , P. (2014): \Boids Algorithm in Economics and Finance: A Les- son from Computational Biology." (Unpublished master's thesis). Uni- versity of Amsterdam. Supervisor: Cars Hommes. Abstract The main objective of this thesis is to introduce an ABM that would contribute to the existing ABM literature on modelling expectations and decision making of economic agents. We propose three different models that are based on the boids model, which was originally designed in biology to model flocking be- haviour of birds. We measure the performance of our models by their ability to replicate selected stylized facts of the financial markets, especially those of the stock returns: no autocorrelation, fat tails and negative skewness, non- Gaussian distribution, volatility clustering, and long-range dependence of the returns. We conclude that our boids-derived models can replicate most of the listed stylized facts but, in some cases, are more complicated than other peer ABMs. Nevertheless, the flexibility and spatial dimension of the boids model can be advantageous in economic modelling in other fields, namely in ecological or urban economics. JEL Classification C15, C51, C52, C63, Keywords ABM, heterogeneous agents, behavioural mod- els, herding, boids model, stylized facts Author's e-mail [email protected] Supervisor's e-mail [email protected] Contents List of Figures vi 1 Introduction1 1.1 Perfect rationality paradigm....................1 1.2 Literature review..........................3 1.3 Stylized facts............................4 1.4 Research questions.........................8 2 The original boids model 10 2.1 Agent interaction in the boids model............... 10 3 The baseline model 12 3.1 Description of the baseline model................. 12 3.1.1 Forecasting rules...................... 12 3.1.2 Price updating mechanism................. 13 3.2 Merging the asset-pricing and boids model............ 14 3.3 Simulation of the baseline model.................. 16 3.4 The baseline model and the stylized facts............ 19 3.5 Sensitivity analysis......................... 22 4 The extended model 27 4.1 Description of the extended model................ 27 4.1.1 Forecasting rules...................... 27 4.1.2 Price updating mechanism................. 27 4.1.3 Roulette selection of the forecasting rules........ 28 4.2 Simulation of the extended model................. 29 4.3 The extended model and the stylized facts............ 31 5 The limit-order model 35 5.1 Description of the limit-order model................ 35 Contents v 5.1.1 Forecasting rules...................... 35 5.1.2 Pricing mechanism..................... 36 5.2 Simulation of the limit-order model................ 38 5.3 Limit-order model and the stylized facts............. 40 6 Concluding discussion 44 Bibliography 54 A AppendixI List of Figures 1.1 NASDAQ price and log-returns...................5 1.2 Autocorrelation in NASDAQ log-returns..............6 1.3 Semi-log plot of NASDAQ autocorrelation of absolute log-returns7 2.1 Three main forces governing agents' behaviour......... 11 2.2 Decision tree of an agent in the boids model........... 11 3.1 Decision tree of an agent in the baseline model......... 16 3.2 The baseline model under the default parameter values..... 17 3.3 Example of agents scattered in the space............. 18 3.4 ACF and PACF of returns, baseline model............. 20 3.5 Power law and exponential decay fits for autocorrelation in ab- solute returns, baseline model................... 21 3.6 Returns and fractions of trend followers under different C .... 24 3.7 Fraction of trend followers under different crit. probability... 25 3.8 Repuls. ratios for different observable distances......... 25 3.9 Ratio of trend followers for different herding thresholds..... 26 4.1 The extended model under the default parameter values.... 30 4.2 ACF and PACF of returns, extended model............ 32 4.3 Power law and exponential decay fits for autocorrelation in ab- solute returns, extended model................... 33 5.1 The limit-order model under the default parameter values.... 39 5.2 ACF and PACF of returns, extended model............ 41 5.3 Power law and exponential decay fits for autocorrelation in abs. returns, limit-order model..................... 42 A.1 Gaussian kernel density estimate of NASDAQ log-returns.....I A.2 The probability function for various values of beta........ II List of Figures vii A.3 Kernel density estimate of the returns, all models........ III A.4 Fitnesses under different C, baseline model............ III A.5 Decay speed of the lagged returns in the extended model....IV Chapter 1 Introduction 1.1 Perfect rationality paradigm Until recently, the mainstream microeconomic theory was based on a repre- sentative, perfectly rational agent. Under this assumption, the behaviour of the whole population is easily deducible from the behaviour of an individual. Furthermore, the mainstream microeconomic theory assumes that agents have access to all relevant information and are endowed with strong enough compu- tational and intellectual skills to be able to evaluate this information and make an economic decision. Intuitively, these assumptions are too strong to hold in reality. Not only agents are not homogeneous in their preferences (so that the idea of a representative agent is misleading) but, more importantly, they do not have the necessary skills to process and evaluate all the information. In other words, agents are only boundedly rational (Simon, 1962). Fama(1970) translated the full rationality paradigm into financial markets via the Efficient Market Hypothesis (EMH). Under EMH, the asset prices already reflect all relevant information and there is no room for cost-free arbitrage. In other words, under EMH, the only possible observable price is the fundamental price of the asset, otherwise any difference would be exploited by the rational traders, driving the price back to its fundamental value. However, as already pointed out by Keynes(1936, p. 147) in the early days, if one is aware that the rest of market participants do not behave rationally, there is no need to look for the fundamental value of an investment or an asset in question. The fundamental value is not important if it is unknown or not accounted for by the irrational market participants. It is more important to outwit these irrational traders (often called noise traders, after Kyle 1985) by 1. Introduction 2 better forecasting the future market sentiment. The presence of irrational agents contributed to a new wave of literature on the heterogeneity of agents that also accounts for their limited intellectual capabilities, as opposed to the sacred assumption of full rationality. Eventually, this gave rise to the behavioural, agent-based approach of modelling preferences, expectations and decision making of agents. A common thread through the whole agent-based model (ABM) literature is the focus on simple heuristics rules on behalf of the agents. Unlike in the utility- maximisation problem, agents follow simple decision-making rules that require less knowledge and intellectual ability. As elaborated in Section 1.2, there is strong experimental evidence that real subjects do follow such simple heuristics. Inclination towards unsophisticated rules was also confirmed by psychological experiments { see, for example, the widely cited paper of Kahneman & Tversky (1973). However simplistic the behavioural rules are, they often lead to surprisingly rich and complex macroscopic dynamics. The interaction in the behavioural agent-based model can thus be viewed as a complex system, in the sense of Simon(1978), in which the sum of individual particles of the system does not give a correct picture of the behaviour at the global scale. There is a myriad of applications of ABMs in economics. As we shall see below, most ABMs focus on one particular segment of the economy { financial markets, modelling macroeconomic variables, banking sector, industrial pro- duction or foreign trade flows. The ultimate goal, at least according to Farmer & Foley(2009), is to design a broad agent-based model that would simulate behaviour of the complete economy, including government sector (taxes, so- cial transfers, expenditures), private sector (household consumption, savings), financial and banking sector (lending and borrowing, investments), and in- ternational trade flows. Such model could theoretically replace the outdated DSGE models and historical data fitting to better predict the movements in the economy and yield more relevant policy measures. As of now, however, such holistic, integrated models do not yet exist. The measurable advantage of many ABMs is that they, unlike the perfect rationality models, are able to replicate many of the so-called stylized facts { frequently recurring statistical properties that are common to various markets