• No results found

Boids Algorithm in economics and finance : a lesson from computational biology

N/A
N/A
Protected

Academic year: 2021

Share "Boids Algorithm in economics and finance : a lesson from computational biology"

Copied!
67
0
0

Bezig met laden.... (Bekijk nu de volledige tekst)

Hele tekst

(1)

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

(2)

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.

(3)

Bibliographic entry

Dvoˇr´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 pavel.dvorak@student.uva.nl Supervisor’s e-mail c.h.hommes@uva.nl

(4)

Contents

List of Figures vi

1 Introduction 1

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

(5)

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

(6)

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-returns 7 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

(7)

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

(8)

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). UnderEMH, 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

(9)

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 and economic processes such as financial markets, foreign exchange markets or time series of macroeconomic variables. In the following section, we review the literature on the ability of ABMs to replicate stylized facts common to some

(10)

1. Introduction 3

of these markets while, in this thesis, we mainly focus on stylized facts of the financial markets.

1.2

Literature review

In this section we discuss the core literature on ABMs and replication of the stylized facts. In particular, we first discuss the stylized facts in finance (as their replication is the main point of this thesis) and then proceed toABMs and stylized facts in experimental economics, microeconomics and macroeconomics. Bollerslev et al. (1992); Brock & De Lima (1995); Gopikrishnan et al. (2000) describe some of the stylized facts in finance while Cont (2001) presents a coherent list and discussion of all the main stylized facts found in financial markets. There have been various attempts to design an ABM that would consistently replicate stylized facts in financial markets. Hommes (2006) and LeBaron (2006) provide thorough surveys of (heterogeneous)ABMsin economics

and finance, showing the models as complex adaptive systems with highly non-linear dynamics.

We are also witnessing growing popularity of the Genetic Algorithm (GA) models, first introduced by Holland (1975). Genetic algorithms are different from the usual strategy selection processes in that they allow for creation of new strategies that were not part of the initial strategy set. Duffy (2006) gives a solid introduction to theory behind and programming of genetic algorithms in economics. GA examples include Lux & Schornstein (2003), who seek to explain stylized facts of the exchange markets with a genetic algorithm model, while Arifovic (1995) studies the GA-based decision rules in the overlapping generations model and compares the results with the experiments with human subjects. At last, Arifovic (2000) applies the genetic algorithms to investigate stability of equilibria in macroeconomics and explains equilibrium selection and non-rational evolutionary dynamics.

There is also a branch of the experimental literature based onABMs. Heemei-jer et al. (2009) report on forecasting rules of participants in a decision making experiment and clearly identify the difference between price forecasting in mar-kets with negative feedback (e.g. market for non-storable commodities) and positive feedback (e.g. any speculative market). As an extension, Bao et al. (2014) analyse the difference in price dynamics when participants used succes-sively three different forecasting rules – forecasting price only, quantity only or both at the same time. Arifovic & Ledyard (2012) also design an evolutionary

(11)

1. Introduction 4

learning model that would replicate five most recurrent stylized facts found in the experimental data on Voluntary Contributions Mechanism (VCM) and also provide economic theory to support these stylized facts.

There are also numerous examples of ABM application in macroeconomics. De Grauwe (2012) introduces a macroeconomic agent-based model with im-perfect information that would account, contrary to standard DSGE baseline models, for the recurrent booms and busts – or emergence of extreme upward or downward movements in the economy – leading to highly peaked and non-normal distributions of macro variables.

Dosi et al. (2013) present a Keynesian ABM that models relation between the income distribution and fiscal policies. The model is designed to account for some macroeconomic commonly observed phenomena – long periods of un-employment during recessions or incessant output fluctuations – and has direct policy implications.

In this thesis we present an agent-based model, called the boids model, that, we believe, will make a solid contribution to the family ofABMsin finance. From the outset, the boids model, originated in biology, has the desirable properties of an ABM for financial application – herding tendencies of the agents, phase transitions upon reaching a certain threshold, and many possibilities for setting the behavioural rules.

1.3

Stylized facts

As mentioned above, we are mainly interested in financial stylized facts – statis-tical properties of price variations that are common to a wide range of financial markets. Before attempting to replicate the stylized facts by our model, we illustrate their presence on the National Association of Securities Dealers Au-tomated Quotations (NASDAQ) financial index.1

Cont (2001) lists 11 most flagrant stylized facts including fat tails and neg-ative skewness of the return distribution, no or negligible autocorrelation in the levels of returns, volatility clustering, and slow decay of autocorrelation in absolute returns.

The main benchmark for evaluating performance of our models is based on how well they are able to replicate the selected stylized facts in the returns generated by the models themselves.

1The choice of

NASDAQ is not critical, other indexes such as S&P 500 or Nikkei exhibit similar features, as we have confirmed ourselves.

(12)

1. Introduction 5

Before presenting the boids model in more detail, we first illustrate the presence of the stylized facts in real financial data. We have chosen NASDAQ

stock log-returns over last 30 years, plotted in Figure 1.1 and summarized in Table 1.1. 1990 2000 2010 0 1000 2000 3000 4000 5000

(a) NASDAQstock prices

1990 2000 2010 -0.10 -0.05 0.00 0.05 0.10

(b) NASDAQlog returns

Figure 1.1: NASDAQ price and log-returns rt development

Var Mean Stdev Min Max Skewn. Kurt. nobs

prices 1583.203 1065.742 225.3 5048.62 0.524 2.483 7654 log rets 0.000 0.014 −0.120 0.133 −0.237 11.135 7653

Table 1.1: Summary statistics for NASDAQ stock prices and log re-turns

Kurtosis and skewness The summary statistics in Table 1.1 already suggest

asymmetry in gain/losses distribution (negative skewness, i.e. extreme negative values are more likely than the positive ones) and high proba-bility of extreme returns in general (excess kurtosis of 8.135).

Non-normality The non-normality of the return distribution can be formally

tested by the Jarque-Bera skewness-kurtosis test (see Jarque & Bera, 1980; D’agostino et al., 1990). In case of the NASDAQ log-returns, nor-mality is strongly rejected with p-value 0.0000. The Gaussian kernel density estimate of the empirical density with the plugin of Silverman (1986) bandwidth plug-in estimate is plotted in Figure A.1. For com-pleteness, the formula for Silverman’s plug-in estimate is also included in the appendix (see Equation A.1).

(13)

1. Introduction 6

Autocorrelation in rt The financial returns usually show no or little sign of

day-to-day dependence. In presence of autocorrelation, the returns would be easily predicted and exploited. The autocorrelation in rt is plotted

in Figure 1.2. Even though some lags appear to be significant, there is no clear rapidly decaying autocorrelation pattern and, as a whole, the autocorrelations seem to be disorderly. The 95% confidence intervals were computed using the Bartlett’s formula for MA(q) processes (see Brockwell & Davis (2002) for details).

