Skip to main content

Advertisement

Log in

Complexity and model comparison in agent based modeling of financial markets

  • Regular Article
  • Published:
Journal of Economic Interaction and Coordination Aims and scope Submit manuscript

Abstract

Agent based models of financial markets follow different approaches and might be categorized according to major building blocks used. Such building blocks include agent design, agent evolution and the price finding mechanism. The performance of agent based models in matching key features of real market processes depends on how these building blocks are selected and combined. For model comparison, both measures of model fit and model complexity are required. Some suggestions are made on how to measure complexity of agent based models. An application for the foreign exchange market illustrates the potential of this approach.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5

Similar content being viewed by others

Notes

  1. We will also use the acronym ABM for agent based models.

  2. It should be noted that the term “complexity” is used here in a quite general meaning. We come back to the question which concepts and measures of complexity might be adequate in the context of ABM in Sect. 3.

  3. It is also to be noted that the results are based on original reported data and not every ABM approach refers to the same list of stylized facts.

  4. Usually, one of the factors is stochastic in order to reflect missing information or uncertainty about the strategy. It also introduces some heterogeneity of agents’ behavior.

  5. The fundamental value can be perceived by the agents without or with errors. For example, in Fischer and Riedler (2014), evaluation errors persist only for a limited time, as agents will eventually become aware and correct them.

  6. Arthur et al. (1997) underline this reflexive nature of the market, where agents’ expectations co-evolve in a world they co-create.

  7. Each agent has at her disposal a set of strategies which is continuously evaluated—even if the rule was not actually executed, but would have been a valid selection based on its condition classifier part—and updated at random times by replacing a subset of the agent’s worst rules with new ones generated by crossing-over and mutating a selection of its own best rules.

  8. A population of new trading rules is evolved by means of GP within a distinct “schooling” component, which is visited from time to time by under-performing single strategy holding agents.

  9. Alternatively, in the case of intraday ABM, a continuous market is implemented where trading demand is disclosed asynchronously and orders are matched by means of a limit order book at various prices [see, e.g., Chiarella and Iori (2002), Daniel (2006), Chiarella et al. (2009), Mandes (2015)]. As a consequence, transactions do not take place only at the global equilibrium price. However, this higher-frequency framework deals with a finer level of details which are not within the scope of market features we want to capture in this paper.

  10. A complexity count is added for each logical connective operator and and or within logical statements. Also, conditional expressions using the ternary operator ?: add one count to the complexity total.

  11. At the start of each file the block level is zero and the block depth grows with each execution control statements such as if, case and while.

  12. One way to achieve such a standardization consists in considering Flops instead of time. Given that this might not be feasible in practice, counting the counts to procedures, functions etc. might provide a way to obtain more reliable lower bounds for this type of computational complexity.

  13. This view is in line with the intuition of Chen et al. (2012) who define complexity as the degree of heterogeneity (diversity).

  14. If applied directly to the final (observable) output, this statistic could evaluate and even validate/reject a calibrated model with respect to specific data. In other words, it has the potential of becoming a stylized fact, given that certain values would be exhibited by a wide range of financial data. A first application is contained in Pincus and Kalman (2004), but more work is needed.

  15. The chosen values for the two parameters, i.e. the block length \(m = 1\) and the tolerance window \(r = 0.2\,\sigma \), have been provided in Pincus and Kalman (2004).

  16. After translating the target time-series into a sequence via a measuring channel, the ABM can be considered a “message” source, and the general idea is to construct a “parallel” computational model which is able to “predict” its behavior (statistically indistinguishable). The information content of the simplest such model determines the complexity class of the original system.

  17. Barde (2015) develops an Universal Information Criterion which relies on mapping the target data-generated process to an underlying Markov process by applying a universal data compression algorithm, i.e. the Context Tree Weighting algorithm proposed by Willems et al. (1995). Once the Markov transition matrix is generated, the mean value of the benchmark observation-level score, i.e. the log-likelihood, can be computed giving the prediction accuracy which is equivalent to the Kullback–Leibler distance.

  18. Each trading day is divided into \(n = 50\) micro-time intervals.

  19. Farmer and Joshi (2002) show that even if the strategy coefficients would be heterogeneous among agents, when the strategies are linear, equivalent results can be achieved by using a “representative agent” for each strategy type with a coefficient equal to the group-mean. As a side note, Chen et al. (2012) classify this category as “few-type” models.

  20. Some “fallacy of composition” might arise due to this aggregation.

  21. Chen et al. (2012) identify the Lux model as an hierarchical two-type model, with two chartist subdivisions.

  22. The fundamental value is assumed to remain constant over the entire simulation time span.

  23. Agents’ portfolios are ignored and therefore they are able to accumulate unbounded inventories.

  24. This means that there are \(n = 100\) microintervals per day, at which interaction and trading sessions occur.

  25. When computing the effective net transitions between different clusters, we are not using the expected value as described in Lux (1998), rather we simulate the sampling data effect by drawing a random deviate from a normal distribution centered around the expected value and with a variance depending on the cluster size. Otherwise, due to rounding and very small probabilities per time unit, the number of agents changing their types would be zero most of the time.

  26. For example, the flow of fundamentalists to the optimistic chartists group is \(N_F\,r^{F+} - N^+_C\,r^{+F}\), where \(r^{F+} \sim \mathcal {N}(\pi ^{F+},1/N_F)\) and \(r^{+F} \sim \mathcal {N}(\pi ^{+F},1/N^+_C)\).

  27. The switching probabilities are based on the assumption of direct interaction between agents (herding effect) and, thus, their values depend on the sizes of agent groups pursuing a common strategy.

  28. Other conditions regarding the thresholds are \(-T < \tau < T\) and \(|\tau _{min}| \le T_{min}\).

  29. There is an exception in the case of the Kirman model where, because of missing original parameters, we use the parameters presented in Winker et al. (2007)

  30. By employing a population based search heuristic, such as the Genetic Algorithm, we try to alleviate the difficulty of choosing sensible starting points, an issue underlined in recent work on estimation of ABMs (Chen and Lux 2015). However, a larger number of iterations and reruns would be necessary in order to account for both the stochastics of the heuristics and of the estimators, and to precisely report on their convergence.

  31. In the case of DEM/USD there are 10,000 bootstrap replications, while in the case of all simulated models throughout this paper there are 100 replications with different random seeds.

  32. We are using the set-up provided in Pincus and Kalman (2004) where \(m=1\) and r equals 20 % of the time-series standard deviation.

  33. It is worth mentioning that the calibration of the Lux model—as opposed to the other two considered ABM—is highly sensitive to the underlying time-series to be fitted. We have run a similar calibration exercise for the DAX 30 (2003–2011) time-series and a non-trivial readjustment of the search intervals for the parameters is necessary in the Lux case. On the other side, the Farmer–Joshi model is able to better fit the DAX 30 time-series, both at the aggregate, as well as at the individual moments level.

  34. Every Java application has a single instance of class java.lang.Runtime that allows the application to interface with the environment in which the application is running, including the virtual memory space assigned by the operating system to the Java process.

