Learning-To-Forecast with Genetic Algorithms

losolivossnowΤεχνίτη Νοημοσύνη και Ρομποτική

23 Οκτ 2013 (πριν από 4 χρόνια και 15 μέρες)

114 εμφανίσεις

Learning-To-Forecast with Genetic
Algorithms
Working paper
Version February 2013 with appendices
Mikhail Anufrievy,Cars Hommesz and Tomasz Makarewiczz
yUniversity of Technology,Sydney
zCenter for Nonlinear Dynamics in Economics and Finance,University of Amsterdam;
Tinbergen Institute
Amsterdam { February 27,2013
Learning to Forecast with Genetic Algorithms
Working paper | version February 2013
Mikhail Anufriev,Cars Hommes and Tomasz Makarewicz
February 27,2013
Abstract
In this paper we study a model in which agents independently optimize rst order
price forecasting rule with Genetic Algorithms.This agent-based model (inspired by
Hommes and Lux,2011) allows for explicit individual heterogeneity and learning.We
show that it replicates individual behavior in various Learning-to-Forecast experiments.
In these,the subjects are asked to predict prices,which in turn depend on the predictions.
We use the data from Heemeijer et al.(2009) to ne tune our GA model.Furthermore
we investigate three other LtF experiments:with shocks to the fundamental price (Bao
et al.,2012),cobweb economy(vd Velden,2001;Hommes et al.,2007) and two-period
ahead nonlinear asset pricing market (Hommes et al.,2005).We perform a Monte Carlo
exercise with 50-period ahead simulations and use Auxiliary Particle Filter to study one-
period ahead forecasting performance of the model on the individual level,a novelty in
the literature on agents-based models.Our model is robust against these complicated
settings and outperforms many homogenous models,including Rational Expectations.
1 Introduction
Price expectations are a cornerstone of many economic models,because the economic agents
often operate in a dynamic context.Consumers have to organize their life-time work and con-
sumption paths,while companies decide on how to build up future production capabilities.In
either case,the agents want to know how the uncertain future may unfold.What makes mod-
eling predictions dicult is that they typically form a feedback with the realizations through
agents decisions.For instance,if everybody expects an increased price of a consumption good,
consumers are likely to save less,while rms rise production.This implies lower market clear-
ing price in the future { scenario not anticipated by the agents.It is therefore likely that they
would alter their predictions,leading to a new realized price.
Even if the agents know the structure of the economy,the price-expectation feedback can
to lead to non-trivial dynamics (Tuinstra and Weddepohl,1999).This picture becomes more
complicated if the agents furthermore have to learn this structure (Grandmont,1998).Agents
do want to form ne price expectations,but how would they cope with this complexity?
1
The traditional literature (after Muth,1961) emphasizes Rational Expectations (RE) hy-
pothesis,which states that in the equilibrium the predictions have to be model consistent.
Most economists would interpret RE as an`as-if'approximation { real markets behave as if
their representative agents were perfectly rational,because the real people are rational enough
to learn to avoid systematic,correlated errors.
1
However,this is not conrmed by the data.
Recent important example comes from the housing market in US before the latest economic
crisis,where people systematically misjudged the long-termvalue of their houses (Bentez-Silva
et al.,2008;Case and Shiller,2003;Goodman Jr.and Ittner,1992).In a broader context,
the in ation expectations formed by the`Jones'are far from the RE predictions (Charness
et al.,2007) and can be subject to cognitive biases (Malmendier and Nagel,2009).Many
rms similarly fail to use RE (see Nunes,2010,for an example on Phillips Curve and survey
expectations).
The failure of RE made many economists look for an alternative model with explicit
learning.They faced the so called`wilderness of bounded rationality'problem:there is
a myriad of possible learning mechanisms with varied restrictions on human memory and
computational capabilities.These range from simple linear heuristic models (see Evans and
Ramey,2006,for a discussion of adaptive expectations),through econometric learning (Evans
and Honkapohja,2001),through heuristic switching type of models (Brock and Hommes,
1997) to evolutionary learning mechanisms (Arifovic et al.,2012).Moreover these mechanisms
can lead to dierent dynamics.For example,Bullard (1994) and Tuinstra and Wagener
(2007) show that for a standard OLG economy,where the agents use OLS learning for price
forecasting,the choice of the learned variable (level of prices or in ation) makes a dierence
between stable and chaotic dynamics.
Learning-to-Forecast (LtF) experiments (Hommes,2011) oer a simple testing ground for
learning mechanisms.In these,the controlled experimental economies are simple and have
a straightforward fundamental (RE) equilibrium.Just as in the case of the real markets,
the subjects observe the realized prices and their past individual predictions,but not the
history of other subjects'predictions,and are not directly informed about the quantitative
law of motion of the economy.Many LtF experiments contradict the RE hypothesis.The
subjects can coordinate on oscillating and serially correlated time series.Convergence to the
fundamental equilibrium happens only under severe restrictions on the experimental economy
(Hommes,2011).Another important nding in the experiments is heterogeneity:within the
same experimental group,subject tend to give dierent predictions with dierent dynamic
structure and reliance on the past prices,which cannot be fully explained by the type of the
experimental economy.
The most successful attempt to explain the LtF experiments comes with the so-called
Heuristic Switching Model (HSM;Brock and Hommes,1997).The basic idea of the model
is that the agents have a set of simple forecasting heuristics (rules of thumb like adaptive or
1
One interesting and straightforward explication of this approach can be found in the concluding section
of Blundell and Stoker (2005).
2
trend extrapolating expectations) and choose those that had a better past performance.The
model replicates the stylized,aggregate dierence between the treatments in Heemeijer et al.
(2009) (henceforth HHST09).Nevertheless,the authors consider a limited set of heuristics
and so cannot fully account for the individual heterogeneity.Moreover they are unable to
explain the mechanism,with which the subjects would learn those heuristics.For instance,
Anufriev and Hommes (2012) use HMS to explain the experimental from a non-linear asset
pricing experiment (Hommes et al.,2005) (henceforth HSTV05),but only with a broader set
of forecasting rules.
In our paper we would like to reinforce the original HSMso that it will be able to replicate
the individual learning and heterogeneity in various experimental settings.To do so,we will
use Genetic Algorithms (GA).GA are a exible optimization procedure,thus the GA-based
model retains basic economic interpretation.Agents,who use GA,have to rely on a second-
best forecasting rules.Nevertheless,they learn to use them eciently.For example,if there
is a signicant trend in the data,the agents may want to harvest speculative trade revenues.
To do so,they will update their forecasting rule's parameters with GA,making it more trend
extrapolative.
GA was already used in its social learning form to explore stylized facts from experimental
data,outperforming RE hypothesis (Arifovic,1995),with the examples of the exchange rate
volatility (Arifovic,1996;Lux and Schornstein,2005) or quantitative choices in a cobweb
producers economy (Dawid and Kopel,1998).More mature use of GAcan be found in Hommes
and Lux (2011).In their setting the agents use GA to optimize a forecasting heuristic (instead
of directly optimizing a prediction) and,much like the actual subjects in LtF experiments,
cannot observe each others behavior or strategies.With this versatile model,Hommes and Lux
(2011) replicate the distribution of the predictions and prices of the cobweb experiments by
Hommes et al.(2007) and van de Velden (2001) (henceforth HSTV07 and V01 respectively).
In our paper,we want to build upon the GA-based individual learning introduced by
Hommes and Lux (2011) to explain the LtF experiments.The novelty of our paper is threefold.
The rst is that we will use a dierent than Hommes and Lux (2011) heuristic space,based on
the so called rst order rule,which is a mixture of adaptive and trend extrapolating heuristics.
This gives the model better micro-foundations,as HHST09 nd this rule to describe well the
individual expectations in their experiment.
The second novelty is that our model allows for a simultaneous explanation of dierent LtF
experiments,based on markets with breaks in the fundamental price or a highly non-linear
price expectations feedback.This challenge will prove the generality of our model.Finally,
the third novelty is that we explain the individual,not just the aggregate results of the LtF
experiments.We will use Auxiliary Particle Filter (Johansen and Doucet,2008),technique
based on Sequential Importance Sampling,to show that our model replicates the behavior of
the individual subjects.This is a major contribution to the literature,which usually focuses
on a model's t to the aggregate stylized facts,even if that model is agent-based by design.
The structure of the paper is the following.In the second section,we explain in detail the
3
Learning to Forecast experiments and also comment on the insight brought by the Heuristic
Switching Model.In the third section,we introduce the Genetic Algorithm model.We
calibrate it with the simple,linear feedback system from HHST09.We also comment on how
to use the Auxiliary Particle Filter to evaluate the t of the model to the individual predictions.
In the fourth section,we will use our model to describe the following experimental economies:
linear price-expectations feedback system with unexpected shifts to the fundamental price
(Bao et al.,2012) (henceforth BHST12);cobweb producers economy (HSTV07;V01) used also
by Hommes and Lux (2011);and nally a highly non-linear positive feedback asset pricing
economy,where the subjects are asked for two-period ahead predictions (HSTV05).The last
section will summarize our paper.For the sake of brevity and clarity,we decided not to
include too many technical details in the main text,including the full formal denition of
GA,or many robustness checks against the model specication.These can be found in the
appendix.
2 Learning to Forecast and Heuristic Switching
Consider a market with a set of subjects i 2 f1;:::;Ig,who are asked at each period t to
forecast price of a certain good.The subjects are explicitly informed that they are asked
only for and rewarded only for the accuracy of the predictions.Their role is of a forecasting
consultants for rms.These rms in turn will use subjects'predictions to optimize their
behavior,which determines the next market price.The subjects have no other in uence on
the realized price.The feedback relationship between the prices and predictions is summarized
by a reduced form law of motion in the form of
(1) p
t
= F(p
e
1;t
;:::;p
e
I;t
);
where the p
t
denotes the price and p
e
i
is the agent's i expectation of p
t
and F() results from
aggregating rms optimal choices.This is one-period ahead type of feedback,in the sense that
the price at period t depends on the predictions which were formulated after the previous price
p
t1
becomes known to the subjects.Dene the fundamental price p
f
as the RE outcome,the
self-consistent prediction:p
f
= E

F

p
f
;:::;p
f

.
Unlike the RE agents,subjects in the experiment have a limited information about the
market.They are told that their predictions in uence the average market mood,which in turn
determines the realized price,but they are given only a qualitative story about this feedback.
Moreover,they are not explicitly informed about the fundamental price.
2
One important example was investigated by HHST09,who use a linear version of (1):
(2) p
t
= A+B

P
I
i=1
p
e
i;t
I
A
!
= A+B(p
e
t
A);
2
Usually it is possible to infer it from the experiment instructions.Anecdotal evidence suggests that even
economics students,including graduate students,fail to realize it.
4
where p
e
t
=
P
I
i=1
p
e
i;t
I
is the average prediction at period t and A = p
f
is the fundamental
price.The two cases are with B > 0 (positive feedback) and B < 0 (negative feedback).A
typical example of the positive feedback market is a stock exchange.The investors will buy a
certain stock if they are optimistic and expect it to become more expensive.But this increased
demand means that the stock's price will indeed go up.In this way the investor sentiments
are self-fullling.the contrary case is a producers economy,who face a lag in the production.
If the producers expect high price in the future,they will increase the production and so the
future price must be low for the markets to clear.Here,there is a negative feedback between
predictions and prices.
In the experiment,the authors used two specic treatments for I = 6 subjects:
Positive feedback:p
t
=
20
21
(3 + p
e
t
) +"
t
;(3)
Negative feedback:p
t
=
20
21
(123  p
e
t
) +"
t
;(4)
where"
t
 NID(0;0:25) is a small disturbance and the experiment run for 50 periods for
each group in both treatments.
The two treatments are symmetric.They have the same unique fundamental price p
f
= 60.
Also,the dumping factor jBj =
20
21
is the same in absolute terms.It was chosen so that under
naive expectations (p
e
t
= p
t1
),the fundamental price for both treatments is a unique and
stable steady state,but the system would still require some time to converge.
The two feedback treatments resulted in very dierent dynamics,see Figure 1a and Fig-
ure 1b for typical time series for the negative and positive feedback treatments respectively.
The price under the negative feedback would jump around the fundamental for a handful of
periods and hence converge to it.Only after that would the subjects converge to the fun-
damental as well,and before that their behavior was volatile.Most of the groups under the
positive feedback resulted in systematic oscillations as seen on Figure 1b,where the price twice
overshoots and once undershoots p
f
;and if the price actually converged to the fundamental,
it did so only towards the end of the experiment (which happened for two out of seven cases).
In spite of that,the subjects would coordinate in around three periods and remain so until
the end of the experiment.This means that the price oscillations were caused by systematic
prediction errors (in respect to the RE outcome),which were highly correlated between the
subjects.
To describe the subjects'behavior,HHST09 focus on the rst-order rule (FOR):
(5) p
e
i;t
= 
1
p
t1
+
2
p
e
i;t1
+
3
60 +(p
t1
p
t2
);
for 
1
;
2
;
3
> 0,
1
+
2
+
3
= 1, 2 [1;1].The authors estimated this rule separately
for each subject,based on their predictions from the last 40 periods.Notice that the third
term,the fundamental which is associated with the 
3
coecient,was used for the sake of
5
stationarity of the estimation,and to test the RE hypothesis.
3
HHST09 nd that the individual forecasting rules are varied between the subjects,even
within the same treatment.The authors also report signicant dierence between the two
treatments.Under the positive feedback,subjects tended to focus on trend extrapolation and
estimated 
3
fundamental price coecients were insignicant.Under the negative feedback,
the reverse holds:trend extrapolation is barely used,while the weight for the fundamental
price is signicant.This shows that a model with a homogeneous forecasting rule (RE,but
also linear heuristics like trend extrapolation or naive expectations) may explain one of the
two treatments,but not both at the same time.Moreover,it cannot explain the signicant
dierences between the subjects within each treatment.
This led Anufriev et al.(2012) to investigate the Heuristic Switching Model (HSM),in
which the subjects are endowed with two prediction heuristics:
adaptive:p
e
i;t
= p
i;t1
+(1 )p
e
i;t1
for  2 [0;1],
trend extrapolation:p
e
i;t
= p
i;t1
+(p
t1
p
t2
) for  2 [1;1],
where the authors have used  = 0:75 and  = 1.Both heuristics are a special case of
the rst-order rule.The adaptive heuristic is the FOR with 
3
=  = 0,while the trend
extrapolation is the FOR with 
2
= 
3
= 0.The idea of the model is that people adapt their
behavior to the circumstances.Subjects can at any time use any of the two heuristics,but
will focus on the one with higher relative past performance.Under the positive feedback,the
agents easily coordinate their predictions below the fundamental,but (by the construction of
the feedback equation) the realized price is slightly higher than the average prediction.Trend
extrapolation heuristic captures this gradual increase of the initial prices and so becomes
more popular among the agents.This reinforces the trend,as well as the performance of
the heuristic itself.Reverse story holds for the negative feedback:there is no possibility of
coordination unless the agents converge to the fundamental price,otherwise the realized price
is in contrast with the average market expectation.In this case adaptive expectations can
have a better performance,as they facilitate the agents to converge to the fundamental.
HSMcaptures the essence of the aggregated predictions behavior and successfully replicates
the results of HHST09 in a stylized fashion.The drawback of the model is that the authors
assume a limited space of heuristics.At rst glance this is not a problem,since the model can
be easily extended to include a broader portfolio of predicting rules (Anufriev and Hommes,
2012).Nevertheless,the model cannot explain two things.First issue is where do those
heuristics come from,that is,how the subjects are able to learn the two heuristics in the rst
place.Second issue with HSMis that it cannot account for the heterogeneity of rules between
the subjects and explain the experiment on the individual level.To answer these two issues,
we will introdcue a model with explicit individual learning through Genetic Algorithms.
3
Under RE,FOR in (5) should be specied with 
1
= 
2
=  = 0,which implies that the subjects always
predict the fundamental price,p
e
i;t
= 60.
6
3 The model
3.1 Genetic Algorithms
Genetic Algorithms (GA) is a class of numerical stochastic maximization procedure,which
mimics the evolutionary operations with which DNA of biological organisms adapts to the
environment.GA were introduced to solve`hard'optimization problems,which may involve
non-continuities or high dimensionality with complicated interrelations between the argument.
They are exible and ecient and so found many successful applications in computer sciences
and engineering (Haupt and Haupt,2004).
GA routine starts with a population of random arguments that are possible,trial solutions
to the problem.Individual trial arguments are encoded as binary strings (strings of ones or
zeros),or chromosomes.They are retained into the next iteration with a probability that
increases with their relative performance,which is dened in terms of the functional value
of the arguments.This so called procreation operator means that with each iteration,the
population of trial arguments is likely to have a higher functional value,i.e.be`tter'.On
the top of the procreation,GA uses three evolutionary operators that allow for an ecient
search through the problem space:mutation,crossover and election,where the last operator
was introduced by the economic literature (Arifovic,1995).
Mutation At each iteration,every entry in each chromosome has a small probability to mu-
tate,in which case it changes its value from zero to one and vice versa.The mutation
operator utilizes the binary representation of the arguments.A single change of one bit
at the end of the chromosome leads to a minor,numerically insignicant change of the
argument.But with the same probability a mutation of a bit at the beginning of the
chromosome can occur,which changes the argument drastically.With this experimenta-
tion,GA can easily search through the whole parameter space and have a good chance
of shifting from a local maximum towards the region containing the global one.
Crossover Pairs of arguments can,with a predened probability,exchange predened parts
of their respective binary strings.In practice,the crossover is set to exchanges subset
of the argument.For example,if the objective function has two arguments,crossover
would swap the rst argument between pairs of trial arguments.This allows for experi-
mentation in terms of dierent mixtures of arguments.
Election Election operator is meant to screen inecient outcomes of the experimentation
phase.This operator transmits the new chromosomes (selected from the old generation
and treated with mutation and crossover) into the new generation only if their functional
value is greater than that of the original`old'argument.This operator ensures that
once the routine nds the global solution,it will not diverge from it due to unnecessary
experimentation.
7
The procreation routine and the three evolutionary operators have a straightforward eco-
nomic interpretation for a situation,in which the agents want to optimize their behavioral
rules,e.g.price forecasting heuristics.The procreation means that { like in the case of HSM
{ people focus on better solutions (or heuristics).The mutation and crossover are experimen-
tation with the heuristics'specications,and nally the election ensures that the experimen-
tation does not lead to suboptimal heuristics.
For the sake of presentations,we give the specic formulation of our GA in Appendix A.
For the technical discussion and examples of GA applications see Haupt and Haupt (2004).
3.2 Model specication
Consider the price-expectation feedback economy,which was introduced in the previous section
and which is captured by the reduced-form law of motion (1).We consider a set of I agents,
which we will call GA agents.GA agents use a general forecasting rule which requires exact
parameter specication,and each agent is endowed with H such specications.For the whole
following analysis,we take H = 20.Following the estimations by HHST09,we deploy a
modied rst order rule (FOR) in order to give our model robust micro-foundations.
To be specic,agent i 2 f1;:::;Ig at time t focuses on H linear prediction rules to predict
price at that period p
t
given by
(6) p
e
i;h;t
= 
i;h;t
p
t1
+(1 
i;h;t
)p
e
i;t1
+
i;h;t
(p
t1
p
t2
);
where p
e
i;h;t
is the prediction of price p
t
,formulated by the agent i at time t conditional on
using the rule h,and p
e
i;t1
is the nal prediction by the agent of the price at time t 1,which
the agent submitted to the market.
Notice that this specication (6) is a special case of the general FOR from equation (5),
with the anchor or the fundamental price weight 
3
= 0.We experimented with specications
with some possible anchors,but they could not properly account for the dynamics in the
positive feedback market.
4
We will refer to the 
i;h;t
2 [0;1] parameter as the price weight,
in contrast to the past predictions:the higher it is,the less conservative is the agent in her
predictions.The trend extrapolation parameter 
i;h;t
shows the extent to which the agent
want to follow the recent price change.For convenience we will drop the subscripts of these
two parameters whenever we refer to them in general.
Contrary to the price weight ,the choice of the allowed interval for the trend extrapolation
is not immediately clear.Experimentation has led us to take the upper bound of  to be equal
to 1:1,as this specication seems to t well to the positive feedback.
5
Thus,there are two
equally intuitive choices for the lower bound.At rst glance,the interval should be symmetric
around zero,so that the agents can learn to contrast the trend to the same degree as they
4
To be specic,we looked on the average price so far,and the fundamental price itself,see Appendix C
for a discussion.Note also that (6) is a combination of the two heuristics (trend extrapolation and adaptive
expectations) used by Anufriev et al.(2012),who also had no need for an anchor for their HSM.
5
Please refer to Appendix C for a discussion.
8
can extrapolate it.We refer to the model with such specied  2 [1:1;1:1] as GA FORT+C
(trend and contrarian).On the other hand,it is not immediately clear that people perceive
trend contrarian and extrapolative rules in the same way.In fact HHST09 report only two
subjects to use contrarian strategies,so one may nd it more appropriate to focus on a
model with  2 [0;1:1],which we will refer to as GA FORT (trend only).For the HHST09
experiment,the two specications for all practical reasons behave in the same way,so for the
sake of brevity we will report results only for the model with unrestricted contrarian rules GA
FOTR+C.However,this will not be the case for other experimental data,to which we will
come back in the next section.
Dene H
i;t
as the set of such heuristics of agent i at time t.We emphasize that these
sets can be heterogeneous between the agents.Furthermore GA agents do not want to have a
static set of heuristics.Instead,they want to learn:to optimize the heuristics so that they can
adapt to the changing landscape of the economy.For example,in some circumstances it may
pay o to focus on the trend in the data and agents would like to nd the optimal degree of
trend following,by experimenting with dierent trend extrapolation coecients 
i;h;t
.Agents
do so by updating the set of heuristics with GA.
To be specic,the agents evaluate their heuristics based on the hypothetical forecasting
performance of these heuristics in the previous period,where their objective is prediction's
mean squared error (MSE).Formally,at the beginning of each period t,they focus on the
following hypothetical performance measure:
(7) U
i;h;t
= exp

(p
e
h;i;t1
p
t1
)
2

:
Thus dene the normalized performance measure as:
(8) 
i;h;t
=
U
i;h;t
P
H
k=1
U
i;k;t
;
which is a logit transformation of MSE.The normalized performance measure (8) can be
directly interpreted as the weight attached to each heuristic h by agent i at time i { the
probability with which the agent wants to use that heuristic.
6
Agents compute the weights U
i;h;t
twice each period.First time happens during the learning
phase.Once p
t1
becomes available to the subjects,heuristic parameters from H
i;t1
are
encoded as GA binary strings and undergo one iteration of GA operators to form H
i;t
,where
the U
i;h;t
is used as the GA objective function.The important thing is that the agents
run independent GA iterations,or more formally,the model consists of I independent GA
procedures.Intuitively,the agents cannot observe each others heuristic sets,in specic they
cannot exchange successful specications.The GA procedure utilizes procreation and three
6
Notice that (8) is dierent than the actual experimental payo received by the subjects,and which was
used by Hommes and Lux (2011) in their GA model.We decided to use this performance measure for two
reasons.First,our model becomes general:it can be directly applied to other experimental data sets without
a change to its core ingredient.Second,in this way we obtain a clear link to the literature on HSM models,
which often uses the logit transformation of MSE in a similar fashion.
9
Parameter Notation Value
Number of agents I 6
Number of heuristics per agent H 20
Number of parameters N 2
Allowed  price weight [
L
;
H
] [0;1]
Allowed  trend extrapolation
FORT+C [
L
;
H
] [1:1;1:1]
FORT [
L
;
H
] [0;1:1]
Number of bits per parameter fL
1
;L
2
g f20;20g
Mutation rate 
m
0:01
Crossover rate 
c
0:9
Lower crossover cuto point C
L
20
Higher crossover cuto point C
H
1 (none)
Performance measure U() exp(MSE())
Table 1:Parameter specication used by the Genetic Algorithms agents.
evolutionary operators,with each agent using the same specication of parameters shown in
Table 1.U
i;h;t
is taken directly as the objective function,crossover exchanges parameters 
i;h;t
and 
i;h;t
between heuristics and each parameter is encoded with 20 bits,meaning 40 bits per
each heuristic.
7
After the agents have learned,that is,after the agents have updated their heuristic sets,
they have to pick one specic heuristic in order to dene their predictions for the period t,p
e
i;t
.
For this task they sample one heuristic h 2 H
i;t
with normalized (7) performance measure as
probabilities,but after the set of heuristics was updated (because of the optimization step,
the set H
i;t
in principle can be dierent from H
i;t1
).This means that the actual probabilities
(8) have to be recalculated.
The timing of the model is the following.Until some moment the agents cannot learn:the
rule itself requires past prices and predictions.In those periods,the agents sample random
predictions from a predened distribution which we take as exogenous.The heuristics are
initialized at random from a`uniform'distribution:each agent i has 20 strings of 40 bits
representing H
i;t
(Table 1);and each bit is initially 0 or 1 with equal probability.
Once the initial periods are over and the agents can start to learn,each period consists of
three steps:
1.Agents independently update their heuristics using one GA iteration,where the GA
criterion function is U
i;h;t
;
2.Agents pick particular heuristics and generate their predictions,and the probability that
a heuristic h by the agent i is chosen is given by the recalculated tness probability 
i;h;t
;
3.The market price is realized according to (1) and agents observe the new price.
7
Our model seems to be robust against reasonable parameter changes.
10
We would like to emphasize the way in which we have chosen the specication of the model.
Given its complexity,estimation of its parameters is for all practical reasons infeasible.As we
will discuss later,there is a way to obtain likelihood measures on the model with Auxiliary
Particle Filter (APF),but it remains computationally demanding,and so can be used for
calculating a small set of comparative statistics at most.
8
On the other hand,GA parameters have no direct economic interpretation and we are not
interested in identifying themwith an uncanny precision.To the contrary,we prefer to rely on
a predened specication that has well-known properties and is widely used in the literature.
To be specic,we use exactly the same set of parameters as Hommes and Lux (2011).
9
As
mentioned before,the variable that requires calibrating is the allowed trend extrapolation .
We used the experimental data reported by HHST09 to ne-tune our model in this respect.
10
Despite the model not being directly estimated,we nd it to be able to replicate the stylized
results of the HHST09 experimental data,both on the aggregate and the individual level.
3.3 50-period ahead simulations for HHST09
First test for tness of our model to the experimental data are 50-period ahead simulations
for the HHST09 experiment (as was the number of periods for all experimental groups).
11
We
take the feedback equations (4) and (3) for the negative and positive feedback respectively
and simulate our model for 50 periods in total,without any information from the experiment
after (and including) period 2,specically the realized prices and predictions.
12
Such a 50-period ahead simulation depends on the random numbers used by the model,
since GA is a stochastic procedure.To understand the 50-period ahead behavior of the model,
we resample it until we obtain a satisfactory distribution of its dynamics.We use this Monte
Carlo (MC) experiment to compare the model with the experimental data (with MC sample
equal to 1
0
000).We emphasize that this is a dicult test,since it requires the model to`stay
close'to the data for 50 periods.
13
.
For initialization,the model requires exogenous initial prediction.
14
In the experiment,the
initial predictions varied between and within the groups,whereas the group average seemed
to aect the later dynamics under the positive feedback treatment (Anufriev et al.,2012).
Therefore,we do not want to use the same initial predictions for all the 50-period ahead
8
For a dual-core Pentium with 2:7GHz clock and 3:21 GB RAM,a shot of APF for one experimental group
takes approximately 25 minutes for a relatively small number of 32 particles.
9
The exception is that we take the mutation rate 
m
= 0:9,instead of 0:6 like Hommes and Lux (2011).
Here we follow suggestion of Haupt and Haupt (2004).This has no signicant in uence our results.
10
Please refer to Appendix C for a discussion.
11
All simulations,as well as the GAand APF libraries,were written in Ox matrix algebra language (Doornik,
2007) and are available at request.
12
We include the realizations of"
t
to the feedback equation.
13
In one of the positive feedback treatment groups,one of the subjects`out of the blue'predicted ten times
higher price than both his previous forecast and the realized market price.This destabilized the whole market
for a number of periods.In the following analysis,we follow Anufriev et al.(2012) and omit this group and
hence focus on six positive feedback and six negative feedback treatment groups.
14
Recall from the previous discussion that we initialize the heuristics with a`uniform'distribution.We do
not change that for the 50-period ahead simulations,leaving only the issue of the initial predictions.
11
simulations.We follow suggestion by Diks and Makarewicz (2013) that a simple bootstrap
of the experimental initial predictions may be inecient for a large MC.Instead we sample
these from a distribution calibrated by Diks and Makarewicz (2013).
Negative feedback
Positive feedback
(a) Experimental Group 1
(b) Experimental group 1
(c) Sample GA FORT+C
(d) Sample GA FORT+C
Figure 1:HHST09:typical results for the experimental groups and sample 50-period ahead simu-
lations of the GAFORT+C model.Black line represents the price and green dashed lines
are the individual predictions.
For a rst impression,consider Figure 1 with sample paths from the experiment and
simulations of GA FORT+C.Notice that each group or simulation has dierent initial predic-
tions.Despite that,for both type of feedback,the experimental data and the 50-period ahead
simulations are similar.Under the positive feedback,the GA agents coordinate in terms of
predictions in around three,four periods (Figure 1d).Moreover the distance between their
predictions is smaller in the second period than in the rst.Despite this coordination,the
agents oscillate around the fundamental and the price overshoots and undershoots the fun-
damental price p
f
= 60,in a similar vein to the experimental groups under this treatment
(Figure 1b).Under the negative feedback (Figure 1c),the price is pushed to the fundamental
outcome in around 5 periods.Only then the GA agents can actually converge as well.Before
that,their behavior is volatile,much like for the case of the experimental groups (Figure 1a).
These sample time paths are representative for the MC study for the GA FORT+C.
15
As the authors of the experiment,we focus on the distance of the realized price from the
fundamental (aggregate behavior) and the standard deviation of the individual six predictions
at each period (degree of coordination;individual behavior).
15
Results for GA FORT are comparable.
12
Negative feedback
Positive feedback
(a) Realized price
(b) Realized price
(c) Predictions standard deviation
(d) Predictions standard deviation
Figure 2:HHST09:Monte Carlo for the GA FORT+C 50-period ahead simulations.Realized
price and coordination (standard deviation of the individual predictions) over time.
Green dashed line represents the experimental median,black pluses are real observa-
tions;blue dotted lines are the 95% condence interval and red line is the median for the
GA FORT+C.Left column displays the negative feedback,right the positive feedback.
1
0
000 simulated markets for each feedback.
We report the results on Figure 2.As for the prices,Figure 2a shows the median and
the 95% Condence Intervals (CI) model prices across time for the negative feedback.For
95% of the simulations,the price is within [50;70] interval after roughly 5 periods,while after
10th period clearly converges to the fundamental,as did happen in the experiment.Dierent
pattern emerges for the positive feedback treatment (Figure 2b).Here,the distribution of
the prices does not collapse into a small region even after 50 periods,when 95% of the prices
stay in a wide [55;75] interval.Oscillations are a clear pattern,with the MC median (and
the 95% CI) price going up until around 20th period,then down for the next twenty periods
and up again.The fundamental price p
f
= 60 is not an unlikely outcome throughout the
last 35 periods,but the price can easily reach 80 from below and 45 from above.This is
a similar pattern to the experimental prices:the 95% CI of our model contain the bulk of
the experimental prices,almost all the groups until period 40 and still roughly half of the
observations afterward.
The GA FORT+C replicates subjects'coordination (standard deviation of six individual
predictions within each period) as well.For the positive feedback (Figure 2d),the six exper-
imental groups coordinated after at most 5 periods.The same holds for the model in which
the 95% CI are narrow and in the same 5 periods fall close to zero and remain there so.For
the negative feedback (Figure 2c),the experimental subjects can have varied predictions even
until the 15th period,the time required for the model 95% CI to converge as well.
13
Negative feedback
Positive feedback
(a)  price weight
(b)  price weight
(c)  trend extrapolation
(d)  trend extrapolation
Figure 3:HHST09:Monte Carlo for the GA FORT+C 50-period ahead simulations.Chosen co-
ecients of the price weight and the trend extrapolation.Blue dotted lines are 95%
condence interval,purple dashed are 90% CI and red line is the median for the GA
model.Left column displays the negative feedback,right the positive feedback.1
0
000
simulated markets for each feedback.
To sum up,50-period ahead simulations of our model GA FOTR+C replicate the stylized
behavior of prices and individual predictions.To be specic,we are able to capture with
our 95% CI 65% of the real prices and 81:(3)% of the predictions standard deviations for
the negative feedback treatment and 81% of the real prices and 71:(6)% of the predictions
standard deviations for the positive feedback.This means that we are able to explain roughly
75% of the data with the 50-period ahead predictions,a real achievement for any model.
In addition,we look at the heuristics which were chosen by our GA agents within the
50-periods.Figure 3 reports MC results for the chosen price weight  and trend extrapolation
,with median and 95% and 90% CI,for the negative and positive feedback.The dynamics
of heuristics conrm results by HHST09 and Anufriev et al.(2012).In our simulations,under
the positive feedback both the price and the trend become much more important than under
the negative feedback,where the agents prefer adaptive expectations.
3.4 One-period ahead predictions for HHST09
A good measure of the model's tness is the precision of its one-period ahead predictions
(Anufriev et al.,2012).The question is what the model predicts (and how wrong it is) will
happen in period t + 1,conditional on the experimental data until period t.In the context
of the 2009 experiment,Anufriev et al.(2012) showed that HSM is similar to the Rational
Expectations (RE) model for the case of the negative feedback,but outperforms it for the
14
positive feedback.The specic performance measure was the mean squared error of the one-
period ahead price predictions for the last 47 periods,dened for each group as
(9) MSE
M
X
=
1
47
50
X
t=4

p
Gr X
t
p
M
t

2
;
where p
Gr X
t
denotes realized price at the period t in an experimental group X and p
M
t
is the
price p
t
predicted by the model M conditional on the behavior of the group X until period
t 1.For the Rational Expectations model,p
e;RE
i;t
= 60 and p
RE
t
= 60 +"
t
regardless of the
realized prices or predictions until t and the type of the feedback.
Similar exercise can be done for our GA model,but it requires more involved statistical
measures in comparison with the HSM.The only stochastic element in the HSM are the
shocks to the feedback equation (1).This makes HSM a deterministic model conditional
on the price-predictions feedback.The same holds for RE and many other homogeneous
expectations models,including simple naive expectations,trend extrapolation and adaptive
expectations.Therefore,the MSE (9) measure can be computed directly for these models.
This is not the case for our GA model.GA agents will update their heuristic sets con-
ditional on the past prices { and this learning is stochastic and highly nonlinear in nature,
based on a non-smooth period-to-period transition distribution.To address this issue,we will
use Sequential Importance Sampling (with Resampling) technique (SIRS).
16
We emphasize that our model is agent-based by design,which means that we can attempt
to trace the individual behavior in the experiment.This is in contrast with RE or HSM,
which serve as a stylized tool of aggregate market description.Therefore,unlike Anufriev
et al.(2012),we will focus on an alternative performance measure which is one period ahead
forecast of individual decisions.As a result,we obtain a statistical measure for how well our
agent-based model explains the data on the agent (or individual) level.We will also comment
on how to make a crude test of dierent models with our approach.
We introduce the following notation.Let a
t
denote the state of the model at time t,by
which we mean the H
t
set of the six sets of chromosomes that correspond to the six sets of
heuristics H
i;t
.Notice that in our model for the HHST09 experiment,a
t
changes 49 times from
period t = 2,when the chromosomes are randomly initialized,until the period t = 50,when the
chromosomes are updated for the last time conditional on the realized prices and predictions in
the period t = 49.We can observe the chromosomes only indirectly,through the realized prices
and predictions picked by the agents (observational variables).Both the state and observed
variables are evolving according to a distribution q().Denote also p
e
t
= fp
e
1;t
;:::;p
e
6;t
g as the
set of six individual predictions fromperiod t in an experimental group.Here and later t in the
superscript denotes history of the variable,so p
t1
= fp
1
;:::;p
t1
g and p
e;t1
= fp
e
1
;:::;p
e
t1
g.
Our problem is to dene the baseline distribution q(p
e
t
ja
t1
),that is,to evaluate the dis-
16
In order to avoid a technical discussion which is not important for our paper,in the following we as-
sume that the reader is familiar with SISR and sequential MC techniques.If that is not the case,a general
introduction can be found in Doucet et al.(2000).
15
tribution of the real predictions p
e
i;t
given the predictions from the period t  1 and what
they signal could have been the chromosomes H
t1
from the period t 1.This is a typical
state-space model problem.Essentially,q(p
e
t
ja
t1
) can be decomposed as
(10) q(p
e
t
ja
t1
) = q(p
e
t
ja
t
) q(a
t
ja
t1
):
Following Anufriev et al.(2012),we assume that conditional on the history until t 1 and
the chromosome set H
t
,the distribution of the six realized predictions is given by standard
normal distribution.
17
Given the information structure of the experiment we can assume that
in each period,the individual predictions are independent between the agents,and their joint
density is a simple product of the marginal densities of individual forecasts.To be specic,
we represent it as
(11) p
e
t
 q(p
e
t
ja
t
;p
t1
;p
e;t1
) = 
6
i=1
N(^p
e;GA
i;t
 ^p
e;GA
i;t
;1):
We simplify the notation by suppressing p
e
t
 q(p
e
t
ja
t
).By ^p
e;GA
t
we mean the individual price
forecasts predicted by the GA model.This is based not on the price actually picked by each
agent,but rather on their expected pick (Anufriev et al.,2012).Dene
(12) ^p
e;GA
i;t
=
H
X
h=1
(
i;h;t
p
e;GA
i;h;t
)
(see formula (8)) and hence dene
(13) p
GA
t
= F(^p
e;GA
1;t
;:::;^p
e;GA
6;t
)
to be the price predicted by the GA model for the feedback structure (1).For a general case,
(11) density of the experimental predictions p
e
t
is just a product of normal standard densities
centered around the forecasts predicted by a model.
Unfortunately,q(a
t
ja
t1
) is not that simple to work with.As explained earlier,it is not
feasible to represent this problemanalytically or to linearize it.Nevertheless,it is fairly simple
to simulate a
t
conditional on a
t1
.Therefore,we focus on SISR technique known as Auxiliary
Particle Filter (APF) (Johansen and Doucet,2008).
18
Denote the importance distribution as g() and assume that g(a
t
ja
t1
) = q(a
t
ja
t1
) (which
is a standard assumption for APF).It follows that g(p
e
t
ja
t1
) can be decomposed in the same
manner as the baseline distribution in equation (10).For g(p
e
t
ja
t
) we use (a product of six)
Student-t with one degree of freedom.This density is again analytically straightforward and
compares p
e
t
with ^p
e;GA
t
price forecasts predicted by the GA model as in equation (12).
17
For APF,the choice of variance of the distributions is not important.We use standard normal for the
sake of computational eciency.
18
It is extremely dicult,also in conceptual terms,to dene a reverse distribution of the model at period
t conditional on period t +1,given the complexity of GA operators.As a result,we leave open the question
whether econometrically more ecient ltering-smoothing techniques can be used for the case of our model.
16
Negative feedback Positve feedback
MSE Prices Predictions Prices Predictions
Trend extr.21:101 35:648 0:926 4:196
Adaptive 2:3 14:912 2:999 6:482
Contrarian 2:249 14:856 3:864 7:436
Naive 3:09 15:782 1:822 5:184
RE 2:571 15:21 46:835 54:811
HSM 2:999 17:106 0:889 4:156
GA:FORT+C 3:623 16:913 1:496 6:943
(0:395) (1:496) (0:01) (0:219)
GA:FORT 3:134 17:951 0:881 6:252
(2:077) (8:055) (0:08) (0:183)
Table 2:Mean squared error (MSE) of the Trend Extrapolation,Adaptive,Contrarian,Naive
and Rational Expectations,Heuristic Switching Model and Genetic Algorithms models
FORT+C (with contrarian rules) and FORT (without contrarian rules) one period ahead
predictions of the experimental prices and predictions,averaged over six negative feedback
and six positive feedback groups.In parenthesis the standard deviation of the respective
measures of the GA models are provided.
The specic APF algorithm is discussed by Johansen and Doucet (2008).We use 1024
particles a
<b>
t
for b 2 f1;:::;1024g (1024 sets of six heuristic sets for six agents),with full
resampling.The core problem of our investigation lies with the g(p
e
t
ja
t1
) distribution,which
cannot be tracked analytically.We approximate it with a MC integral in the following fashion.
At the beginning of each iteration t > 1 of AFP,for each particle a
<b>
t1
(that is,for each set of
six agents and their chromosomes),we simulate 256 counter-factual prediction realizations of
the next period predictions p
e;<b;s>
t
for each particle b,where s 2 f1;:::;256g.To be specic,
for the particle b,for each simulation s given H
t1
we draw one prediction p
e;<b;s>
i;t1
for each
agent.This also generates the counter-factual price p
<b;s>
t1
,conditional on which the agents
use GA evolutionary operators to update H
t1
into the counter-factual H
<b;s>
t
.We use these
to compute price ^p
<b;s>
t
and ^p
e;<b;s>
t
individual price forecasts predicted by the model as in
equation (13).We therefore dene
(14) g(p
e
t
ja
<b>
t1
) =
1
256
256
X
s=1

6
i=1
T
1

^p
e;<s;k>
i;t
p
e
i;t

;
where T
1
denotes Student-t distribution with one degree of freedom.
We use the baseline (11) and the importance (14) distributions for the standard APF par-
ticle weighting and updating.
19
We run a separate APF for each of the twelve investigated
experimental groups.Like in the 50-period ahead simulations,the chromosomes (or the parti-
cles) are initialized at random from the`uniform'distribution dened above.Notice,however,
19
Both the baseline and importance densities are a product of six independent densities,which can take
very low values in the rst periods for some experimental groups.To ensure numerical stability,we multiply
both joint densities by 10
60
(or each of the six marginal distributions by 10
10
) and truncate them at 10
100
.
17
that in this case we do not have the problem of the initial predictions or prices,since the
APF works on the period-to-period basis,independently for each experimental group.Inter-
estingly,for deterministic models like RE or HSM or homogeneous heuristic models,the APF
eectively reduces to the procedure reported by Anufriev et al.(2012),since all the particles
would be the same and had the same weights.
Negative feedback { group 1
(a) Price
(b) Price forecasts of subject 1
Positive feedback { group 1
(c) Price
(d) Price forecasts of subject 1
Figure 4:Sample results for Auxiliary Particle Filter for HHST09 experiment:one-period ahead
predictions of the GA FORT+C model for prices and price forecasts of subject 1 from
sample groups from each treatment.Black line denotes the experimental variable and
red boxes display the APF one-period ahead predictions.
For each experimental group,we focus on fourteen variables in total,which we obtain
by using the APF weighting of the particles.For each of the last 47 periods in each group,
we look at the (mean) one-period ahead prediction of the price,as well as at the (mean)
one-period ahead predictions of individual price forecasts.Next,for the prices and the six
individual predictions from that period,we compute MSE against the original data.Notice
that we compute the expected APF MSE's,instead of MSE's for the expected prices or
predictions.We compute these variables for each group,and average them separately over
the two treatments to obtain the average MSE of the model's prediction of the prices and
individual forecasts.
In the same manner,we can also compute the mean variance of the MSE of predicted
prices and price forecasts for the two treatments.A crude measure of the 95% CI (99% CI) of
these four MSE's is simply the average MSE plus and minus twice (thrice) the square root of
its respective variance.It can be used as a basis of a simple test:if these CI coincide with a CI
of a dierent stochastic model,or if they include the (deterministic) MSE of a deterministic
18
model,the two models cannot be distinguished;otherwise the one with lower MSE is better.
Sample results of the one-period ahead forecasts for GA FOTR+C specication are pre-
sented on Figure 4.For both treatments,the model clearly follows both the prices and
individual predictions.We report the average MSE of the one-period ahead predictions of
the prices and the individual price forecasts in Table 2.We also compare our model with
benchmark rules:HSM,RE and a small number of homogeneous linear heuristics.
20
Most
models (with the exception of the trend extrapolation heuristic) are indistinguishable for the
case of the negative feedback.This is not surprising,since under this type of feedback,almost
any reasonable learning mechanism will quickly converge to the fundamental price,just like
the subjects in the experiment.
On the other hand,the positive treatment,with its oscillations,oers a real test for the
models.This proves a disaster for RE,but not for the GA model,which outperforms RE
by a factor of 10 in terms of individual forecasts.Interestingly,the specication GA FOTR
without contrarian rules seems to have a slightly better t to both types of feedback,dierence
signicant especially for the positive one.Moreover,both specications (and more so for GA
FOTR) are at least as good as any other model for each treatment.
Together with the 50-period ahead C exercise,this shows that our model captures both the
aggregate and individual behavior in the LtF experiment reported by HHST09,both in terms
of short and long-run dynamics.We emphasize again that the APF measure is an important
evidence,since it evaluates the agent-based structure of our model against the behavior of the
individuals in the experiment.Moreover,our methodology can be easily adapted for other
stochastic models,including GA models with dierent forecasting rules.
4 Evidence from other experiments
Results of our Genetic Algorithms model for the HHST09 are promising.Nevertheless,the
experiment is based on a simple linear feedback.We argue that our model can be used
to explain more complicated experimental settings.To be specic,we look at three other
experiments that oer a hierarchy of challenge for the GA model:
1.BHST12:linear feedback with large and unanticipated shocks to the fundamental price;
2.HSTV07;V01:nonlinear (cobweb) negative feedback economy investigated by Hommes
and Lux (2011);
3.HSTV05:non-linear positive feedback economy,with two-period ahead predictions;
4.1 Shocks to the fundamental price
BHST12 report LtF experiment with almost the same structure as HHST09:positive and neg-
ative feedback of linear structure given by (2).They use the same dumping factor jBj =
20
21
20
For the denition of the benchmark rules,please refer to Table 7,Appendix D.
19
for the two treatments (positive and negative feedback),but there are two large and unantic-
ipated shocks to the fundamental price A.Regardless of the feedback,the fundamental price
changes from p
f
= 56 to p
f
= 41 starting from period t = 21 and then to p
f
= 62 starting
from period t = 44 until the last period t = 65.
Negative feedback
Positive feedback
(a) Experiment group 1
(b) Experiment group 8
(c) Sample GA FORT+C
(d) Sample GA FORT+C
Figure 5:BHST12:typical results for the experimental groups and sample 50-period ahead simu-
lations of the GAFORT+C model.Black line represents the price and green dashed lines
are the individual predictions.
The results of this experiment are similar to the one by HHST09 and sample time paths
are shown on Figure 5.Under the negative feedback (Figure 5a),shock to the fundamental
distracts the subjects coordination and is followed by a small number of volatile forecasts,
which are pushed to the new fundamental only when the price itself has converged.Under the
positive feedback (Figure 5b),shocks do not brake the coordination,and the predictions and
prices move smoothly towards the new fundamental,eventually over- or undershooting it.
We run the same 65-period ahead Monte Carlo (MC) study as for the HHST09 experi-
ment.Each simulation is initialized with a`uniform'distribution of heuristics (see the previous
section).As for the initial forecasts,we follow Diks and Makarewicz (2013) by using their pro-
cedure to estimate the distribution of the initial predictions for BHST12 and sample directly
fromit.
21
We again look at the prices and the standard deviation of the individual predictions.
The two model specications GA FORT+C and GA FORT yield comparable results,so we
report only the ones for the unrestricted GA FORT+C.
Lower part of Figure 5 presents sample,representative simulations for GA FORT+C.
Notice that the two experimental groups and the two GA simulations reported on that gure
21
See Appendix B for the estimated distribution.
20
Negative feedback
Positive feedback
(a) Realized price
(b) Realized price
(c) Distance from the fundamental
(d) Distance from the fundamental
(e) Predictions standard deviation
(f) Predictions standard deviation
Figure 6:BHST12:Monte Carlo for the GAFORT+C 65-period ahead simulations.Realized price,
distance of the realized price from the fundamental and coordination (standard deviation
of the individual predictions) over time.Green dashed line is the experimental median,
black pluses are real observations;blue dotted lines are the 95% condence interval and
red line is the median of GA FORT+C.Left column displays the negative feedback,right
the positive feedback.1
0
000 simulated markets for each feedback.
have dierent initial predictions.Figure 5c displays a sample time path for the negative
feedback.As in the case of the real group for this feedback,the two shocks to the fundamental
cause a break in the coordination and volatile behavior.The individual predictions are pushed
to the fundamental price once the price itself has converged.The opposite happens in the
case of the positive feedback (Figure 5d).The agents quickly coordinate,and the breaks
in the fundamental are unable to spoil it.Instead,GA agents move smoothly and over- or
under-shoot the new fundamental.
Figure 6 reports the Monte Carlo (MC) experiment for GA FORT+C with 1
0
000 MC sam-
ple,conducted in the same way as for the HHST09 experiment.Under the negative feedback
(Figure 6a),the median price of the model with its 95% CI requires around 5 periods to con-
verge to the fundamental at the beginning of the experiment and twice after the breaks to the
21
Negative feedback
Positive feedback
(a)  price weight
(b)  price weight
(c)  trend extrapolation
(d)  trend extrapolation
Figure 7:BHST12:Monte Carlo for the GA FORT+C 65-period ahead simulations.Chosen co-
ecients of the price weight and the trend extrapolation.Blue dotted lines are 95%
condence interval,purple dashed are 90% CI and red line is the median for the GA
model.Left column displays the negative feedback,right the positive feedback.1
0
000
simulated markets for each feedback.
Negative feedback Positve feedback
MSE Prices Predictions Prices Predictions
Trend extr.114:061 121:329 1:183 2:165
Adaptive 3:689 10:332 3:776 4:618
Contrarian 5:92 12:534 4:737 5:559
Naive 9:979 16:81 2:411 3:286
RE 13:871 20:923 55:133 60:859
HSM 38:309 45:679 0:9996 2:024
GA:FORT+C 85:144 110:28 1:893 4:487
(0:172) (0:44) (0:102) (0:124)
GA:FORT 10:228 26:317 1:177 3:532
(0:071) (0:384) (0:113) (0:147)
Table 3:BHST12 experiment:Mean squared error (MSE) of the Trend Extrapolation,Adaptive,
Contrarian,Naive and Rational Expectations,Heuristic Switching Model and Genetic
Algorithms model one period ahead predictions of the experimental prices and predictions,
averaged over eight negative feedback and eight positive feedback groups.In parenthesis
the standard deviation of the respective measures of the GA model are provided.
fundamental.The shape of this convergence is similar to the one visible in the behavior of the
experimental groups under this treatment.Moreover,if the new fundamental is lower/higher
than the old one,the GA agents will under-/over-shoot it respectively,much like the subjects
22
in the experiment.This is seen on Figure 6c,which gives the distance of the price from the
fundamental,for experimental groups and the GA FORT+C.Under the positive feedback,the
prices in the GA model move smoother and there are no sharp breaks in market predictions
as the fundamental changes (Figure 6b).The realized prices move slowly towards the new
fundamental (Figure 6d),to eventually pass it (under- or over-shoots it).
Negative feedback { group 1
(a) Price
(b) Price forecasts of subject 1
Positive feedback { group 8
(c) Price
(d) Price forecasts of subject 1
Figure 8:Sample results for Auxiliary Particle Filter for BHST12 experiment:one-period ahead
predictions of the GA FORT+C model for prices and price forecasts of subject 1 from
sample groups from each treatment.Black line denotes the experimental variable and
red boxes display the APF one-period ahead predictions.
The patterns of the coordination between the experimental subjects and the GA agents
are seen at Figures 6e and 6f.Under the negative feedback,a break in the fundamental causes
both the model and the experimental groups to have more varied predictions for up to ten
periods.Under the positive feedback treatment,the predictions of both the real subjects and
the GA agents retain small standard deviation within each period,after no more than ve
periods and towards the end of the experiment,despite of the breaks in the fundamental.
We also look on the coecients used by our GA agents,see Figure 7.These are very
similar to those from the 2009 experiment:trend extrapolation heuristics with a high price
weight are much more important for the positive feedback market,where the whole 95% CI
for the trend extrapolation  become signicantly positive towards the end of the experiment.
We also computed the MSE of the price and individual forecasts predicted by our model
one-period ahead.For this task we apply APF specied as in the previous section.Sample
time paths are shown for GA FORT+C and FORT on Figures 8 and 9 respectively.Both
23
Negative feedback { group 1
(a) Price
(b) Price forecasts of subject 1
Positive feedback { group 8
(c) Price
(d) Price forecasts of subject 1
Figure 9:Sample results for Auxiliary Particle Filter for BHST12 experiment:one-period ahead
predictions of the GA FORT model for prices and price forecasts of subject 1 fromsample
groups from each treatment.Black line denotes the experimental variable and red boxes
display the APF one-period ahead predictions.
model specications replicate the prices and individual predictions for the positive feedback
groups,including the turning points of the oscillations.Under the negative treatment,the
models one-period ahead price forecasts are in general consistent with the data.However,
GA FORT+C has problems in replicating data in one or two rst periods immediately after
the breaks in the fundamental.65-period ahead simulations show that for this treatment,the
prices and predictions quickly converge to the fundamental and so it does not matter which
heuristics the GA agents choose.This leaves space for contrarian rules,with conservative high
weight on the past predictions.With such rules,once the agents observe a signicant decrease
of the price (as happens after the rst brake of the fundamental),they would forecast the next
price to be close to or higher than the old fundamental,and so the model (with the negative
expectations-price feedback) predicts even further drop of the price (c.f.Figures 8a and 8b).
On the other hand,such an outcome is not possible once the contrarian rules are constrained
out,as for the case of GA FORT+C (Figure 9).
We argue that this explains the results for the average MSE of the predicted prices and
individual forecasts,for the two treatments,which are reported in Table 3.GA FORT outper-
forms GA FORT+C signicantly for the positive and dramatically for the negative feedback,
and beats HSM for the negative feedback.In either case,it does signicantly better than RE
and is the only reported model to have a decent t to both feedback treatments.Together
with the 65-period ahead simulations,this shows that the GA model is a good explanation of
24
Mean(p) Var(p) Mean(p
e
) Var(p
e
)
Stable
Experiments 5:64
y
0:36
y
5:56
y
0:087

GA:AR1 5:565 0:326 5:576 0:1
GA:FORT+C 5:628 0:372 5:571 0:082
95% CI [5:613;5:643] [0:359;0:389] [5:553;5:59] [0:065;0:101]
GA:FORT 5:649 0:353 5:548 0:0565
95% CI [5:631;5:667] [0:341;0:371] [5:527;5:57] [0:043;0:077]
Unstable
Experiments 5:85
y
0:63
y
5:67
y
0:101
y
GA:AR1 5:817 0:647 5:645 0:16
GA:FORT+C 5:792 0:598 5:705 0:103
95% CI [5:744;5:841] [0:525;0:746] [5:667;5:739] [0:067;0:171]
GA:FORT 5:825 0:557 5:694 0:079
95% CI [5:786;5:863] [0:487;0:658] [5:67;5:719] [0:052;0:122]
Strongly unstable
Experiments 5:93
y
2:62

5:73 0:429

GA:AR1 6:2 2:161 5:434 0:769
GA:FORC+T 5:809 2:172 5:832 0:345
95% CI [5:693;5:908] [1:626;2:875] [5:735;5:918] [0:182;0:598]
GA:FORT 5:962 1:487 5:807 0:206
95% CI [5:876;6:045] [1:188;1:834] [5:75;5:858] [0:113;0:347]
Strongly unstable,large group
Experiments 5:937
y
1:783

5:781
y
0:204
y
GA:AR1 6:183 1:571 5:515 0:5
GA:FORT+C 5:812 1:699 5:852 0:194
95% CI [5:731;5:892] [1:368;2:157] [5:779;5:918] [0:122;0:338]
GA:FORT 5:972 1:316 5:804 0:173
95% CI [5:918;6:026] [1:118;1:553] [5:768;5:843] [0:111;0:253]
Table 4:HSTV07 experiment under four treatments,stable,unstable and strongly unstable with
6 or 12 subjects.Average price and prediction,and their variances.Mean experimental
statistics;GA simulations with AR1 prediction rule for mutation rate 
m
= 0:01 (mean
statistics);GA simulations with rst order rule with or without contrarian rules (FORT+C
or FORT) (median statistics with 95% condence intervals).Asterisk and dagger denote
experimental statistic which falls into 95% CI of GA FORT+C and FORT respectively.
Source for the experimental and AR1 entries:Hommes and Lux (2011).
the dynamics from BHST12,especially the GA FORT specication.
4.2 Cobweb economy
HSTV07;V01 report an LtF experiment in a Cobweb economy setting.As discussed,Hommes
and Lux (2011) investigate this data sets with a GA model based on AR1 forecasting rule.It
is thus important to check if our model,with the FOR (6) instead,can as well account for the
dicult,non-linear price-expectations feedback of the Cobweb economy.
25
Treatments Stable Unstable Strongly unstable
MSE Prices Predictions Prices Predictions Prices Predictions
Trend extr.1:176 1:997 2:122 3:719 5:856 14:39
Adaptive 0:108 0:328 0:434 0:549 2:784 2:863
Contrarian 0:102 0:318 0:414 0:497 2:929 2:729
Naive 0:196 0:448 0:577 0:788 3:095 3:731
RE 0:048 0:248 0:364 0:385 2:257 1:844
HSM 0:212 0:474 0:52 0:732 3:065 3:691
GA:FORT+C 0:247 0:585 0:828 0:801 4:558 2:909
(0:086) (0:35) (0:238) (0:392) (0:76) (0:53)
GA:FORT 0:109 0:42 0:516 0:659 3:872 2:755
(0:069) (0:303) (0:198) (0:31) (0:607) (0:405)
Table 5:HSTV07 experiment:Mean squared error (MSE) of the Trend Extrapolation,Adaptive,
Contrarian,Naive and Rational Expectations,Heuristic Switching Model and Genetic Al-
gorithms model one period ahead predictions of the experimental prices and predictions,
averaged over six groups for each treatment (stable,unstable,strongly unstable).In paren-
thesis the standard deviation of the respective measures of the GA model are provided.
Following Hommes and Lux (2011),we simulate our model in the setting of the cobweb
experiment (see HSTV07 for formal denition of the feedback structure,for which we also use
the experimental errors),with 6 independent agents and three parameter treatments:stable,
unstable (on the verge of stability) and (strongly) unstable.We also look at the strongly
unstable specication with 12 agents,experiment reported by V01.
As a rst test for our model,we conduct a MC exercise in the vein of Hommes and Lux
(2011).For each treatment,we compute (as was the number of groups in each treatment) six
50-period ahead simulations with dierent randomnumbers.
22
Next we compute the mean and
standard deviation of the realized prices p and the predictions p
e
.The variances correspond
to the volatility of the market,which in the experiment was higher for the unstable cases
(which cannot be explained by RE).To obtain a proper Monte Carlo distribution,we repeat
this procedure 1
0
000 times.This allows us to generate 95% condence intervals.
23
We report
the results in Table 4 for the two GA model specications.
Our 50-period ahead simulations explain well the experimental data,yield similar results
to the ones reported in Hommes and Lux (2011) and perform signicantly better than RE.
The CI of our model replicate 12 and 11 out of 16 experimental statistics for GA FORT+C
and GA FORT respectively.Furthermore,the unexplained statistics are usually missed by a
small error that can be attributed to rounding issues of the simulations and the experiment.
The next exercise is the one-period ahead forecasting of the model.Here we look only
at the 18 groups from HSTV07.We use APF exactly as specied in the previous section
and focus on the same set of variables:predicted prices and individual forecasts,as well as
22
As in the two previous cases,the initial heuristics are`uniform'.Following Diks and Makarewicz (2013),
we have also estimated the distribution of the initial predictions,see Appendix B.
23
Hommes and Lux (2011) look only on the expected outcomes of their simulations.
26
Stable treatment { group 3 prices
(a) GA FORT+C
(b) GA FORT
Unstable treatment { group 3 prices
(c) GA FORT+C
(d) GA FORT
Strongly unstable treatment { group 3 prices
(e) GA FORT+C
(f) GA FORT
Figure 10:Sample results for Auxiliary Particle Filter for HSTV07 experiment:one-period ahead
predictions for prices from the third groups of the treatments for GA FOTR+C and
GA FOTR.Black line denotes the experimental variable and red boxes display the APF
one-period ahead predictions.
MSE of these measures.Sample price time paths for both model specications for each of the
three treatments are shown on Figure 10.For the stable and unstable treatment,GA model
closely follows the experimental prices and replicates reversals of their volatile,short period
oscillations.The model has worse t for the strongly unstable treatment.
We report the average MSE of our model for the three treatments in Table 5.It seems that
GA FORT does better than GA FORT+C,but the dierences are on the edge of signicance.
The less stable the treatment,the worse t has any model.Moreover,all the models (with
the exception of trend extrapolation) have similar performance regardless of the treatment.
24
This is similar to the negative feedback treatments from the two previous experiments,but
24
Notice that the scale of the prices in this experiment is [0;10] in the contrast with the two previous settings,
where the prices belonged to [0;100] intervals.The highest possible MSE in the linear experiments is 100 times
higher than in the cobweb experiment.
27
we speculate that for a dierent the reason.Especially for the non stable treatments,the
subject's behavior can be close to chaotic and so detecting it one period ahead is problematic.
However,50-period ahead simulations show that our model replicates this behavior in terms
of its long run distribution.
4.3 Two-period ahead asset pricing
HSTV05 report an experiment in which the subjects participated in a non-linear positive
feedback economy (asset-pricing model with robotic fundamental traders),in which the current
price depends on the expectations about the price in the next period.This means that the
subjects had to predict prices two periods ahead.
There is no one denite way in which the basic FOR rule (6) together with the GA model
can be translated into the two-period ahead setting.Some experimentation led us to the
following (and indeed the simplest) specication.The agents at time t predict p
t+1
the next
price based on the rst order rule and the last available period.Dene the prediction of price
from period t +1,made at period t by the agent i and her rule h as
(15) p
e
h;i;t
= 
h;i;t
p
t1
+(1 
h;i;t
)p
e
i;t1
+
h;i;t
(p
t1
p
t2
):
Then,at the beginning of period t,each agent focuses on p
e
h;i;t
(prediction of p
t+1
).On the
other hand,once p
t
is realized,the agents can evaluate their rules and to do so,they look at
their hypothetical performance two periods ago.To be specic,they focus on (p
t
p
e
h;i;t1
)
2
.
(a) Convergence
(b) Unclear
(c) Oscillations
Figure 11:HSTV05:sample 50-period ahead simulations for GA FORT+C with dierent initial
predictions and learning.The green lines are individual predictions,the black line is
the realized price and the purple dashed line is the fundamental price.
Contrary to the HHST09 experiment,HSTV05 obtain results which cannot be easily clas-
sied into a clear-cut stylized facts.In the seven treatment groups with the fundamental price
p
f
= 60 they observe groups which have converged to this fundamental,as well as groups
with oscillations of dierent amplitude and period.For this reason we abstain from a MC
experiment for the 50-period ahead performance of the model.Instead,we report sample
simulations of the experimental economy (with the fundamental price p
f
= 60) with our GA
agents,in which the initial predictions for the two rst periods are draws fromthe distribution
calibrated by Diks and Makarewicz (2013).
28
(a) 500 periods
(b) 2000 periods
Figure 12:HSTV05:sample long run behavior of the GA FORTR+C model with fundamental
price p
f
= 60.2
0
000-period ahead simulation (b) and its rst 500 periods (a).The
green lines are individual predictions,the black line is the realized price and the purple
dashed line is the fundamental price.
MSE Prices Predictions
Trend extr.17:4527 55:0898
Adaptive 44:125 25:3157
Contrarian 59:3905 30:8646
Naive 31:6864 20:8416
RE 96:0328 145:998
GA:FORT+C 48:51 48:56
(0:266) (0:496)
GA:FORT 39:236 43:8
(0:211) (0:529)
Table 6:HSTV05 experiment:Mean squared error (MSE) of the Trend Extrapolation,Adaptive,
Contrarian,Naive and Rational Expectations,and Genetic Algorithms FORT+C and
FORT models one period ahead predictions of the experimental prices and predictions,
averaged over eight negative feedback and eight positive feedback groups.In parenthesis
the standard deviation of the respective measures of the GA models are provided.
Many 50-period ahead sample time paths look much alike the experimental ones.Figure 11
displays three typical time paths of the simulated markets (for dierent realizations of the
random number generator) for GA FOTR+C.We use the experimental errors to the price-
expectations law of motion,hence the dierences are purely due to dierent realizations of
the learning and the initial individual predictions.In terms of the simulated prices,both
convergence to the fundamental price (Figure 11a) and oscillations (Figure 11c) are common.
However,sometimes the agents seem to diverge from the fundamental after being close to it
for a few periods (Figure 11b).Model specication without the contrarian rules FOTR has
similar time paths.
To further stress the volatile behavior of this market structure,we report one long run
simulation for GA FOTR+C.Figure 12 displays its rst 500 (Figure 12a) and all 2
0
000 (Fig-
ure 12b) periods.Volatile,unruly oscillations are persistent and can also reappear even if the
29
Group 8:GA FOTR+C
(a) Price
(b) Price forecasts of subject 1
Group 8:GA FOTR
(c) Price
(d) Price forecasts of subject 1
Figure 13:Sample results for Auxiliary Particle Filter for HSTV05 experiment:one-period ahead
predictions of the GA FORT+C and GA FORT models for prices and price forecasts
of subject 1 from group 8.Black line denotes the experimental variable and red boxes
display the APF one-period ahead predictions.
market settles on the fundamental price for some time,as seen on Figure 12a around period
170.This means that in the system the fundamental price is a stable steady state,but is not
the unique attractor.This result is intuitive:individual agents cannot impose fundamental
price,but will rather try to follow the current trend,and this through the non-linear feedback
easily amplies the oscillations.That is the reason why the experimental groups { under the
same conditions { could converge to the fundamental,diverge from it or oscillate in a varied
fashion.
Table 6 reports the results of one-period ahead forecasting performance of our model.RE
are the worst model,both on aggregate and individual level.Interestingly,the best model
are naive expectations,whereas trend extrapolation has a good t only to the aggregate level.
We think that this result is because the oscillations between the groups were dierent,and
so one particular trend extrapolation specication can explain one or two groups,but not all
of them.Naive expectations seem to work ne mostly because the period to period changes
in predictions are often relatively small.This model would not be able to explain lasting
trend in the data.GA models work moderately well,again with GA FORT restricted model
outperforming GA FORT+C.The constrained specications is either very close to or slightly
better than most of the homogenous models.This,together with the dynamics present in
the long-run simulations show that our model is able to capture a good measure of these
experimental dynamics,although there is probably a space for improvement which we leave
30
for future research.
5 Conclusions
In this paper we discuss a model in which the agents independently use Genetic Algorithms
to optimize a simple prediction heuristic.Our investigation derives from the intuitions of
the Heuristic Switching Model (Anufriev and Hommes,2012;Anufriev et al.,2012) and the
Genetic Algorithmmodel introduced by Hommes and Lux (2011).Following the experimental
results by (Heemeijer et al.,2009),we model our agents as learning how to use a simple rst
order rule (a mixture of adaptive and trend extrapolation expectations) in dierent economic
environments.We argue that our model is able to replicate many experimental ndings
from dierent Learning-to-Forecast experiments.We show this by means of 50-period ahead
simulations.Furthermore we use Auxiliary Particle Filter technique to evaluate the model's
one-period ahead predicting power of the individual behavior,a novelty in the behavioral
literature.
In Learning-to-Forecast experiments,subjects are asked to predict prices,while the realized
price depends on their predictions.This mimics many well studied economic environments,
such as an asset pricing market or a cobweb economy.As a result,Learning-to-Forecast
experiments are a perfect controlled setting to study how the human subjects try to adapt to
the price-predictions feedback.Our model retains the basic intuition of the Heuristic Switching
Model:among dierent prediction heuristics,the agents focus on those that have relatively
good hypothetical past performance.On the other hand,following Hommes and Lux (2011)
we show how the agents' exibility can be enhanced by explicit learning with the individual use
of Genetic Algorithms.Therefore the heterogeneity of heuristics between the agents emerges
endogenously and resembles the one among the experimental subjects.
This contrast the dominating framework of the perfectly rational expectations.Tradition-
ally,the economists assumed that people use sophisticated concepts such as a fundamental
price or a long run equilibrium.They disregarded the fact that the market practice,the
agents face constraints on their rationality and may be forced to use second-best prediction
rules.As a result,rational expectation fail to describe experimental dynamics,unless these
are extremely simple.To counter this approach,we propose on a model where the subjects use
simple forecasting rules,but adapt themto the current environment with a smart optimization
procedure.This allows for a realistic description of the human behavior,which also explains
the experimental data to the degree that was unattainable for the traditional literature.
We use the simple linear setting of the experiment reported by Heemeijer et al.(2009) to
set up our Genetic Algorithms model.In a Monte Carlo experiment based on 50-period ahead
simulations,the model replicates the dynamics of the experiment,both on the aggregate
and individual level and for both treatments.We also replicate the major insights of the
Heuristic Switching Model model { that the trend extrapolation is relatively more important
for the positive feedback,in which it reinforces the oscillating behavior.Our results therefore
31
validate the stylized investigation by Anufriev et al.(2012).We also use Auxiliary Particle
Filter technique to conrm that the one-period ahead predictions of our model follow closely
the experimental individual predictions and prices.This is a novelty in the literature,since
we are able to conduct a direct test on how an agent based model ts to an experimental data
set on the individual level.
We further investigate three more complicated experimental settings with our Genetic Al-
gorithms model.The experiment reported by Bao et al.(2012) adds large and unanticipated
shocks to the basic linear structure of the original Heemeijer et al.(2009) experiment.Second
experiment,reported by van de Velden (2001) and Hommes et al.(2007) and investigated by
Hommes and Lux (2011),focuses on a cobweb economy.Finally,the asset pricing experi-
ment reported by Hommes et al.(2005) introduces two-periods ahead feedback between the
predictions and the realized prices.For all the three experiments,we use the Auxiliary Par-
ticle technique to demonstrate that our model can successfully predict the subjects behavior
one period ahead.Moreover,50-period ahead simulations of the model show that it is able
to replicate the long-run distribution of the individual predictions and prices for the three
experiments.
The strength of our model is its generality and agent-based structure.We emphasize
that it replicates the individual behavior from Learning-to-Forecast experiments,which were
based on very dierent experimental economies.Moreover,the model allows for realistic
heterogeneity and learning.We therefore argue that it can be used to investigate settings
with a more complicated interactions between individual agents.This can include economies
with heterogeneous preferences,unequal market power,information networks or decentralized
price setting.In any of these cases,heterogeneous price expectations may have important
consequences for market eciency or dynamics.Our model can be directly used to explore
these phenomena.
References
Anufriev,M.and Hommes,C.(2012).Evolutionary selection of individual expectations and
aggregate outcomes in asset pricing experiments.American Economic Journal:Microeco-
nomics,forthcoming.
Anufriev,M.,Hommes,C.,and Philipse,R.(2012).Evolutionary selection of expectations in
positive and negative feedback markets.Journal of Evolutionary Economics,pages 1{26.
10.1007/s00191-011-0242-4.
Arifovic,J.(1995).Genetic algorithms and in ationary economies.Journal of Monetary
Economics,36(1):219 { 243.
Arifovic,J.(1996).The behavior of the exchange rate in the genetic algorithm and experi-
mental economies.Journal of Political Economy,104(3):pp.510{541.
32
Arifovic,J.,Bullard,J.,and Kostyshyna,O.(2012).Social learning and monetary policy
rules*.The Economic Journal.
Bao,T.,Hommes,C.,Sonnemans,J.,and Tuinstra,J.(2012).Individual expectations,limited
rationality and aggregate outcomes.Journal of Economic Dynamics and Control,36(8):1101
{ 1120.
Bentez-Silva,H.,Eren,S.,Heiland,F.,and Jimenez-Martn,S.(2008).How well do individ-
uals predict the selling prices of their homes?
Blundell,R.and Stoker,T.M.(2005).Heterogeneity and aggregation.Journal of Economic
Literature,43(2):pp.347{391.
Brock,W.A.and Hommes,C.H.(1997).A rational route to randomness.Econometrica,
65(5):pp.1059{1095.
Bullard,J.(1994).Learning equilibria.Journal of Economic Theory,64(2):468 { 485.
Case,K.E.and Shiller,R.J.(2003).Is there a bubble in the housing market?Brookings
Papers on Economic Activity,2003(2):pp.299{342.
Charness,G.,Karni,E.,and Levin,D.(2007).Individual and group decision making under
risk:An experimental study of bayesian updating and violations of rst-order stochastic
dominance.Journal of Risk and Uncertainty,35:129{148.
Dawid,H.and Kopel,M.(1998).On economic applications of the genetic algorithm:a model
of the cobweb type.Journal of Evolutionary Economics,8:297{315.10.1007/s001910050066.
Diks,C.and Makarewicz,T.(2013).Initial predictions in learning-to-forecast experiment.In
Managing Market Complexity,volume 662 of Lecture Notes in Economics and Mathematical
Systems,pages 223{235.Springer Berlin Heidelberg.10.1007/978-3-642-31301-1
18.
Doornik,J.(2007).Object-oriented matrix programming using Ox.Timberlake Consultants
Press,London,3rd edition.
Doucet,A.,Godsill,S.,and Andrieu,C.(2000).On sequential monte carlo sampling methods
for bayesian ltering.Statistics and Computing,10:197{208.
Evans,G.and Honkapohja,S.(2001).Learning and expectations in macroeconomics.Princeton
University Press.
Evans,G.and Ramey,G.(2006).Adaptive expectations,underparameterization and the lucas
critique.Journal of monetary economics,53(2):249{264.
Goodman Jr.,J.L.and Ittner,J.B.(1992).The accuracy of home owners'estimates of house
value.Journal of Housing Economics,2(4):339 { 357.
33
Grandmont,J.(1998).Expectations formation and stability of large socioeconomic systems.
Econometrica,pages 741{781.
Haupt,R.and Haupt,S.(2004).Practical Genetic Algorithms.John Wiley & Sons,Inc.,New
Jersey,2nd edition.
Heemeijer,P.,Hommes,C.,Sonnemans,J.,and Tuinstra,J.(2009).Price stability and
volatility in markets with positive and negative expectations feedback:An experimental
investigation.Journal of Economic Dynamics and Control,33(5):1052{1072.
Hommes,C.(2011).The heterogeneous expectations hypothesis:Some evidence from the lab.
Journal of Economic Dynamics and Control,35(1):1 { 24.
Hommes,C.and Lux,T.(2011).Individual expectations and aggregate behavior in learning-
to-forecast experiments.Macroeconomic Dynamics,1(1):1{29.
Hommes,C.,Sonnemans,J.,Tuinstra,J.,and van de Velden,H.(2007).Learning in cobweb
experiments.Macroeconomic Dynamics,11(Supplement S1):8{33.
Hommes,C.,Sonnemans,J.,Tuinstra,J.,and Velden,H.v.d.(2005).Coordination of
expectations in asset pricing experiments.The Review of Financial Studies,18(3):pp.955{
980.
Johansen,A.M.and Doucet,A.(2008).A note on auxiliary particle lters.Statistics &
Probability Letters,78(12):1498 { 1504.
Lux,T.and Schornstein,S.(2005).Genetic learning as an explanation of stylized facts
of foreign exchange markets.Journal of Mathematical Economics,41(1{2):169 { 196.
<ce:title>Special Issue on Evolutionary Finance</ce:title>.
Malmendier,U.and Nagel,S.(2009).Learning from in ation experiences.available online at
http://faculty-gsb.stanford.edu/nagel/documents/InflExp.pdf.
Muth,J.F.(1961).Rational expectations and the theory of price movements.Econometrica,
29(3):pp.315{335.
Nunes,R.(2010).In ation dynamics:The role of expectations.Journal of Money,Credit
and Banking,42(6):1161{1172.
Tuinstra,J.and Wagener,F.(2007).On learning equilibria.Economic Theory,30:493{513.
10.1007/s00199-005-0059-1.
Tuinstra,J.and Weddepohl,C.(1999).On the equivalence between the overlapping-
generations model and cyclical general-equilibrium models.Journal of Economics,
70(2):187{207.
van de Velden,H.(2001).An experimental approach to expectation formation in dynamic
economic systems.PhD thesis,Tinbergen Institute and Universiteit van Amsterdam.
34
Appendices
A Formal denition of Genetic Algorithms
In this appendix we present a formalized version of the Genetic Algorithms (GA) which we
have used in the simulations.Note that it closely follows the standard specication suggested
by Haupt and Haupt (2004) and used by Hommes and Lux (2011).Furthermore we give some
motivation for this specication.
A.1 Genetic Algorithms as optimization procedure
Consider a maximization problem where the target function F of N arguments 
n
is such
that a straightforward analytical solution is unavailable.Instead,we need to use a numerical
optimization procedure.
Traditional maximization algorithms,like the Broyden-Fletcher-Goldfarb-Shanno (BFGS)
algorithm,iterate a candidate argument for the optimum of the target function F by (1)
estimating the curvature around the candidate and (2) using this curvature to nd the optimal
direction and length of the change to the candidate solution.This so called`hill-climbing'
algorithm is very ecient in its use of the shape of the target function.On the other hand,it
will fail if the target function is`ill-behaved':non-continuous or almost at around the optima,
has kinks or breaks.Here the curvature cannot be reliably estimated.Another problem is
that the BFGS may perform poorly for a problem of large dimensionality.
The Genetic Algorithms are based on fundamentally dierent approach and therefore can
be used for a wider class of problems.The basic idea is that we should focus on a population of
arguments which compete only in terms of their respective function value.This competition
is modeled in an evolutionary fashion:mutation operators allow for a blind-search experi-
mentation,but the probability that a particular candidate will survive over time is relative
to its functional value.As a result,the target function may be as general as necessary,while
the arguments can be of any kind,including real numbers,integers,probabilities or binary
variables.The only constraint is that each argument must fall into a predened bounded
interval a
n
;b
n
.
A.2 Binary strings
Genetic algorithm (GA) uses H chromosomes g
h;t
2 H which are binary strings divided into
N genes g
n
h;t
,each encoding one candidate parameter 
n
h;t
for the argument 
n
.A chromosome
h 2 f1;:::;Hg at time t 2 f1;:::;Tg is specied as
(16) g
h;t
= fg
1
h;t
;:::;g
N
h;t
g;
i
such that each gene n 2 f1;:::;Ng has its length equal to an integer L
n
and is a string of
binary entries (bites)
(17) g
n
h;t
= fg
n;1
h;t
;:::;g
n;L
n
h;t
g;g
n;l
h;t
2 f0;1g for each j 2 f1;:::;L
n
g:
The interpretation of (16) and (17) is straightforward.An integer 
n
is simply encoded by
(17) with its binary notation.Consider now an argument 
n
which is a probability.Notice
that
P
L
n
1
l=0
2
j
= 2
L
n
1.It follows that a particular gene g
n
h;t
can be decoded as a normalized
sum
(18) 
n
h;t
=
L
n
X
l=1
g
n;l
h;t
2
l1
2
L
n
1
:
A gene of zeros only is therefore associated with 
n
= 0,a gene of ones only { with 
n
= 1,
while other possible binary strings cover the [0;1] interval with an
1
2
L
n
1
increment.Any
desired precision can be achieved with this representation.Since 2
10
 10
3
,the precision
close to one over trillion (10
12
) is obtained by a mere of 40 bites.
A real variable 
n
from an [a
n
;b
n
] interval can be encoded in a similar fashion,by a linear
transformation of a probability:
(19) 
n
h;t
= a
n
+(b
n
a
n
)
L
n
X
l=1
g
n;l
h;t
2
l1
2
L
n
1
where the precision of this representation is given by
b
n
a
n
2
L
n
1
.Notice that one can approximate
an unbounded real number by reasonably large (in absolute value) a
n
or b
n
,since the loss of
precision is easily undone by a longer string.
Binary representation has two advantages.First,as will be discussed later,it allows for
an ecient search through the parameter space.Second,any type of a well-dened argument
can be translated into a string of logical values.
25
A.3 Evolutionary operators
The core of GA are evolutionary operators.GA iterates the population of chromosomes
for T periods,where T is either large and predened,or depends on some convergence cri-
terion.First,at each period t 2 f1;:::;Tg each chromosome has its tness equal to a
nondecreasing transformation of the function value F.This transformation is dened as
V (F(
h;t
))  V (h
k;t
)!R
+
\f0g.For example,a non-negative function can be used directly
as the tness.If the problem is to minimize a function,a popular choice is the exponential
transformation of the function values,similar to the one used in the logit specication of the
Heuristic Switching Model (Brock and Hommes,1997).
25
Nevertheless there are GA extensions with real-valued genes.See Haupt and Haupt (2004) for an intro-
ductory discussion.
ii
Recall that in the case of our model,the function value V () is dened with the equation
(7).Hence,the tness is the normalized function value given by (8) (see the procreation
operator).
Chromosomes at each period can undergo the following evolutionary operators:procre-
ation,mutation,crossover and election.These operators rst generate an ospring population
of chromosomes from the parent population t and therefore transform both populations into
a new generation of chromosomes t +1 (notice the division of the process).In the following
analysis we will use all four of them.
A.3.1 Procreation
For the population at time t,GA picks   H subset of  chromosomes and picks  <  of
them into a set K.The probability that the chromosome h 2  will be picked into the K as
its zth element (where z 2 f1;:::;g) is usually dened by the power function:
(20) Prob(g
z
= g
h;t
) =
V (g
h;t
)
P
j2
V (g
j;t
)
:
This procedure is repeated with dierently chosen 's until the number of chromosomes in all
such sets K's is equal to H.For instance,the roulette is procreation with  = H and  = 1:
GA picks randomly one chromosome from the whole population,where each chromosome has
probability of being picked equal to its function value relative to the function value of all other
chromosomes.This is repeated exactly H times.
So called tournaments are often used for the sake of computational eciency.Here, <<
H.For instance,GA could divide the chromosomes into pairs and sample two ospring from
each pair.We will use the full roulette operator.
Procreation is modeled on the basic natural selection mechanism.We consider subsets of
the original population (or maybe the whole population at once).Out of each such a subset,
we pick a small number of chromosomes,giving advantage to these which perform better.We
repeat this procedure until the ospring generation is as large as the old one.Thus the new
generation is likely to be`better'than the old one.
A.3.2 Mutation
For each generation t 2 f1;:::;Tg,after the procreation has taken the place,each binary
entry in each new chromosome has a predened 
m
probability to be swapped:ones turned
into zeros and vice versa.In this way the chromosomes represent now dierent numbers
and may therefore attain better t.Moreover,the mutation operator is where the binary
representation becomes most useful.
If the bites,which are close to the end of the gene,mutate,the new argument will be
substantially dierent fromthe original one.On the other hand,small changes can be obtained
by mutating bites from the beginning of the gene.Both changes are equally likely!In this
iii
way,GA can easily evaluate arguments which are both far away from and close to what the
chromosomes are currently encoding.As a result,GA eciently converges to the maximum,
but also are likely not to xate on a local maximum.This requires no additional investigation
of the initial conditions,as is the case of BFGS.
A.3.3 Crossover
Let 0 6 C
L
;C
H
6
P
N
n=1
L
n
be two predened integers.The crossover operator divides the
population of chromosomes into pairs.If C
L
< C
H
,it exchanges the rst C
L
and the last
C
H
bites between chromosomes in each pair with a predened probability 
c
.Otherwise,the
crossover operator exchanges either the rst C
L
bites (if C
H
is not specied or less than C
L
) or
the last C
H
bites (if C
L
is not specied or higher than C
H
) in each pair of chromosomes with
this predened probability 
c
.This operator facilitates experimentation in a dierent way
than the mutation operator:here the chromosomes experiment with dierent compositions of
the individual arguments,which on their own are already successful.
A.3.4 Election
The experimentation done by the mutation and crossover operators does not need to lead to
ecient binary sequences.For instance,a chromosome which actually decodes the optimal
argument should not mutate at all.To counter this eect,it is customary to divide the creation
of a new generation into two stages.First,the chromosomes procreate and undergo mutation
and crossover in some predened order.Next,the resulting set of chromosomes is compared
in terms of tness with the parent population.Thus,ospring will be passed to the new
generation only if it strictly outperforms the parent chromosome.In this way each generation
will be at least as good as the previous one,what in many cases facilitates convergence.
A.4 Parametrization
Recall that we use the full roulette operator as the procreation operator.The full parametriza-
tion of the GA model is presented in Table 1.This parametrization is used for all our simu-
lations,unless stated otherwise.Notice that since we have only two genes,we suppress C
H
in
the crossover operator,which thus exchanges the price weight genes between the chromosomes
(since L
1
= 20 and C
L
= 20 and C
H
= 1).
B Initialization of the model
The model will have a good t to the data only if it is properly initialized.For instance,in the
Heemeijer et al.(2009) experimental environment under the positive feedback,one can imagine
that the price oscillations require the agents to start relatively far from the fundamental price
(c.f.Anufriev et al.(2012)).Diks and Makarewicz (2013) investigate this issue in a systematic
fashion for the case of the Heemeijer et al.(2009) experiment.They argue that,for the sake
iv
of tractability,the initial predictions can be regarded as sampled by each individual from a
common distribution.We use their methodology to calibrate the initial period of our model to
the experiments reported by Bao et al.(2012) and Hommes et al.(2007);van de Velden (2001).
For all the reported Monte Carlo (MC) experiments,we re-sample the initial predictions (from
the distribution calibrated to the respective experimental data) for each run of the market
simulations.
In the case of the asset-pricing environment reported by Hommes et al.(2005),we initialize
our estimations by the distribution from Diks and Makarewicz (2013).In the case of that
experiment,we are not interested in the proper Monte Carlo distribution of the result,hence
we decided to forfeit the problem of initialization of our simulations.
Finally,notice that at the period 2,the rule (6) requires p
1
as the past price,but also p
1
p
0
for the trend extrapolation.It is plausible that after the rst period (with only one realized
price!),the agents do not think that there is any actual trend in the data { yet.Moreover Diks
and Makarewicz (2013) notice that the initial predictions are close neither to the fundamental
price,nor to the focal point.Therefore,it seems that these two points were not used by the
agents as any sort of a natural reference point.Since we do not see any other possible reference
point (a natural estimator of p
0
given the information,which was provided to the subjects),
we argue that the agents disregarded the trend in the second period and set  = 0.This is
eectively the same as behaving as if p
0
= p
1
.Therefore,the actual GA learning starts at
the end of the second period.At the beginning of the second period,the agents randomly
generate their sets of heuristics and pick one at random (with equal probabilities).
Heemeijer et al.(2009) experiment
For this experiment we use the estimated Winged Focal Point (WFP) reported by Diks and
Makarewicz (2013),which is given by
(21) p
e
i;1
=
8
>
>
>
<
>
>
>
:
"
1
i
 U(9:546;50) with probability 0:45739;
50 with probability 0:30379;
"
2
i
 U(50;62:793) with probability 0:23882:
Bao et al.(2012) experiment
We reestimate WFP model for the data reported by Bao et al.(2012) using the same method-
ology as reported by Diks and Makarewicz (2013).This leads to WFP specied as
(22) p
e
i;1
=
8
>
>
>
<
>
>
>
:
"
1
i
 U(16:406;50) with probability 0:32296;
50 with probability 0:35159;
"
2
i
 U(50;70:312) with probability 0:32296:
Hommes et al.(2007);van de Velden (2001) experiments
In the case of the cobweb economy experiment,the subjects were asked to predict prices in
the [0;10] interval.Interestingly,the initial predictions still have the WFP form,with a large
v
proportion equal to the midpoint 5 and the rest (not necessarily rounded to a full integer)
distributed around this new focal point.To account for that,we reestimate the WFP and
obtain
(23) p
e
i;1
=
8
>
>
>
<
>
>
>
:
"
1
i
 U(1:875;5) with probability 0:17983;
5 with probability 0:36344;
"
2
i
 U(5;7:5) with probability 0:45673:
Hommes et al.(2005) experiment
In this experiment,the predictions are two-period ahead,hence the second prediction is still
uninformed much like the rst one.Upon inspecting the data,we noticed that a majority
of the test subjects (around three quarters) have the same prediction in the rst period,i.e.
p
e
i;1
= p
e
i;2
.As discussed,we are not interested in the MC distribution of this experiment,
therefore for the sake of simplicity we sample the rst period predictions p
e
i;1
from (21) and
make all of our agents use them again in the second period.In this way,we omit the question
of the joint distribution of the initial predictions from the two rst periods.
C Parametrization of the forecasting heuristic
In Appendix A,we have discussed the parametrization of the Genetic Algorithms (GA) speci-
cation of our model.This specication is thus used by our GA agents to optimize First-Order-
Rule (6),which on its own requires to be specied.Notice that this is an independent issue
from the sole GA coecients:the same GA can be used to optimize a heuristic in which the
trend extrapolation is free and set to some specic [
L
;
H
],or even restricted to zero (which
gives pure adaptive expectations).Moreover,one can be interested how our GA agents behave
of optimizing a dierent heuristic,including AR1 or some generalized version of FOR.
In this appendix,we will address two of these issues.First,following Heemeijer et al.
(2009) we will look on the importance of the anchor.It is natural to think that the trend
extrapolation should be in a unit circle, 2 [1;1] (c.f.Heemeijer et al.(2009)) and so we
will discuss the issue of the anchor with this restriction.In the second part of the appendix,
we will restrict this assumption and discuss the proper degree of trend extrapolation.
C.1 Is anchor important?
Heemeijer et al.(2009) show that people can be described by First-Order prediction rule with
heterogeneous parameter specication:
(24) p
e
i;t
= 
1
p
t1
+
2
p
e
i;t1
+
3
Anchor +(p
t1
p
t2
)
where the three 
i
span a simplex and  is the trend extrapolation coecient.Notice that
(6) is a special case of (24) with the restriction that 
3
= 0,which implies that the anchor is
vi
Negative feedback
Positive feedback
(a) Distance from the fundamental
(b) Distance from the fundamental
(c) Predictions standard deviation
(d) Predictions standard deviation
Figure 14:Monte Carlo for the full First-Order-Rule with anchor:realized price and coordination
of the predictions over time.Green line is the experimental median,black pluses are
real observations;blue lines are 95% condence interval and red line is the median for
MC with the GA model.Left column displays the negative feedback,right the positive
feedback.Sample size is 1
0
000 simulated markets for each feedback.
not used by the agents.
Due to econometric issues the authors specify the anchor as Anchor = 60 = p
f
.It is more
realistic to think that Anchor = p
t

P
t
s=1
p
s
,the average price so far.
26
In a similar fashion
to the Monte Carlo (MC) experiment reported in section 3,we consider the MC simulation of
1000 GA experiments in comparison with the real data.We report signed distance from the
fundamental and standard deviation of individual predictions.The results for the GA model
based on (24) and the restricted (6) with  2 [1;1] are presented on Figure 14 and Figure 15
respectively.
The result for the negative feedback are similar to other models.This is not surprising.
In general almost any model seems to explain this feedback well.The anchor-based FOR rule
fails however to explain the positive feedback.Intuition suggests that the anchor here should
not play a signicant role,as the agents will prefer to focus on the trend.Nevertheless,GA
model based on FOR as in (24) does not predict oscillations at all,but rather a cumbersome,
sluggish convergence towards the fundamental.For this reason,we have decided to exclude
the anchor from our model.
26
Another possibility is to have Anchor = p
t

P
t
s=
p
s
,where  = maxf0;t Tg and T stands for some
cut-o point or memory span.We also tried GA model,where the anchor is directly learned as one of the GA
variables.The results were not encouraging for either choice.
vii
Negative feedback
Positive feedback
(a) Distance from the fundamental
(b) Distance from the fundamental
(c) Predictions standard deviation
(d) Predictions standard deviation
Figure 15:Monte Carlo for First-Order-Rule with  2 [1;1]:realized price and coordination of
the predictions over time.Green line is the experimental median,black pluses are real
observations;blue lines are 95% condence interval and red line is the median for MC
with the GA model.Left column displays the negative feedback,right the positive
feedback.Sample size is 1
0
000 simulated markets for each feedback.
C.2 Degree of trend extrapolation
As mentioned in Section 3,we argue that the model performs well if we specify the (6) rule
to use trend extrapolation with the coecient  2 [1:1;1:1].We are not able to support
our claim with any proper statistical analysis or optimization procedure and so we have not
identied this interval in a edge-sharp manner.Nevertheless,we did some grid search and
argue that this specication has better properties than many other that seem to be intuitively
plausible.The specic reason is the amplitude of the price oscillations under the positive feed-
back,which is the larger the higher is the allowed maximum trend extrapolation parameter.
To see that,we conduct a series of Monte Carlo experiments similar to the ones reported in
the Section 3 and Section 4.
First,the model for  2 [1;1] seems to behave quite well,still the oscillations from the
second part of the experiment remain unexplained.See Figure 15.Allowing for non-stationary
trend extrapolation  2 [1:5;1:5] results in a model with huge possible oscillations and little
predictive power,see Figure 16.Finally,having  2 [0:5;0:5] results in too small oscillations,
see Figure 17.This shows the importance of [
L
;
H
] specication for explaining the positive
feedback.
27
Moreover this suggests that  trend extrapolation should be chosen from an interval such
27
Negative feedback does not seem to be aected greatly by this issue,which is reasonable since in fact the
GA agents on average learn to omit the trend in this environment.
viii
Negative feedback
Positive feedback
(a) Distance from the fundamental
(b) Distance from the fundamental
(c) Predictions standard deviation
(d) Predictions standard deviation
Figure 16:Monte Carlo for First-Order-Rule with  2 [1:5;1:5]:realized price and coordination
of the predictions over time.Green line is the experimental median,black pluses are
real observations;blue lines are 95% condence interval and red line is the median for
MC with the GA model.Left column displays the negative feedback,right the positive
feedback.Sample size is 1
0
000 simulated markets for each feedback.
that 
L
2 (1:5;1) and 
H
2 [1;1:5).Moreover we restrict 
L
= 
H
to make this interval
symmetric around zero.
28
In total,some experimentation led us to the reported specication
with  2 [1:1;1:1],seen on Figure 2.It performs better than the specication with  2
[1;1],since it is better at explaining the amplitude of the oscillations of the positive feedback,
while retaining its explanatory power in comparison with specication  2 [1:5;1:5].
28
To our knowledge,there is no theoretical reason for anything else.Also,simulations suggest that this is
not an important restriction,as long as 
L
6 0:5.
ix
Negative feedback
Positive feedback
(a) Distance from the fundamental
(b) Distance from the fundamental
(c) Predictions standard deviation
(d) Predictions standard deviation
Figure 17:Monte Carlo for First-Order-Rule with  2 [0:5;0:5]:realized price and coordination
of the predictions over time.Green line is the experimental median,black pluses are
real observations;blue lines are 95% condence interval and red line is the median for
MC with the GA model.Left column displays the negative feedback,right the positive
feedback.Sample size is 1
0
000 simulated markets for each feedback.
x
Rule Prediction
Homogeneous rules
Trend extr.p
e
t
= p
t1
+(p
t1
p
t2
)
Adaptive p
e
t
= 0:75p
t1
+0:25p
e
t1
Contrarian p
e
t
= p
t1
0:5(p
t1
p
t2
)
Naive p
e
t
= p
t1
RE p
e
t
= p
f
Heterogeneous rules
HSM as in Anufriev et al.(2012)
GA model p
e
i;t
= 
i;t
p
t1
(1 
i;t
)p
e
i;t1
+
i;t
(p
t1
p
t2
)
GA FORT+C 
i;t
2 [0;1] and 
i;t
2 [1:1;1:1]
GA FORT 
i;t
2 [0;1] and 
i;t
2 [0;1:1]
Table 7:Specication of the forecasting rules p
e
t
.
D Denition of forecasting rules
Table 7 gives the exact specication for all the prediciton rules used in the one-period ahead
forecasting exercises for the four experiments.Notice that the price predicted by each rule
is F(p
e
t
;:::;p
e
t
),including the random error and that these rules do not have to be model
consistent.
xi