-0.05 0.00 0.05

0 50 100 150

lag

Figure 1.2: Autocorrelation inNASDAQ log-returns rt

Autocorrelation in |rt| Similarly, it was observed (Cont et al., 1997) that the

financial returns exhibit signs of long-range dependency, measured by the slow decay of autocorrelation in absolute returns. In particular, the autocorrelation in absolute returns can be roughly fitted by a power-law function in the presence of long-range dependency. For comparison, we also estimate the exponential decay fit function to see whether it provides better fit than the power-law function (exponential decay is only a sign of short-term dependency). Following notation of Kantelhardt (2009), we define the power-law and exponential fit functions as in Equation 1.1.

CP(l) =

A

lα CE(l) =

B

exp(lβ) (1.1)

where A, α, B and β are parameters to be estimated, l is the lag of the autocorrelation, and subscripts P and E stand for power-law and

(14)

1. Introduction 7

exponential fits, respectively. For a more formal definition of the long-range dependency, see Cont (2005, p. 4).

Figure 1.3 shows the autocorrelation function of NASDAQ absolute log-returns for l = 150 lags and corresponding power-law and exponential fit parameters. We see that for lower lags the autocorrelation decays rather at exponential rate but seems to decay slower for lags l ' 120.

A = 0.378, Α = 0.141 B = 0.311, Β = 0.00454 20 40 60 80 100 120 140 l 0.20 0.30

Figure 1.3: Semi-log plot ofNASDAQ autocorrelation of absolute log-returns for 150 lags with power-law (dashed) and expo-nential (dot-dashed) fit functions, parameter values in-cluded

Volatility clustering underlies the observation that time periods with high

volatility tend to cluster together. We try to uncover this phenomenon via estimating Generalized Autoregressive Conditional Heteroskedastic-ity (GARCH) effect (Engle, 1982; Bollerslev, 1986), for which we also spec-ify the mean equation. The Autoregressive Moving Average (ARMA )(1,1)-Threshold GARCH (TGARCH)(1,1) results are summarized in Table 1.2. We see that there is a strong statistical evidence for the effect of past squared returns (the Autoregressive Conditional Heteroskedasticity (ARCH) term L.arch) and for autoregressive volatility term L.garch. The mean of the log-returns follows the ARMA(1,1) process, suggesting correlation between today and yesterday’s returns.2

2TheGARCHeffect was only present in the first lag, ARCH up to the second lag. In the

mean equation, the AR and MA terms are significant only in the first lag. The threshold term is significant for any number of (G)ARCH lags.

(15)

1. Introduction 8

ARMA(1, 1)-TGARCH(1, 1) dep var: NASDAQ log-rets rt

cons 0.000415∗∗ (2.34) ARMA L.ar 0.952∗∗∗ (30.91) L.ma −0.950∗∗∗ (−32.87) ARCH L.arch 0.0850∗∗∗ (3.84) L.tarch −0.125∗∗∗ (−5.58) L.garch 0.886∗∗∗ (44.09) cons 0.00000284∗∗∗ (3.70) t-statistics in parentheses.

Heteroskedasticity-robust standard errors used * p < .1, ** p < .05, *** p < .01

Table 1.2: ARMA(1, 1)-TGARCH(1, 1) model for NASDAQ log-rets

1.4

Research questions

The point of this thesis is to introduce a behavioural model, called the boids model, originally conceived in biology for the purposes of computer simulation of bird flocking.

The original biological model is described in more detail in Chapter 2. In Chapter 3 we present the first application of the boids model in economics and finance, the baseline model, and we evaluate its performance by how well it reproduces the stylized facts in finance. In Chapter 4, we describe the first extension of the baseline model, allowing for much more heterogeneity among agents and in the strategy selection. We also compare the performance of the extended model to the baseline model. In Chapter 5, we present our last model, based on a different and more elaborate pricing mechanism than in the first two models.

In the concluding discussion in Chapter 6, we address the following research questions:

• Is the model easily interpretable for the purposes of economics and fi-nance?

• Does it outperform other ABMs in modelling economic behaviour and expectations? In other words, is our model able to better replicate the empirical properties of the real world data?

(16)

1. Introduction 9 • Is it parsimonious enough to be easily applied to new problems?

• Is it robust to parameter modification?

• What are the limits and possible further extensions of the model? The majority of the simulations were written and run in Matlab. Econometric analysis and figures were output by Wolfram Mathematica, Stata, and Eviews. All scripts, programs and data are available upon request.

(17)

Chapter 2

The original boids model

In this chapter we briefly describe the original, underlying boids model as first introduced by Reynolds (1987). In his paper, Reynolds describes a simulation-based, heterogeneous agent-based approach to model flocking behaviour of birds or other animals forming herds or schools.

The basic idea is that the system of agents, here called boids1, is viewed as a

particle system, where the behaviour of each particle has its own characteristic (in our case these are, for example, speed, direction and attraction zone) and is governed by a set of rules. Trying to trace path of the whole flock would be in-efficient, computationally demanding and error prone. Stipulating behavioural rules for each agent yields a more robust solution with more realistic results.

2.1

Agent interaction in the boids model

As mentioned above, each of the agents has its specific, time-varying charac-teristics (speed, direction, position) and behavioural rules that are related to the following three principles:

• Repulsion: Agents avoid collision with others by moving away from the flock.

• Alignment: Agents synchronize their direction with other agents in the flock.

• Attraction: Agents are attracted towards the center of the flock. These three forces are illustrated in Figure 2.1.

(18)

2. The original boids model 11

(a) Repulsion (b) Alignment (c) Attraction

Figure 2.1: Three main forces governing agents’ behaviour

In practice, repulsion force has the highest priority, followed by alignment and attraction. This means that first of all, the agent verifies that there are no other agents in her closest vicinity (the repulsion zone). Only then, the agent checks whether there are any other agents she can align with. If the alignment zone is empty, the agent proceeds to check whether the attraction zone is empty and adjusts her behaviour accordingly. The whole adjustment process is schematically depicted in Figure 2.2.

Any agents in the repulsion zone?

start

Move away

Any agents in the alignment zone?

Any agents in the attraction zone?

Align direction Approach the herd Keep your direction

yes no yes no yes no

(19)

Chapter 3

The baseline model

The main goal of this thesis is to apply the boids model to explain some relevant economic phenomena. In this chapter, we present a baseline model, inspired by the asset-pricing model (see Hommes, 2013; Tedeschi et al., 2012a). We call this model the baseline model as it will serve as a benchmark for further extensions of the model. We evaluate the performance of a model by looking at how closely the model is able reproduce stylized facts (as listed in section Section 1.3).

3.1

Description of the baseline model

3.1.1

Forecasting rules

At the beginning, we assume two types of agents – fundamentalists and trend followers. Each type of agents has her own forecasting rules in terms of xt, the

