16 min read

What is Agent-based Modeling?

Answering: what exactly is ABM? why is it useful? where has it been used? how does it relate to the data? where do we go from here?
What is Agent-based Modeling?

During my PhD I am working on the empirical validation and calibration of Agent-based Models. What I am asking is: how can we take these models to the data and how can we compare them amongst each other? I have found that, both within the circle of my economist friends and especially outside this circle, this is often greeted with the question: what exactly is agent-based modeling? or sometimes for those with a background in economics, a sort of dismissive response about its robustness. With this article I want to give an introduction to Agent-based Modeling in economics. To do this let's ask the common questions: what exactly is it (not necessarily from a practical perspective)? why is it useful? where has it been used? how does it relate to the data? where do we go from here?

What is Agent-based Modeling?

What qualifies as an ABM?

The simplest explanation is that an ABM tries to simulate the whole economy directly:

ACE is the computational modeling of economic processes (including whole economies) as open-ended dynamic systems of interacting agents. The stress on open-ended dynamics fundamentally distinguishes ACE from all other currently mainstream economic modeling approaches - Leigh Tesfatsion

[Note here ACE = Agent-based computational economics, a different term for ABM (see below).]

In other words, we can represent different agents, such as individual households, social groups like firms or the government, or physical systems like transportation and endow them with behavioral rules. At each point in time, an agent acts according to its current situation, the state of the world, and the rules governing behavior. We can generate a large number of these agents, who vary in constraints, behavior, preferences, and objectives. Then we simulate their interactions over time and study the aggregate outcomes such as recessions, booms, inequality, and inflation. If you're a science fiction nerd like myself, it is like there is this grand computer that is simulating the actions and interactions of all the people in the world. Though in this case it is only in a highly stylized economic context, and we don't actually have any data on you as a person (so far Westworld hasn't become a reality).

So what goes into all this? Well if we set the hyper-parameters of the model (e.g. how frequently people interact) and we set everyone's initial conditions (e.g. how much in savings we start with, where you work etc.) then the ABM specifies how this ensemble of agents will evolve over time. Like a petri dish - we set up the experimental and initial conditions and then just observe what happens as time goes on. Once we have run a large number of simulations, we can analyse the outcomes. While we have the series for each individual agent, we then typically only consider how the aggregate variables of the economy evolve (this is what we have empirical data on and can compare to).

ABM as methodology, not theory

In this regard, ABM is more of a methodological tool rather than a economic theory per se. If you will, think of ABM as a programming language. By itself, a programming language cannot tell you much though it has some built in differences to other languages (e.g it is object-oriented and has an interpreter rather than scripting and pre-compiled). We, as the modelers, must write a script to run in this language in order to generate output. In other words, we must endow all of the agents with behavioral rules and parameters that are based on the modeler's choices. This means one can build ABMs from the perspective of post-Keynesian economics (e.g. demand-led regimes inspired by Kalecki, with Minskian financial dynamics) or we can remain aligned with economic orthodoxy of optimizing agents that are rational. In other words, economic theorists from different backgrounds can each write a program in the language of ABM. In fact, both have been done. The beauty of the ABM programming language is that its computational basis allows a much wider and richer set of possible programs that can be created. This discussion does beg the question of why does the economic "mainstream" frown upon us? and why this isn't a generally used tool?

First, ABM was developed outside of the orthodox tradition of general equilibrium models. This meant that its theoretical foundations were in economic heterodoxy, in particular post-Keynesian thought. This alone did not make it attractive within the mainstream economic circles. Though recently this has turned into a questioning of the empirical relevance. Namely, ABMs are very large models with many agents and parameters, such that actually fitting them to the data is difficult (see my section below) so that they are often just regarded as interesting thought experiments but not highly practical (I'll leave aside my comments on the obsession with point-prediction of whether inflation is 3.141 or 3.142%).

Secondly, for ABM it is up to the modeler to posit behavioral functions. Since we do not consider humans to be hyper rational or know everything in the world, we tend to use rules-of-thumb to guide behavior (I know I certainly do). For instance, one may generally save a fraction of income instead of explicitly discounting and optimizing over the remaining lifetime. Unfortunately, there are many such behavioral rules of thumb such that there are many possible choices (see here for a listen). Henry Sims referred to this as "the wilderness of bounded rationality". This is in stark contrast to the mathematical micro-foundations of normal economics that have very clever optimizing agents, which permit mathematical treatment (under very stringent conditions). It is frowned upon because a lot of different rules can generate the same outcomes, it appears sort of arbitrary, but really I think this is quite ingenious. It allows us to have behavioral uncertainty, in other words, we can study how robust the outcomes and dynamics of the economy are to individual behavior.

This leads us into the final point: because you cannot neatly write down an ABM in a small number of equations, it requires use to simulate the outcome given a starting point and a set of parameters. We cannot explicitly solve for an equilibrium (a state of balance where nothing changes), in fact, we do not even know if the model will ever reach such a state. I believe this provides more realism and flexibility, though it does mean that finding robust results in terms of mathematical formulas is much more tricky, if not impossible. On the other hand, it may give a wider picture of all the things that could happen (a scenario generator).

Generative Social Science

I mentioned that ABM is more of a methodology. If we take a step back, then ABM is the tool of generative social science (Epstein, 1999 - see also his book). To put it in the most simple terms, this is a notion of science where in order to explain a phenomenon one needs to "grow" it in an artificial society of interacting agents. In this way one can develop maps between the individual behavior and macroscopic (aggregate) regularities and organisation. The individual behavior can then potentially be tested experimentally in a lab. The crux of this is that if we want to find causal explanations we should be able to simulate forward from the initial states and see the resulting phenomenon we seek to explain. Epstein's book is a great introduction to this train of thought, and quite accessible. I cannot approach his level of explanation, so I leave it to you to delve deeper.

ABM, ACE, MABM - what's in my acronym salad?

So there are actually three acronyms, ABM = Agent-based Modeling, ACE = Agent-based Computational Economics, and MABM = Agent-based macroeconomics. These represent a sort of hierarchy of generality. ABM is the most general use and application of agent-based models across all the disciplines they are found in, including biology, ecology, epidemiology, physics, the social sciences in general. ACE is the subset of agent-based models that are used in economics. Finally, MABM refers to those agent-based models that are applied to study the macroeconomy. Going forward, we will primarily be discussing the MABM models as these are the most interesting to me personally. In the going literature in macroeconomics all of this is typically referred to under the umbrella of ABM anyway.

To put all of this into a more formal framework, I will suggest some further reading for those who want to go beyond my simple amateur description above:

Why should we use ABM?

It seems a reasonable proposition to simply simulate your prior beliefs of different agent's behavior and see what the resulting dynamics look like. In this way one would very explicitly be going from individual micro-behavior to macro-outcomes (e.g. a financial crisis). This is the reaction I sometimes get from non-economists who haven't enjoyed (suffered...) several years of equilibrium-theory models. Equilibrium theory models with strong abstraction and stringent conditions are mathematically solvable. I can do so by hand (though these days they are quite complicated), as there are only 2-3 agents, with well-defined behaviors. The solution might also be quite good in terms of defining the actual level of each of the variables involved, such as GDP or unemployment during good times. However, in comparison to ABM it is not ideal for analyzing dynamics and instability (after all, it converges to a single equilibrium)…

So what does ABM add?

Why am I telling you this? The advent of computational power to simulate allows us to study several aspects of reality that analytical models miss. In other words, for ABM to be a useful endeavor it must add something, and I fully believe it does.

The principal paradigm that ABM studies is the economy as a complex evolving system:

an ecology populated by heterogeneous agents whose far-from-equilibrium local interactions yield some collective order, even if the structure of the system continuously changes (Dosi & Roventini, 2019).

This implies that more is different such that the interactions and heterogeneities at the micro-level lead to new phenomena and dynamics at the macro-level. I mentioned this in my post what about complexity economics. In any case, some of the aspects of the economy that we can (in my opinion, better) study with ABM include:

  1. Disequilibrium and path dependency - one of the foundations of macroeconomic theory is that there exists an equilibrium (or multiple in some cases) towards which the economy tends. Like a pendulum, you can give it a whack, it will swing, but eventually (if you're not obsessed with continuously whacking it) it will return to a state of rest. This is a great mathematical tool because we can prove there is an equilibrium, what defines it, and how an economy gets there. Unfortunately, we don't really know if equilibrium at such a grand scale is a real-life phenomena? Or whether we tend towards it? In fact, it might just be a special case, and even systems where this sort of utility maximisation happens at the individual level might never achieve macroscopic equilibrium (Epstein, 1999). This state of permanent (or very long) disequilibrium can be easily studied in an ABM simulation model, but not a model whose foundation is the existence of an equilibrium of some form.
  2. The heterogeneity and boundedness of agents - all the agents may have different endowments, skills, and behavior. Doing this analytically would require a different system of equations for each agent that accounts for their differences in behavior and their differences in endowments. There are a class of mathematical formulations that make this easier, but also abstract from it. This is much easier to capture with simulation where the distribution of different properties can simply be set for each agent initially, and then it can be seen whether, for example, the wealth distribution becomes as tilted as it currently is. This way different functional forms and preferences can more easily be exchanged and tested. For a thorough recent review, I suggest looking to Cars Hommes (here and here)
  3. Agent interactions - in ABM we may be explicit about the social interactions of different agents and also incorporate a form of social network if we choose. I certainly know my own beliefs and actions are affected by those I interact with, and it is reasonable to assume this is the case for larger groups. In this manner one can model cascades in behavior (a panic...) and how incomplete information (we don't know everything) travels through the system. This is much harder to do within a dynamic stochastic general equilibrium setting. Typically, and I am not 100% up-to-date on current papers, the interactions of various agents are only through prices (i.e. changes in prices transfer information between agents). This is a rather limited means of exchange. Imagine that we are on a market and I am selling my blogpost, and there is a well-informed reader and an uninformed one. The only way the well-informed person can communicate that he thinks my (free) blog is over-priced is by bidding lower, rather than just turning to the person next to him and saying: "Hey dude, this is a great start, but I think charging $1000 per year really isn't reasonable". My caricature is not 100% accurate but sort of serves the point of being provocative. For the latest in heterogeneous agents and their interactions in the "mainstream" macroeconomics setting, check out Ben Moll (here's a lecture too), he is a great guy.
  4. Emergent behavior - this is most easily captured by the adage more is different. As we have a large amount of agents, we can observe phenomena that one cannot observe with only a handful. A simple analogy would be that the behavior of a group of guys at a bar is likely entirely different than that of a single guy (and not often in the best of ways...). This can be captured when we explicitly have many agents and simulate their interactions over time. We can then also model panics, and other large phenomena that an individual agent by themselves would not necessarily do. For instance, we can see how information spreads across the group, and we can see if there are persistent segregations (e.g. Shelling's model).

In these respects, ABM has a lot to offer for our understanding of the unstable nature of our economy. The cost to this is that there are no mathematical solutions to these models. But on a philosophical level, should we constrain our understanding of socio-economic phenomena to only those where we can derive the aggregate outcomes with a mathematical formula? If we have a good simulation, we can always proceed to studying it analytically afterwards.

Is it a black box?

On this note, a critique that I hear semi-frequently is that ABM is a black box. I would say it is actually entirely the opposite case, each agent's behavior is explicitly shown and modeled. Additionally, their interactions on different markets are also explicitly modeled. In this way it is quite clear what happens for each person. The emergent phenomena at the aggregate, such as business cycles, might not initially seem easy to understand because of their emergent nature. However, when analyzing the distribution of agent actions these two can be clearly explained. I believe that one of the limitations to this is our power of displaying this information clearly both visually and in words.

What I would say to my fellow macroeconomic ABM practitioners at this point is that the code is the model. For instance, the order of operations in the code matters (this tends to be a function of the random number generator of the programming language, or the sorting of the agents). This is sometimes not made explicit and can make replication of models based just on equations tricky for follow-up papers. It would be a researchers dream to have a unified interface for working on these economic models such that they can be easily compared and contrasted (think of all the mainstream macro-models programmed in the DyNare software that can be contrasted). Even more-so that those who come up with the theoretical base can more easily have their models fitted by those that focus on the econometric comparison of model and data. Perhaps an improved database of models and a common programming language would help. The NetLogo of economics....

Where has it been used?

This section will be woefully short, as covering the entire set of literature is a large task that does not help the exposition here. If you are interested, I am starting to compile such a list of references under the Resources header on this page (a work that is very much in progress).

As of 2021, Agent-based models have been around for roughly 50 odd years. The classic example of the origins of ABM are Conway's game of life, and Schelling's segregation model (though he did use graphing paper and coins, a horrendous thought when I consider the 10,000 firm simulation I just ran....). In any case, the usage of ABMs in economics began in finance roughly with the canonical ABM of the stock market of the Santa Fe Institute. Since then it has been quite successful in the financial world, with a large heaping of different papers. Why? It does a very good job of replicating some of the stylized facts (e.g. excess volatility and herding) that have been widely observed but that the standard theory has struggled to explain well.

Now, onto macroeconomics, the field I am interested in... to the best of my knowledge this stream of work in macroeconomics began with the CRISIS project, which led to the Mark-1 model of Delli Gatti et al. in 2008. Since then, there has been quite an explosion of different ABMs in macroeconomics to study economic fluctuations and what kind of policy responses there are to this. Since this isn't going to be a fully fledged literature review I suggest looking do Dawid and Delli Gatti (2018) (link is to the working paper version of book chapter) for a review of macro-ABM up until that point in time.

Now, with COVID there has been another huge surge in Agent-based Models. Agent-based models have been used in epidemiology quite frequently (Josh Epstein's NYU ABM lab deals with Epidemiology). It was therefore quite a straightforward process to add an epidemiological model to the already existing macroeconomic ABMs. This has led to several insights on the path to recovery. For instance, whether or not government subsidies help and how different "re-opening" schemes might play out. Again, I won't go into an in-depth literature review, but for an example, have a look at: V–, U–, L– or W–shaped economic recovery after Covid-19: Insights from an Agent Based Model

If you're curious about which journals to follow, check out Where to get your ABM fix, an article I wrote earlier this year regarding the authors and journals frequently cited.

ABM and the data?

Having simulation models is nice, but do they reflect what happens in reality? I say yes (but I'm also biased since I use them...).

Taking ABM to the data in the traditional sense, where we build a model with some parameters and fit these parameters to the data by classic methods like maximum likelihood, is not a trivial exercise for ABMs. There are two reasons for this: a large number of parameters (large parameter space) and non-linearity.

Not only do we tend to have 10s or 100s of parameters, but we must also infer the initial conditions of all of the agents (thousands or millions of parameters). Why? Because typically the best data available publicly (e.g. EuroStat or the Federal Reserve) is at an aggregated level (such as by industry or by age-group). What does that mean? Suppose we have all car parts available in the world in front of us, and we need to infer where and how those pieces fit and work together to replicate a particular car, say a Toyota Camry. We have an idea (a model) of how this might work together, we also have a set of observations of the final product: the whole car, and some data on its speed, fuel consumption, tire-usage,... The question is: how do I infer whether my idea is correct? I build based on my idea and I turn the key, if the engine turns on, great, we have a working car. Unfortunately there are many different possible working cars, how can we make sure that we have identified the Toyota Camry (our goal) when we simply know speeds, fuel consumption, tire usage, and some other aggregate variables? Perhaps this is an awful metaphor, but it will give us the flavor of the scope of the issue.

So that sounds like a tricky problem to have... thankfully there are a lot of smart researchers working on these problems, and they have made significant strides in taking these models to the data. There are different levels to this, I wrote an earlier article on validation already, essentially I see two different streams of work going on. On the one hand, there are those developing Macroeconomic ABM from the point of view of looking into policy effects. These models are often "calibrated", which means that the authors take some stylized facts (for instance, the autocorrelation of GDP growth or the distribution of firm sizes) and find a parameter set that matches these stylized facts. Only for some models are more explicit econometric or statistical tools used to match the outcome series to the empirical series.

The second stream are those working on the statistical tools used in fitting these models. This has led to a rich domain of different papers that each propose new techniques in this domain (I will write a review later, for now I suggest Fagiolo et al. 2019). The gist is that there are quite a few techniques out there, however, none has taken center stage and been applied consistently to medium and large models. Partially this is due to the difficulty of their replication and their computational expenses. One goal to doing this would be to develop a generalized programming package with which to build and analyse these models. In this manner these tools would all be available to researchers building new models.

I should note at this point that ABM aren't the only models that suffer from this hard track of identifiability, the orthodox Dynamic Stochastic General Equilibrium models too have a large number of parameters of shocks, which require creative means of fitting. Though the tools and techniques here are more developed than for ABM.

If the fit to the data isn't perfect, this begs the question: but what is the point of the ABM? At the moment, my belief aligns with that of my supervisors, namely that Agent-Based Models are scenario generators. That is, for a calibrated model, its purpose is to answer the question of what can happen? and why did it happen? In doing so, it is also a fertile ground for testing different fiscal and monetary policy regimes that may be unorthodox or hard to test in classic models. Forecasting with these models has potential (see Poledna et al. 2020). I believe that short-term point-forecasting can be left to the econometric literature, while long-term developments might be better studied with ABMs. In particular, once we capture a theory of institutional evolution.

What still needs to happen?

As I have suggested in this post, ABM is a very promising methodology for studying the economy because it allows us to capture interactions and heterogeneity of individual agents. We can start at the micro-level and observe what the resulting macroeconomic outcomes are. This in itself could then lead to a much more detailed study of how (1) interactions and information propagation affect the economy, and (2) how individual behavior actually aggregates.

Naturally, I am quite biased - I do study these models within my research....

I think there are several steps that are missing in creating a strong framework for ABM to move from a developing tool to a tool used consistently by researchers and policymakers alike

  • A concise framework for presenting Macro-ABM in a replicable manner - this includes having a consistent coding package or framework such that these models can also feasibly be compared
  • A strong method for comparing the ABM output to empirical time-series beyond stylized facts
  • An accepted framework for fitting the parameters of an ABM to observed time-series

These are all methodological considerations, that will allow ABM to answer the economic questions we face today on distribution, the green transition, the effectiveness of monetary policy, the effects and choices of fiscal policy, to name but a few.

Enjoying these posts? Subscribe for more