Agent Based Models in Mata

An Agent Based Model (ABM) is a simulation in which agents that each follow simple rules interact with one another and thus produce an often surprising outcome at the macro level. The purpose of an ABM is to explore mechanisms through which actions of the individual agents add up to a macro outcome by varying the rules that agents have to follow or varying with whom the agent can interact (for example, varying the network).

A simple example of an ABM is Schelling's segregation model, in which he showed that one does not need racists to produce segregated neighborhoods. The model starts with 25 red and 25 blue agents, each of which live in a cell of a chessboard. They can have up to 8 neighbors. In order for an agent to be happy, they need to have some, e.g. 30%, agents in the neighborhood of the same color. If the agent is unhappy, they will move to another empty cell that will make them happy. If we repeat this until everybody is happy or nobody can move, we will often end up with segregated neighborhoods.

Implementing a new ABM will always require programming, but a lot of the tasks will be similar across ABMs. For example, in many ABMs the agents live on a square grid (like a chessboard), and can only interact with their neighbors. I have created a set of Mata functions that will do those tasks, and someone can also import their own ABM. In this presentation, I will illustrate how to build an ABM in Mata with these functions.

The presentation