deviation of the price from the fundamental value, the value of which is not important at the moment. In particular, the forecasting rules for each of the two types of agents are:

fF,t= 0 fundamentalists (3.1)

fT r,t= gxt−1 trend followers (3.2)

where g > 0 is the strength of the trend following behaviour and F, T r stand for fundamentalists and trend followers, respectively. From Equation 3.1, it is clear that fundamentalists always assume that the price in the next time period will be equal to the fundamental price (or that the deviation from the fundamental

(20)

3. The baseline model 13

price will be zero). Each agent has the possibility to switch between the two types of behaviour based on the fitness associated with each type. In the baseline model, the evolutionary fitness measure Ut∗, ∗ ∈ {F, T r} is given by the past realized profits of each type of agents:

Ut−1F = (xt−1− Rxt−2)  −Rxt−2 σ2  − C (3.3) Ut−1T r = (xt−1− Rxt−2)  gxt−3− Rxt−2 σ2  (3.4)

where R = 1 + r is a constant interest rate, measuring the return of a risk-free asset, σ2 is the variance of the price returns (assumed to be constant and

the same for both types of agents). C is the information gathering cost for the fundamentalists (equal to zero for trend followers). The fitness measures as in Equation 3.3 and Equation 3.4 are based on the myopic mean-variance optimisation of the agents. The full derivation of the fitness measures can be found, for example, in Hommes (2013, p. 160).

3.1.2

Price updating mechanism

Since the price mechanism is an expectation feedback system, the next period price deviation xt+1 is a weighted sum of fundamentalist and trend following

expected prices (or forecasts), i.e.

xt+1= ξtT r R gxt+ t, ξ T r t = 1 N N X i=1 I(κi = 1) (3.5)

where I(·) is the indicator function, equal to 1 if the expression in the brackets is true and 0 otherwise. κ is the type of agents, equal to 1 if the agent is a trend follower and 0 otherwise. The ratio ξT r

t is thus a ratio of the trend

followers at time t. Note that fundamentalist expectations do not enter the price formation mechanism at all since the forecast is always zero (hence as the ratio of trend followers approaches zero, so does the price deviation xt). The

small error term t is independently normally distributed with zero mean and

variance 1/2.

At last, the daily returns rt are defined as the time difference between two

subsequent price deviations, i.e.

(21)

3. The baseline model 14

The daily returns rt are the main variable of interest in all our analyses.

3.2

Merging the asset-pricing and boids model

In the previous subsection, we have described the price and expectation for-mation mechanism based on the types of agents. In this part, we explain how these mechanisms drive the behaviour of the agents in the boids setup.

Name Label Class Description

Ag en t-s p ecific position P vector (2 × 1)

Position defines agent’s coordinates in the bounded 2D space.

direction d vector

(2 × 1)

Direction is a standardized, unit vec-tor directing the agent’s motion.

type κ scalar

{0, 1}

Types 0 and 1 correspond to fun-damentalist and trend followers, re-spectively.

Gl

oba

l

speed ν scalar Speed indicates how much each

agent moves in its direction in every time period.

observable distance

δ scalar Observable distance is the radius of the zone observable by each agent (see Figure 2.1).

herding threshold

τ scalar Herding threshold is the max. num-ber of other agents that are tolerated within one’s distance.

critical probability

pc scalar Critical probability is the

probabil-ity of switching types independently. Table 3.1: Types of parameters in the baseline model

Assume a two-dimensional (2D) bounded space (0, S)×(0, S) and N agents, each characterized by three agent-specific and four global parameters. These parameters are described in Table 3.1. The agent-specific parameters vary both across agents and in time. The global parameters are kept constant through time and for all agents.

The law of motion of the simulation is the following. At the beginning, there are N randomly scattered agents over the 2D space. Each agent has information about his type and the fitness Utthat is linked to his type. In addition, to model

bounded rationality and incomplete information of the agents, she can only observe the types and fitnesses of agents strictly within her observable distance

(22)

3. The baseline model 15

δ. These agents are called the neighbours. If the number of neighbours within δ is less than the herding threshold τ , the agent picks the neighbour with the highest fitness (or picks one randomly in case there are different agents with the same fitness). The chosen agent is called the leader. If the leader’s type differs to our agent’s type, she compares the leader’s fitness to hers and switches to fundamentalist strategy with probability pFt (defined in Equation 3.7).

pFt = 1

1 + e−β(UF,t∗ −U ∗ T r,t)

(3.7) In other words, in case there are both types of agents within neighbourhood of our agent, the probability of switching to the fundamentalist strategy depends on the fitnesses of both fundamentalist and trend following agents. For example, if the leader’s and our agent’s types are fundamentalist (κ = 0) and trend follower (κ = 1), respectively, then UF > UT r implies pF > 12, i.e. our agent is

more likely to adopt the leader’s type than to keep her own.

If the leader is of the same type, the agent does not compare relative fitnesses and only switches types independently and with low probability pc. For

compu-tational reasons, we standardize UF

t and UtT r in such a way that their ratios are

preserved, i.e. UtF UT r t = UtF ∗ UT r∗ t and maxUF ∗ t , UtT r∗ = 1. If unstandardized, high

fitnesses lead to significant simulation instability due to exponentiation of high numbers. The β coefficient in Equation 3.7 is commonly called the intensity of choice since it measures how readily an agent switches to a more profitable strategy. In the two extreme cases, β = 0 means that the agents are unable to differentiate between the two strategies and choose either one randomly with probability1/2. In the other extreme case, β = +∞, agents switch immediately

to the best forecasting strategy. The flattening of the probability function with decreasing β is illustrated in Figure A.2. If the agent adopts the type of her leader, she also aligns her direction vector with the leader (subject to tiny er-ror) and gets closer to him by exactly ν units (since the length of the direction vector is 1).

On the other hand, if the number of neighbours within δ from the agent exceeds the herding threshold τ , she turns her direction vector d in such a way that it points in the opposite direction from the gravity center of all the neighbouring agents (this reaction is an equivalent of the repulsion force as described in Section 2.1 – see also Figure 2.1(a) for illustration of the repulsion force). We say that the agent enters the survival mode. She then switches her type to the opposite of the herd’s majority type with (high) probability 1 − pc.

(23)

3. The baseline model 16

This step models the risk-averse, cautious nature of agents and prevents them from following blindly the herd for a long period of time.

The whole direction and type adjustment processes are summarized by the diagram in Figure 3.1.

Are there more than τ agents within δ?

∀i ∈ {1, . . . , N }

Invert direction away from the herd Direction

change:

Switch from herd’s type with prob 1 − pc Type change: Any agents at all within δ? Keep direction unchanged Align direction

with the leader

Switch types with prob pc Set κ = 0 with prob pFt Proceed at speed ν yes no yes no

Figure 3.1: Decision tree of an agent in the baseline model