References

  • Akaike H (1974) A new look at the statistical model identification. IEEE Trans Autom Control 19(6):716–723

    Article  Google Scholar 

  • Arthur WB (2014) Complexity and the economy. Oxford University Press, Oxford

    Google Scholar 

  • Arthur WB, Holland J, LeBaron B, Palmer R and Tayler P (1997) Asset pricing under endogenous expectations in an artificial stock market. SFI Paper 96-12-093, Economic Notes, 1997. Reprinted in The Economy as an Evolving Complex System II. Edited (with Durlauf S, Lane D), Addison-Wesley, Boston

  • Barde S (2015) A practical, universal, information criterion over nth order markov processes. Studies in Economics 15/04, University of Kent, UK

  • Brock W, Hommes C (1997) A rational route to randomness. Econometrica 65(5):1059–1095

    Article  Google Scholar 

  • Brock W, Hommes C (1998) Heterogeneous beliefs and routes to chaos in a simple asset pricing model. J Econ Dyn Control 22(8–9):1235–1274

    Article  Google Scholar 

  • Chen S-H (2012) Varieties of agents in agent-based computational economics: a historical and an interdisciplinary perspective. J Econ Dyn Control 36(1):1–25

    Article  Google Scholar 

  • Chen S-H, Chang C-L, Du Y-R (2012) Agent-based economic models and econometrics. Knowl Eng Rev 27(2):187–219

    Article  Google Scholar 

  • Chen S-H, Yeh C-H (2001) Evolving traders and the business school with genetic programming: a new architecture of the agent-based artificial stock market. J Econ Dyn Control 25(3):363–393

    Article  Google Scholar 

  • Chen S-H, Yeh C-H (2002) On the emergent properties of artificial stock markets: the efficient market hypothesis and the rational expectations hypothesis. J Econ Behav Organ 49(2):217–239

    Article  Google Scholar 

  • Chen Z, Lux T (2015) Estimation of sentiment effects in financial markets: A simulated method of moments approach. Technical Report 37, FinMaP-Working Paper

  • Chiarella C, Dieci R, He X (2009) Heterogeneity, market mechanisms, and asset price dynamics. In: Hens T, Schenk-Hoppé K (eds) Handbook of financial markets: dynamics and evolution. North Holland, Amsterdam, pp 277–344

    Chapter  Google Scholar 

  • Chiarella C, Iori G (2002) A simulation analysis of the microstructure of double auction markets. Quant Finance 2(5):346–353

    Article  Google Scholar 

  • Chiarella C, Iori G, Perelló J (2009) The impact of heterogeneous trading rules on the limit order book and order flows. J Econ Dyn Control 33(3):525–537

    Article  Google Scholar 

  • Cliff D, Bruten J (1997) Minimal-intelligence agents for bargaining behaviors in market-based environments. Technical report, University of Sussex, School of Cognitive and Computing Sciences

  • Cont R (2001) Empirical properties of asset returns: stylized facts and statistical issues. Quant Finance 1:223–236

    Article  Google Scholar 

  • Cristelli M, Pietronero L, Zaccaria A (2011) Critical overview of agent-based models for economics. arXiv preprint arXiv:1101.1847

  • Crutchfield JP, Young K (1989) Inferring statistical complexity. Phys Rev Lett 63:105–108

    Article  Google Scholar 

  • Daniel G (2006) Asynchronous simulations of a limit order book. Ph.D. thesis, University of Manchester

  • Du D-Z, Ko K-I (2014) Theory of computational complexity. Wiley, UK

    Book  Google Scholar 

  • Fabretti A (2013) On the problem of calibrating an agent based model for financial markets. J Econ Interact Coord 8(2):277–293

    Article  Google Scholar 

  • Farmer JD, Joshi S (2002) The price dynamics of common trading strategies. J Econ Behav Organ 49(2):149–171

    Article  Google Scholar 

  • Fischer T, Riedler J (2014) Prices, debt and market structure in an agent-based model of the financial market. J Econ Dyn Control 48:95–120

    Article  Google Scholar 

  • Franke R (2009) Applying the method of simulated moments to estimate a small agent-based asset pricing model. J Empir Finance 16(5):804–815

    Article  Google Scholar 

  • Frankel JA, Froot KA (1987) The dollar as an irrational speculative bubble: a tale of fundamentalisists and chartists. National Bureau of Economic Research, Cambridge

    Google Scholar 

  • Gilli M, Winker P (2003) A global optimization heuristic for estimating agent based models. Comput Stat Data Anal 42(3):299–312

    Article  Google Scholar 

  • Gode D, Sunder S (1993) Allocative efficiency of markets with zero-intelligence traders: market as a partial substitute for individual rationality. J Polit Econ 101(1):119–137

    Article  Google Scholar 

  • Grazzini J, Richiardi M (2015) Estimation of ergodic agent-based models by simulated minimum distance. J Econ Dyn Control 51:148–165

    Article  Google Scholar 

  • Hannan EJ, Quinn BG (1979) The determination of the order of an autoregression. J R Stat Soc Ser B (Methodological) 41(2):190–195

  • Haughton D (1991) Consistency of a class of information criteria for model selection in non-linear regression. Commun Stat Theory Methods 20:1619–1629

    Article  Google Scholar 

  • Higuchi T (1988) Approach to an irregular time series on the basis of the fractal theory. Phys D Nonlinear Phenom 31(2):277–283

    Article  Google Scholar 

  • Hommes C (2006) Heterogeneous agent models in economics and finance. In: Tesfatsion L, Judd K (eds) Handbook of computational economics, vol 2. Elsevier, Amsterdam, pp 1109–1186

    Google Scholar 

  • Hommes C, Wagener F (2009) Complex evolutionary systems in behavioral finance. In: Hens T, Schenk-Hoppé K (eds) Handbook of financial markets: dynamics and evolution. North-Holland, Amsterdam, pp 217–276

    Chapter  Google Scholar 

  • Iori G, Porter J (2012) Agent-based modelling for financial markets. Working Papers 12/08, Department of Economics, City University, London

  • Jeleskovic V (2011) Agentbasierte Modelle für empirische Wechselkurse. Peter Lang, Frankfurt am Main

    Google Scholar 

  • Kirman A (1991) Epidemics of opinion and speculative bubbles in financial markets. In: Taylor M (ed) Money and financial markets. Blackwell, Cambridge, pp 354–368

    Google Scholar 

  • Kirman A (1993) Ants, rationality, and recruitment. Q J Econ 108(1):137–156

    Article  Google Scholar 

  • LeBaron B (2000) Agent-based computational finance: suggested readings and early research. J Econ Dyn Control 24(5):679–702

    Article  Google Scholar 

  • LeBaron B (2006) Agent-based computational finance. Handb Comput Econ 2:1187–1233

    Article  Google Scholar 

  • LeBaron B, Arthur W, Palmer R (1999) Time series properties of an artificial stock market. J Econ Dyn Control 23(9):1487–1516

    Article  Google Scholar 

  • LeBaron B, Winker P (2008) Introduction to special issue on agent based models in economic policy advice. J Econ Stat 228(2+3):141–147

    Google Scholar 

  • Lloyd S (2001) Measures of complexity: a nonexhaustive list. IEEE Control Syst Mag 21(4):7–8

    Article  Google Scholar 

  • Lux T (1995) Herd behaviour, bubbles and crashes. Econ J 105(43):881–896

    Article  Google Scholar 

  • Lux T (1998) The socio-economic dynamics of speculative markets: interacting agents, chaos, and the fat tails of return distributions. J Econ Behav Organ 33(2):143–165

    Article  Google Scholar 

  • Lux T (2009) Stochastic behavioral asset pricing models and the stylized facts. In: Hens T, Schenk-Hoppé K (eds) Handbook of financial markets: dynamics and evolution. North-Holland, Amsterdam, pp 161–215

    Chapter  Google Scholar 

  • Lux T, Marchesi M (1999) Scaling and criticality in a stochastic multi-agent model of a financial market. Nature 397(6719):498–500

    Article  Google Scholar 

  • Lux T, Marchesi M (2000) Volatility clustering in financial markets: a microsimulation of interacting agents. Int J Theor Appl Finance 3(4):675–702

    Article  Google Scholar 

  • Mandelbrot BB (1977) The fractal geometry of nature. WH Freeman and Co., New York

    Google Scholar 

  • Mandes A (2015) Microstructure-based order placement in a continuous double auction agent based model. Algorithmic Finance 4:105–125

    Article  Google Scholar 

  • Manis G (2008) Fast computation of approximate entropy. Comput Methods Programs Biomed 91(1):48–54

    Article  Google Scholar 

  • McCabe TJ (1976) A complexity measure. IEEE Trans Softw Eng 4:308–320

    Article  Google Scholar 

  • Mitchell M (2009) Complexity: a guided tour. Oxford University Press, Oxford

    Google Scholar 

  • Nakamura T, Judd K, Mees A, Small M (2006) A comparative study of information criteria for model selection. Int J Bifurc Chaos 16(8):2153–2175

    Article  Google Scholar 

  • Palmer R, Arthur W, Holland J, LeBaron B, Tayler P (1994) Artificial economic life: a simple model of a stockmarket. Phys D 75(1):264–274

    Article  Google Scholar 

  • Pincus S, Kalman RE (2004) Irregularity, volatility, risk, and financial market time series. Proc Natl Acad Sci USA 101(38):13709–13714

    Article  Google Scholar 

  • Pincus SM (1991) Approximate entropy as a measure of system complexity. Proc Nat Acad Sci 88(6):2297–2301

    Article  Google Scholar 

  • Pincus SM, Gladstone IM, Ehrenkranz RA (1991) A regularity statistic for medical data analysis. J Clin Monit 7(4):335–345

    Article  Google Scholar 

  • Recchioni MC, Tedeschi G, Gallegati M (2015) A calibration procedure for analyzing stock price dynamics in an agent-based framework. J Econ Dyn Control 60:1–25

    Article  Google Scholar 

  • Reuter H, Breckling B, Jopp F (2011) Individual-based models. In: Jopp F, Reuter H, Breckling B (eds) Modelling complex ecological dynamics. Springer, Heidelberg, pp 163–178

    Chapter  Google Scholar 

  • Rosenberg LH (1998) Applying and interpreting object oriented metrics. In: Software Technology Conference (STC’98). Salt Lake City, Utah

  • Schwarz G et al (1978) Estimating the dimension of a model. AnnStat 6(2):461–464

    Google Scholar 

  • Tesfatsion L (2001) Introduction to the special issue on agent-based computational economics. J Econ Dyn Control 25(3):281–293

    Article  Google Scholar 

  • Watson AH, McCabe TJ, Wallace DR (1996) Structured testing: a testing methodology using the cyclomatic complexity metric. NIST Spec Publ 500(235):1–114

    Google Scholar 

  • Westerhoff F (2009) Exchange rate dynamics: a nonlinear survey. In: Rosser JB Jr (ed) Handbook of research on complexity. Edward Elgar, Cheltenham, pp 287–325

    Google Scholar 

  • Westerhoff F (2010) A simple agent-based financial market model: direct interactions and comparisons of trading profits. In: Bischi GI, Chiarella C, Gardini L (eds) Nonlinear dynamics in economics, finance and social sciences. Springer Berlin Heidelberg, pp 313–332

  • Willems FM, Shtarkov YM, Tjalkens TJ (1995) The context-tree weighting method: basic properties. IEEE Trans Inf Theory 41(3):653–664

    Article  Google Scholar 

  • Winker P, Gilli M, Jeleskovic V (2007) An objective function for simulation based inference on exchange rate data. J Econ Interac Coord 2:125–145

    Article  Google Scholar 

  • Winker P, Jeleskovic V (2006) The unconditional distribution of exchange rate returns: statistics, robustness, time aggregation. Technical Report WP008-06. University of Essex, Colchester

  • Winker P, Jeleskovic V (2007) Dependence of—and long memory in—exchange rate returns: statistics, robustness, time aggregation. Technical Report WP011-07. University of Essex, Colchester

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Alexandru Mandes.