Note that contrary to the original boids model as described in Section 2.1, there is no spatial frontier demarcating the repulsion zone. Instead, the re-pulsion force is activated when an excessive number of neighbours τ enter her observable distance δ. Furthermore, to keep the baseline model as simple as possible, the alignment and attraction step are merged into one, as the agent approaches her leader immediately after aligning her direction vector with him.

3.3

Simulation of the baseline model

At t = 0, N agents are randomly scattered over the 2D space, with randomized direction vectors d. At time t = 1, for every agent i ∈ {1, . . . , N }, the direction, position and type adjustment take place according to the diagram in Figure 3.1. The process is repeated T + w times, where w is the burn-in phase, the data of which are discarded immediately after the simulation and are not taken into account for further analysis. The burn-in phase precedes simulations of all three described models in this thesis and will not be explicitly mentioned in the next sections.

(24)

3. The baseline model 17

We run the simulation of the baseline model over T = 2000 periods, and extra 50 time periods as the burn-in phase. The default values of the parameters are listed in Table 3.2.

N S ν δ R g β C σ2 τ pc

150 500 5 30 1.1 1.15 2 0.01 5 N10 0.01

Note: (S × S) is the size of the square 2D space.

Table 3.2: Default parameter values of the baseline model simulation

The returns rt, the fractions of trend followers ξt, fitnesses and the repulsion

ratios ρ are plotted in Figure 3.2. For the sake of completeness, the smoothed kernel density of the returns is plotted in Figure A.3(a) (to be discussed in more detail in Section 3.4).

500 1000 1500 2000t - 0.5 0.0 0.5 (a) Returns rt 500 1000 1500 2000t 0.4 0.5 0.6 0.7 0.8 0.9

(b) Fraction of trend followers ξt

500 1000 1500 2000 t 0.0 0.2 0.4 0.6 0.8 UF UTr (c) UF t and UtT r 500 1000 1500 2000t 0.05 0.10 0.15 0.20 (d) Repulsion ratios ρt

Figure 3.2: The baseline model under the default parameter values In this sequence of figures, we see that the returns rt rather resemble white

noise with no evident spikes in either direction. The fraction of trend followers oscillates almost over the full range h0, 1i even though there are short periods when the ratio is kept unchanged. The last picture shows the development

(25)

3. The baseline model 18

of the repulsion ratio ρt, which is defined as the ratio of agents with more

than τ = 10N = 15 neighbours within δ = 30. Comparing the plots in the right column, we see that high repulsion ratios correspond to high fractions of fundamentalists (or low fraction of trend followers), which is in accordance with our model setup (see Figure 3.1).

(a) Positions and direction vectors of the agents (b) Empirical density histogram of the positions

Figure 3.3: Example of agents scattered in the space with direction vectors d (size not proportional) and the size of observable zones (of radius δ, in correct proportion)

A snapshot of the agents’ positions, direction vectors and observable zones can be seen in Figure 3.3. We can clearly see clusters, or herds, of agents following the same direction. In the upper part of Figure 3.3(a), we see clusters of agents disintegrating after surpassing the herding threshold τ = 15. For the sake of clarity, only the zones (of radius δ = 30) are plotted in the correct proportion whereas the unitary direction vector d is multiplied by 30. Figure 3.3(b) shows the empirical density histogram plot, obtained by the Gaussian kernel density estimation with bandwidth 25. Comparing the two figures, we see that the survival mode is activated in the most crowded clusters (dark red in the top of Figure 3.3(b)).

(26)

3. The baseline model 19

3.4

The baseline model and the stylized facts

We now look at the ability of the baseline model to explain some of the stylized facts that serve as a benchmark for evaluating the performance of our models. Since the model yields slightly different results under different random seeds, we performed 100 replications to obtain the average values of the mean, standard deviation, minimum, maximum, skewness and kurtosis, including respective standard errors. Table A.1 shows the summary statistics of the variables of interest – the returns rt, fitnesses UtT r and UtF, the ratio of trend followers ξtT r

and the repulsion ratio ρt, including the standard errors.

The properties of returns rtwill be more thoroughly discussed in the stylized

facts part below.

As for the remaining variables, we see that both fitnesses show fat tails – the mean kurtosis is 24.6 and 41.4 for trend followers and fundamentalists, respectively. However, the standard errors are also very high, suggesting that not in all simulations the fitnesses experience sharp jumps. The fraction of trend followers ξT r

t is fairly high during all the simulations (around 75%).

We now look at each of the stylized facts and discuss whether it is exhibited by the baseline model or not. For inspection of normality and autocorrelation, we pooled the data from all the simulation rounds (under different random seeds), yielding T × Rep = 2000 × 100 = 200 000 observations.

Skewness & Kurtosis We see that the returns rtare not significantly different

from zero and their skewness and kurtosis seem to oscillate a lot – there is no statistical evidence for excess kurtosis and negative skewness. Never-theless, from Table A.1 we see that, on average, the returns rt have fatter

tails (high kurtosis) and slightly positive skewness. However, this result is most likely coincidental because the model does not provide any justi-fication for extreme negative or positive values of the returns. In fact, in the complete simulation, the returns are negatively and positively skewed with the same frequency. Furthermore, as mentioned above, the standard errors are too high to conclude that the model yields consistently negative skewness or excess kurtosis. The minimum and maximum kurtosis across all runs is 2.81 and 14.2 with median value of 3.1 – the model is slightly more likely to yield returns with excessive kurtosis than otherwise.

Non-normality The varying values of skewness and kurtosis suggest

(27)

3. The baseline model 20

perform the Jarque & Bera (1980) normality test with sample-adjusted standard errors (the adjustment mechanism described in D’agostino et al., 1990) based on the skewness and kurtosis of the sample. In our case the normality is strongly rejected with p-value 0.000. The kernel density esti-mate of rtcompared to the normal distribution is plotted in Figure A.3(a).

We see that, visually, the estimated density does not differ significantly from the normal density.

Autocorrelation in rt We first plotted the Autocorrelation function (ACF) and

Partial Autocorrelation Function (PACF) up to 150th lag. The plots are

presented in Figure 3.4. The confidence intervals are computed using the Bartlett’s formula for MA(1) processes (see, for example, Brockwell & Davis, 2002). The confidence intervals for PACF are computed using the standard error 1/N. We see that both ACF and PACF show strong

expo-nential decay, suggesting an ARMA specification. The autocorrelation is formally tested by Ljung & Box (1978) test with 40 lags. The null hy-pothesis of independent data with no autocorrelation is strongly rejected (the Q-statistic is χ2(40) distributed with p-value 0.000). Even though

the low-order autocorrelations are statistically significant, the economic importance of the autocorrelation is rather negligible (the first lag auto-correlation is less 0.1). -0.10 -0.08 -0.06 -0.04 -0.02 0.00 0 50 100 150 lag (a) ACFof rt -0.10 -0.08 -0.06 -0.04 -0.02 0.00 0 20 40 60 80 100 lag (b) PACFof rt

Figure 3.4: ACF and PACF of rt, the baseline model

The baseline thus does not replicate the stylized fact of no autocorrelation in the levels of returns. This was expected since the return equation is constructed as a coefficient-varying AR(p) process (see Equation 3.5).

(28)

3. The baseline model 21

the autocorrelation of the absolute returns up to 150th lag, performed

on the complete, pooled data from all simulations. We see that at the beginning the autocorrelation dies roughly at the exponential rate but, for higher past lags, the autocorrelation can be rather fitted by the power-law function, even though the function values occasionally drop below zero. We conclude that there is no clear power-law decay trend in the autocorrelation of the absolute returns.

A = 0.0245, Α = 0.68 B = 0.0358, Β = 0.0814 20 40 60 80 100 120 140 l 10-6 10-5 10-4 0.001 0.01

Figure 3.5: Power law (dashed) and exponential decay (dot-dashed) fits for autocorrelation in |rt|, semi-log plot. Negative

autocorrelation values omitted.

Volatility clustering We also test for autocorrelation in squared returns. We

test it by estimating the GARCH effect with a specified mean equation, and we also allow for a different effect of negative impact (the threshold effect). We specify the mean equation with one autoregressive (AR) and one moving average (MA) terms. The variance equation is a GARCH

(1, 1) specification with a threshold term. For description of the GARCH

model, see Tsay (2005, p. 113). The regression results are summarized in Table 3.3.

We see that there is strong evidence for both autoregressive and moving average effects in the returns. This is not surprising given the construc-tion of the price mechanism (cf. Equaconstruc-tion 3.5 and Equaconstruc-tion 3.6) which contains both past return and a normally distributed error term. In the variance equation, both past squared return (L.arch term) and past variance (L.garch term) are significant, suggesting presence of volatility clustering. Surprisingly, the threshold term L.tarch is also strongly sig-nificant suggesting that negative news have larger impact on the returns than the positive news.

We have also added further lags of bothARCHandGARCHterms but with no significant improvement. No moreARCHlags were significant whereas

(29)

3. The baseline model 22 ARMA(1, 1)-TGARCH(1, 1) dep var: rt cons 0.000000912∗∗∗ (2.00) (2.79) ARMA L.ar 0.848∗∗∗ (204.52) (587.92) L.ma −1.000∗∗∗ (−49947.76) (−68069.39) ARCH L.arch 0.0485∗∗∗ (7.35) (24.55) L.tarch −0.0201∗∗∗ (−2.62) (−10.25) L.garch 0.811∗∗∗ (68.11) (86.80) cons 0.0101∗∗∗ (14.32) (18.23) t-statistics in parentheses.

3rd column: cluster and heteroskedasticity-robust standard errors used. 4th column: heteroskedasticity-robust standard errors used.

* p < .1, ** p < .05, *** p < .01

Table 3.3: ARMA(1, 1)-TGARCH(1, 1) model regression result

GARCH effect is present up to and including the fourth lag. To sum up, the model does exhibit strong volatility clustering which is in line with empirical observations.

We conclude that the baseline model is able to replicate some of the stylized facts in question. Even though there is not enough statistical evidence for excess kurtosis nor negative skewness, the skewness-kurtosis test on the complete, pooled data strongly rejected normality. The baseline model produces (weakly) autocorrelated returns which is not a desirable property of the model. There is no discernible pattern in the decay of the autocorrelation of the absolute returns. At last, the model yields returns that cluster in time of high volatility, as we have confirmed by our GARCHanalysis.

3.5

Sensitivity analysis

In this subsection, we look at how the behaviour of the model evolves after a change in one single parameter, keeping all other parameter values constant. We focus on the parameters which directly influence the behaviour of the agents such as the intensity of choice β, the observable distance δ, the trend following strength g, the herding threshold τ , the critical probability pc and the

(30)

funda-3. The baseline model 23

mentalist cost C. For the sake of completeness, the range of values for each parameter of interest is presented in Table A.2.

Intensity of choice β The simulations did not yield qualitatively different

re-sults as compared to the default value β = 2.0. This is due to fact that the β parameter plays a less important role than in the original asset-pricing model. Here the importance of β is diluted by the presence of the survival mode and the critical probability pc which, as we shall see, has

a more significant impact on the dynamics of the model.

Cost C The change in the cost parameter C leads to significantly different

behaviour of the model. Figure 3.6 depicts the evolution of rt and ξt

under two cases, C = 0 and C = 0.5. We see that under no cost the ratio of trend followers is very close to zero (on average only 3.1%) whereas under high cost (C = 0.5) the fraction of trend followers is close to 1 (on average 91%). Under no cost the fraction of times when UT r

t > UtF is

around 57% whereas, for C = 0.5, this fraction is about 95.5%, i.e. the fundamentalist strategy pays off only in about 4.5% time periods. Simply said, it becomes too expensive to be a fundamentalist. Nevertheless, the fundamentalists are never completely driven out of the market because of the survival mode that is activated whenever the herding threshold τ is surpassed and agents swap strategies with probability 1 − pc= 99%. Since trend followers outnumber fundamentalists when the cost C is high, the returns rtare driven mainly by trend followers which is clear from the

Figure 3.6(c). Few time periods before the sharpest spike at t = 963, the ratio of trend followers is at ξt = 99.3%. At t = 963, a phase transition

occurs, the ratio of trend followers falls to ξt = 0.8 (most likely due

to overcrowded observable zones) and keeps falling afterwards until the returns rt stabilize around zero. We also include the plot of fitnesses in

Figure A.4 in which we clearly see the difference in the average fitness for the two costs.

Critical probability pc The change in the critical probability pcmainly

trans-formed the development of the fractions of trend followers. Note that pc has two functions in the model dynamics as is clear from the dia-gram in Figure 3.1. First, when the observable zone is overcrowded, the agent adopts the strategy opposite to that of the herd with probability 1 − pc. Second, when an agent decides not to imitate any other’s type,

(31)

3. The baseline model 24 500 1000 1500 2000t - 0.5 0.0 0.5 1.0 (a) Returns rt, C = 0 500 1000 1500 2000t 0.2 0.4 0.6 0.8

(b) Fraction of trend followers ξt, C = 0

500 1000 1500 2000t - 1 0 1 2 (c) Returns rt, C = 0.5 500 1000 1500 2000t 0.7 0.8 0.9 1.0

(d) Fraction of trend followers ξt, C = 0.5

Figure 3.6: rt and ξt under C = 0 and C = 0.5

she switches types with probability pc. As an example, for pc = 0 an agent would never switch types independently but only when her zone is overcrowded, she chooses the herd’s opposite strategy with certainty. For pc = 1 the agents in the survival mode always switch to the herd’s