Additional information

We are indebted to Manfred Gilli, to the participants of the Second Meeting of the German Network for New Economic Dynamics (GENED) at the Technical University Darmstadt, 29th–30th September 2014, as well as to two anonymous reviewers for their valuable comments on preliminary versions of this paper. Alexandru Mandes would also like to thank Deutscher Akademischer Austauschdienst (DAAD) for the awarded Ph.D. scholarship.

Appendices

Appendix 1: Approximate entropy algorithm

Let X(1), X(2), ..., X(N) be the time-series to be analyzed. Given the selected block length m (also referred to as pattern length or window size), a new series of vectors \(V(1), \ldots , V(N-m+1)\) in \(\mathcal {R}^m\) can be constructed, where \(V(i) = X(i), \ldots , X(i+m-1)\).

Let the distance between two such vectors be \(|V(i),V(j)| = \max (X(i+k) - X(j+k))\), for \(0 \le k \le m-1\), i.e. the maximum difference in the scalar components. Given the tolerance window r (also referred to as threshold distance), a similarity function f can be defined as:

$$\begin{aligned} f(i,j,m,r) = {\left\{ \begin{array}{ll} 1 &{} |V(i),V(j)| \le r\\ 0 &{} \text {otherwiese} \end{array}\right. } \end{aligned}$$
(22)

The frequency when a vector V of size m is similar with another vector of the same size is denoted by:

$$\begin{aligned} C_i^m(r) = \frac{\sum _{j=1}^{N-m+1} f(i,j,m,r)}{N-m+1} \end{aligned}$$
(23)

Next, we define:

$$\begin{aligned} \varPhi ^m(r) = \frac{\sum \nolimits _{i=1}^{N-m+1} \ln C_i^m(r)}{N-m+1} \end{aligned}$$
(24)

Finally, the approximate entropy is:

$$\begin{aligned} ApEn(m,r) = \varPhi ^m(r) - \varPhi ^{m+1}(r) \end{aligned}$$
(25)

Related to the effective implementation of the algorithm, the original and basic version was introduced in Pincus et al. (1991), while an improved version is described in Manis (2008).

Appendix 2: Higuchi Fractal dimension algorithm

Let X(1), X(2), ..., X(N) be the finite set of N observations to be analyzed. A number of k new series \(X^m_k\) can be constructed as follows:

$$\begin{aligned} X^m_k = {X(m), X(m+k), X(m+2\,k), \ldots , X\left( m+\left[ \frac{N-m}{k}\right] \,k\right) }, \end{aligned}$$
(26)

with \(m = 1,2,\ldots ,k\) representing the initial values, k indicating the interval time (delay) and \([\cdot ]\) denoting the Gauss notation, i.e. the integer part.

For each of the previous \(X^m_k\) series, the length of the curve can be computed as follows:

$$\begin{aligned} L_m(k) = \frac{1}{k}\,\left( \sum \limits _{i=1}^{[(N-m/k)]} \left| X(m+i\,k) - X(m+(i-1)\,k)\right| \right) \,\frac{N-1}{\left[ \frac{N-m}{k}\right] \,k}, \end{aligned}$$
(27)

where the last factor is a normalization factor.

The average length for each scale \(k = 1,2,\ldots ,k_{max}\), L(k), is computed as the mean of \(L_m(k)\) where \(m = 1,2,\ldots ,k\) and is proportional to \(k^{-D}\), i.e. the average lengths follow a power law. D is considered the fractal dimension computed by Higuchi’s algorithm and a least squares estimate for D is given by the slope of the line that fits the pairs (\(\ln (L(k))\), \(\ln (1/k)\)).

Appendix 3: Search intervals for the calibration procedures

See Tables 7, 8 and 9.

Table 7 Search intervals and precision for the calibration of individual-based (\(K_{\mathtt {ag}}\)) and cluster-based (\(K_{\mathtt {cl}}\)) Kirman models
Table 8 Search intervals and precision for the calibration of the Lux model
Table 9 Search intervals and precision for the calibration of the Farmer–Joshi model

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Mandes, A., Winker, P. Complexity and model comparison in agent based modeling of financial markets. J Econ Interact Coord 12, 469–506 (2017). https://doi.org/10.1007/s11403-016-0173-0

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11403-016-0173-0

Keywords

JEL Classification

Navigation