op-posite strategy and the agents with no leader switch types independently with certainty.

Two examples for pc = 0.4 and pc = 1 are illustrated in Figure 3.7. For

pc> 0 the fractions exhibit fairly erratic behaviour (due to frequent type

switching of leaderless agents), whereas, for pc = 1, we see much stronger

trend with periods with constant fractions (horizontal line segments in Figure 3.7(b)).

Observable distance δ The change in the observable distance δ affects mainly

the repulsion ratio ρt. For δ = 0, there is no observable zone at all so the

survival mode is never activated. For δ ≥ S = 500, the observable zone contains the whole 2D space (i.e. the square box as in Figure 3.3 would be encompassed in any agent’s circular observable zone). In Figure 3.8 we show the repulsion ratios ρt for low and high δ. When the zone is

(32)

3. The baseline model 25 500 1000 1500 2000t 0.4 0.5 0.6 0.7 0.8 0.9 1.0

(a) Fraction of trend followers ξt, pc= 0.4

500 1000 1500 2000t 0.6 0.7 0.8 0.9 1.0

(b) Fraction of trend followers ξt, pc= 1

Figure 3.7: ξt under pc= 0.4 and pc= 1

small (δ = 10), the survival mode is rarely activated (in 0.1% cases), whereas, for large zone (δ = 400), all agents are almost always in the survival mode, trying to escape from the herd and switching types with probability 1 − pc = 0.99. 500 1000 1500 2000t 0.01 0.02 0.03 0.04 0.05 0.06

(a) Repulsion ratios ρt, δ = 10

500 1000 1500 2000t 0.90 0.92 0.94 0.96 0.98 1.00 (b) Repulsion ratios ρt, δ = 400

Figure 3.8: Repulsion ratios ρt for δ = 10 and δ = 400

Trend following strength g As seen in Equation 3.5, the trend following strength

g has direct impact on the speed of price adjustment. When g = 0, both trend followers and fundamentalists forecast the same price and the re-spective fitnesses differ only in the fundamentalist cost C. This suggests that, on average, there should be many more trend followers than fun-damentalists, which is confirmed by our simulation – for g = 0, 94% of agents are trend followers on average. The remaining few percent are due to type switching in the survival mode. For 0 ≤ g / 1.5, the ratio of trend followers gradually decreases with g as UF

t exceeds UtT r much

more often than for low g, and the fundamentalist strategy thus becomes popular.

(33)

3. The baseline model 26

For values of g ' 1.5, the path of the returns rt and fitnesses is explosive

and usually terminates the simulation due to reaching extreme values. Theoretically, the explosive paths could be expected for any g > R2 (see

lemma in Brock & Hommes, 1998, p. 1251) since then the ratio no longer has a dampening effect on past returns.

Herding threshold τ At last, we have a look at the effect of change in the

herding threshold τ . Figure 3.9 shows the ratio of trend followers for τ = 30 and τ = 150. In the former case, we see that when there are any agents in the repulsion zone (not plotted), the fraction of trend followers oscillates wildly. In the second case, τ is high (in fact, the survival mode is never activated for any agent and, hence, the repulsion ratio remains zero), and we see long periods of time with constant ratio of trend follow-ers. Any change in the type of agents is only induced through comparing fitnesses of the agents in δ or, marginally, through independent switching with probability pc, leading to tiny spikes in Figure 3.9(b).

500 1000 1500 2000t 0.4

0.6 0.8 1.0

(a) Ratio of trend followers ρt, τ = 30

500 1000 1500 2000t 0.6 0.7 0.8 0.9 1.0

(b) Ratio of trend followers ρt, τ = 150

(34)

Chapter 4

The extended model

4.1

Description of the extended model

4.1.1

Forecasting rules

We now extend the model to allow for much richer heterogeneity among the agents. In particular, we allow for agent-variant (linear) forecasting rules among the agents. We do not permit non-linear forecasting rules of any form to keep the model as simple as possible. As mentioned in the literature review in Section 1.2, there is experimental evidence that simple rules are used by human subjects as well. The forecasting rule is now specified as:

fit = gitx˜t+ bit ∀i ∈ {1, . . . , N } (4.1)

where gi ∈ (gmin, gmax) is the trend following (g ≥ 0) or contrarian (g < 0)

strength and bi ∈ (bmin, bmax) is the bias of each agent, bi R 0 and ˜xt =

PL

l=1λ lx

t−l, i.e. x˜t is the geometric decay process with the decay

parame-ter 0 < λ ≤ 1 and memory length L time periods. Figure A.5 illustrates the speed of decay of past price deviations depending on the value of λ. It is clear that for low values of λ there is no need to increase L because the more distant return lags would only get negligible weight. Conversely, for λ close to 1, even price deviations in the distant past carry considerable weight in determination of today’s price.

4.1.2

Price updating mechanism

Since we have many more strategies than in the baseline model (where we only had fundamentalists and trend followers), the price updating mechanism is now

(35)

4. The extended model 28 xt= 1 N R N X i=1 fit+ t= 1 R(¯gtx˜t+ ¯bt) + t (4.2) i.e. the price deviation xtis a sum of the average forecast and the average bias

of all agents from t − 1 and a small error term. The returns rt are defined as

in the baseline model and the fitness measure Uit is now generally defined as:

Ui,t−1 = (xt−1− Rxt−2)

 gitxt−3+ bit− Rxt−2

σ2



− Cit (4.3)

In the baseline model, the cost C was only paid by fundamentalists. In this case, the probability of having a fundamentalist in a cohort of agents is equal to zero since the strategy parameters g and b are initially drawn randomly from the interval (gmin, gmax) or (bmin, bmax), respectively. We thus introduce so-called

pseudo-fundamentalists – agents whose strategy is very close to fundamentalist. In other words, if |g| < γ and |b| < γ where γ is a threshold relatively close to zero then the agent is a pseudo-fundamentalist and must pay the fixed cost Cit = C as in the baseline model.

As in the baseline model, the observable distance δ and the herding thresh-old τ are kept constant and agent-invariant.

4.1.3

Roulette selection of the forecasting rules

The roulette selection is a procedure used in genetic algorithms that ascribes probabilities of selection according to the respective fitnesses of the agents (see Miller & Goldberg, 1995; Blickle & Thiele, 1995; B¨ack, 1996). Unlike in the baseline model where each agent simply chooses her leader – the agent with the highest fitness – with certain probability, in this model, an agent considers all neighbours with higher fitness than herself and then ascribes them probabilities of choosing their strategies. These probabilities reflect the relative difference in fitnesses between the neighbours and the agent. This augmentation of the information set is more realistic since, in reality, economic agents hardly base their economic decisions on a unique piece of information but try to diversify and obtain as much information as possible.

As an example, consider an agent i with J neighbours in her observable dis-tance δ that have higher fitness than herself. She then computes the (standard-ized) differences in fitnesses ∆Uj∗ = Uj−Ui

maxj(|Uj−Ui|) for each of the J neighbours

(36)

4. The extended model 29

pjt =

1 1 + e−β∆Uj∗

(4.4) The probability function is the same as in the baseline model and is plotted in Figure A.2 (note that we are interested in the right arm of the function since ∆Uj∗ > 0). For each of the J neighbours, we obtain a probability (necessarily higher than 1/2) which will serve as a weight for choosing agent j’s strategy.

These probabilities only sum to 1 after rescaling by the sum of all the proba-bilities. Intuitively, the higher the relative difference between the agent’s and neighbour j’s strategies as compared to other agents, the higher the probability of choosing agent j’s strategy.

The role of the herding threshold τ , the critical probability pc and the sur-vival mode is now altered as well. First of all, activation of the sursur-vival mode no longer depends on the absolute number of agents within δ but uniquely on the number of agents with the same strategy. Since we face complete heterogene-ity with respect to strategies among agents, we would expect that the survival mode is activated less frequently than in the baseline model because it is much less likely to encounter identical strategies within the herd. However, given the roulette selection described above, there is always a positive probability that agents adopt the same strategy at some point in time.

Consequently, the herding threshold is now set lower than in the baseline model, otherwise it would never be surpassed. When the survival mode is activated at last, i.e. when there are more than τ neighbours with the same strategy, the agent draws a strategy opposite to that of majority of the herd (as in the baseline model) from N (−sh, ˙σ) where sh is the mean strategy (h ∈

{g, b}) of the herd. In other words, in the survival mode, each agent adopts a strategy opposite to that of the herd subject to a small error, moderated by the standard deviation ˙σ.

4.2

Simulation of the extended model

In addition to the baseline parameters listed in Table 3.2, we now reset or define new parameters in Table 4.1.

As we can see, since |gmin| > |gmax|, we initialize the model with higher

number of contrarians than trend followers. This is mainly for computational reasons as more contrarians in the system avoid explosive returns paths. If gmaxis much higher than gmin, the returns increase too quickly due to fast trend

(37)

4. The extended model 30

gmin gmax bmin bmax γ δ τ L λ ˙σ

−2 1 −2 1 gmax

5 50 N

30 3 0.8 0.2

Table 4.1: Default parameter values of the extended model simula-tion

following and might reach astronomical values before the correction occurs. We also allow for memory in prices L = 3 with fairly high decay parameter λ. This means that xt−1, xt−2and xt−3have all significant impact on the determination

of today’s price deviation xt and of the return rt.

Unlike in the baseline model, we cannot plot the fitnesses of fundamentalists and trend followers because now we have a continuum of strategies among agents. A natural step is to look at the development of the cohort average trend following strength ¯gt and bias ¯bt through time. The key variables from

one random simulation are plotted in Figure 4.1 and summarized in Table A.3 (which also contains summary statistics from the complete simulation under different seeds). 500 1000 1500 2000t - 3 - 1 0 1 2 3 (a) Returns rt 500 1000 1500 2000t -0.5 0.0 0.5 bt gt

(b) Average trend following strength and bias

500 1000 1500 2000t 0.5 1.0 1.5 2.0 (c) Average fitness ¯Ut 500 1000 1500 2000t 0.1 0.2 0.3 0.4 (d) Repulsion ratios ρt

Figure 4.1: The extended model under the default parameter values We see that the returns rt exhibit usual mean-reversion and occasional

(38)

4. The extended model 31

spikes in both negative and positive directions. The average fitness ¯Utseems yet

more leptokurtic, despite averaging across all agents. As can be guessed from the top row, the periods with unusually low average bias ¯btcorrespond to

unusu-ally low negative returns. At a closer look, the periods with very low negative returns are immediately preceded by a few periods with very low bias but very high trend following strength whereas, in periods of the low returns, both ¯gt

and ¯bt are almost zero, suggesting that agents return to pseudo-fundamentalist

strategies.

The survival mode also has a significant impact on the dynamics of the model, as illustrated by fairly high repulsion ratios ρt in Figure 4.1(d). Note

that if the herding threshold was kept as high as in the baseline model, the re-pulsion ratios would only rarely be positive, due to lower chance of encountering identical strategies, as explained at the end of Subsection 4.1.3.

4.3

The extended model and the stylized facts

As in the baseline model, we perform the whole simulation Rep = 100 times. The main results from one random seed and from all seeds together are sum-marized in Table A.3. The performance, as compared to the baseline model, is also shortly discussed for each of the stylized facts.

Skewness & Kurtosis As we can see from Table A.3, the average kurtosis of

rt is notably higher than in the baseline model and with much higher

standard deviation. Even though we cannot conclude that there is statis-tical evidence for excess kurtosis due to high standard deviation, almost all kurtosis values across all seeds were higher than 3. Furthermore, if we pool the data from all simulations and treat them as one large dataset (with T × Rep = 200 000 observations), the kurtosis equals 5036.

On average, the skewness is negative with yet larger standard deviation than in the baseline model. The skewness values range from −18.174 to 11.652 across the simulation runs. This is not surprising since, as in the baseline model, the model does not provide any justification for higher incidence of either positive or negative returns.

Non-normality The frequent large values of kurtosis and skewness throughout

the simulations make it clear that the return distribution will be far from normal, which was also confirmed by the Jarque-Bera normality test –

(39)

4. The extended model 32

normality rejected with zero p-value. For comparison with the baseline model, we plotted the kernel densities of the respective returns next to each other. The result can be seen in Figure A.3. As suggested above, the returns data from the extended model are much more leptokurtic than in the baseline model.

Autocorrelation in rt Figure 4.2 shows the ACF and PACF for returns rt from

the extended model. Due to memory in returns in agents’ forecasts, the price deviations and thus the returns are more interrelated than in the baseline model (see the pricing mechanism in Equation 4.2).

The autocorrelation function is thus influenced by two counteracting forces – high heterogeneity of agents (dampening effect on autocorre-lation), and memory in returns in the forecasting rules of the agents (strengthening effect on autocorrelation).

-1.00 -0.50 0.00 0.50 0 50 100 150 lag (a) ACFof rt -0.60 -0.40 -0.20 0.00 0.20 0 20 40 60 80 100 lag (b) PACFof rt

Figure 4.2: ACF and PACF of rt, the extended model

We conclude that the extended model produces returns with stronger au-tocorrelation than the baseline model and does not replicate the stylized fact of no autocorrelation.

Autocorrelation in |rt| We are interested in how quickly the autocorrelation

in absolute returns disappears. We plot the power-law and exponential fit functions in Figure 4.3. Contrary to the baseline model, the autocor-relation in absolute returns decays much slower and can be fitted with a power-law function even for the complete, pooled dataset. As discussed in Section 1.3, this property is a sign of long-term dependency, caused by the interrelatedness of agents through the roulette wheel selection and by

(40)

4. The extended model 33

the moving geometric average process of the returns. We thus conclude that this stylized fact is better replicated by the extended model than by the baseline model.

A = 0.115, Α = 0.453 B = 0.922, Β = 0.737 20 40 60 80 100 120 140 l 10-48 10-40 10-32 10-24 10-16 10-8 1

(a) One random seed

A = 0.144, Α = 0.718 B = 0.784, Β = 0.245 20 40 60 80 100 120 140 l 10-13 10-10 10-7 10-4 0.1 (b) All seeds

Figure 4.3: Power law (dashed) and exponential decay (dot-dashed) fits for autocorrelation in |rt|, semi-log plot. Negative

autocorrelation values omitted.

Volatility clustering As in the previous section, we try to discover the

pres-ence of volatility clustering via the GARCH model. We ran the

ARMA-GARCHregression and the results are presented in Table 4.2. We see that all coefficients except the threshold term (as expected, given there is no evidence of negative skewness) are strongly significant. As in the baseline model, the extended model also replicates the stylized fact of clustered volatility.

In a nutshell, the extended model shows some improvement over the baseline model. We conclude that increased heterogeneity among the agents and deeper integration (roulette selection method, letting lags of returns influence today’s returns and increasing δ) mainly lead to more extreme observations of returns and long-range dependence. As expected, the extended model failed to yield consistently larger (in absolute terms) negative values since the model is not designed to do so.

(41)

4. The extended model 34 ARMA(1, 1)-TGARCH(1, 1) dep var: rt cons −0.000260 (−0.43) (−0.46) ARMA L.ar −0.812∗∗∗ (−356.45) (−383.07) L.ma 0.134∗∗∗ (23.89) (23.08) ARCH L.arch 0.138∗∗∗ (14.55) (28.88) L.tarch −0.00981 (−0.71) (−1.54) L.garch 0.738∗∗∗ (57.80) (102.06) cons 0.0216∗∗∗ (17.15) (24.63) t-statistics in parentheses.

3rd column: cluster and heteroskedasticity-robust standard errors used.

4th column: heteroskedasticity-robust standard errors used.

* p < .1, ** p < .05, *** p < .01

Table 4.2: ARMA(1, 1)-TGARCH(1, 1) model regression results, ex-tended model

(42)

Chapter 5

The limit-order model

5.1

Description of the limit-order model

The structure of our last model is very different to our previous two models. The pricing mechanism and the types of the agents are inspired by Iori & Chiarella (2002); Chiarella et al. (2009); Tedeschi et al. (2012b).

In summary, agents no longer imitate other agents via comparison of fit-nesses or past returns, nor they ascribe probabilities of such imitation. In this model, agents are fully independent and do not alter their strategies over time. The emphasis is put on the pricing mechanism and the interactions between the agents in the market place.

5.1.1

Forecasting rules

At the beginning of each time period t, each agent i ≤ N makes a forecast about the future return ζ periods ahead in the form1:

ˆ rt,t+ζi = g1ip f t − pt pt + g2irt+ nit i ≤ N, t ≤ T (5.1)

where g1 moderates the strength of the fundamentalist strategy, p f

t is the

fun-damental price, pt is today’s stock price, g2 is the trend-following (g2 > 0) or

contrarian (g2 < 0) strength, n is the strength of the noise trading strategy, rt

is today’s return, defined as rt = ptp−pt−1

t−1 and t ∼ N (0, 1). As it is commonly

assumed in the literature, the fundamental price is known by the agents and follows a random walk with pf0 = 1000 and standard deviation 10. It follows

1To be consistent with the previous chapters, the returns of any form are always denoted

(43)

5. The limit-order model 36

that the fundamental price pft is (filtration) Ft-adapted and is a martingale:

E(pft|Fs) = pfs, for any 0 ≤ s < t.

It is clear from Equation 5.1 that each agent’s return forecast is a weighted average of the three types of beliefs – fundamentalist, chartist and noise trading. In our model, the parameters g1, g2 and n are initially drawn from the uniform

distribution of ranges (0, g1max), (gmin2 , gmax2 ) and (nmin, nmax), respectively. Given the return forecast ˆrit,t+ζ over the period (t, t + ζ), the agents can also forecast the price at time t + ζ as:

ˆ

pit,t+ζ = pteˆr

i

t,t+ζ (5.2)

assuming continuously compounded returns. Depending on whether the agent expects a price increase (ˆri

t,t+ζ>0) or price decrease (ˆrt,t+ζi <0), she submits an

order to buy or sell one unit of stock:

bit = ˆpit+ζ(1 − ki) (5.3) ait = ˆpit+ζ(1 + ki) (5.4) where bt (at) is the bid (ask) offer, equal to the price forecast ˆpit+ζ times the

discount factor 1−ki (or 1+ki), with ki uniformly distributed in (0, kmax). The

offered buying price bt thus reflects agent’s expectation about the stock price

pt+ζ and, if executed, the transaction gives the agent the possibility to gain

(1 − ki), if his price forecast is correct, or (p

t+ζ− ˆpit,t+ζ)(1 − ki) if pt+ζ > ˆpit,t+ζ.

Note that ai

t ≥ 0, bit ≥ 0 and aitbit = 0, i.e. no agent can submit a bid and an

ask at the same time.

5.1.2

Pricing mechanism

In the previous two models, the pricing mechanism was perceived as an expec-tation feedback system in the sense that the expecexpec-tations of the agents about the future directly determined the future price. The biggest difference between the limit-order market and the two previous models is that the stock price pt and corresponding returns rt are set as in the real financial markets – by

interaction of traders and matching bid/ask offers.

The price formation works as follows. At the beginning of each time period t, all agents make a forecast about the return ˆri

t,t+ζ (as in Equation 5.1) and

Referenties

GERELATEERDE DOCUMENTEN

Een deel van deze auto’s zal geteld zijn omdat de bezoekers eerst naar het parkeerterrein zijn gereden om te kijken of daar nog plek was, een deel van

This is not the first paper to give an answer to the question that was raised in [PSV10], Can we prove convergence using the Wasserstein gradient flow.. In [HN11], Herrmann and

Noting that Indilinga was conceptualised as a medium through which African scholars could reveal their indigenous scholarship and contribute to the emancipation of

Our main results are representations for the decay parameter under four different scenarios, derived from a unified perspective involving Karlin and McGregor’s representation for

[r]

defined in the Constitution. The consequence of not providing such a definition is that in the case of S v Makwanyane, 16 a landmark judgment in South African

Considering the critical condition of food insecurity in South Africa, this thesis sets to find out, if urban agriculture constitutes an important source of livelihoods by

ISO (INTERNATIONAL ORGANIZATION OF STANDARDIZATION). Environmental management—lifecycle assessment—principles and framework. Geneva: International Organization for