1 Overview

In this lecture we will look at another way of modelling infectious diseases: the agent-based model (ABM).

  • What is an agent-based model?
  • How can we use ABMs to model infectious diseases?
  • NetLogo - a tool for developing and running ABMs
  • Monitoring uncertainty in ABMs

We will also focus on ABMs and NetLogo in workshop 3.

2 Agent based models

We focussed on compartmental models, which think in terms of the population as a whole. We will now look at agent based models (ABMs), which model complex systems in terms of the interactions and behaviour of many many agents. Three useful and interesting papers on this topic are Auchincloss and Diez Roux (2008), Hunter, Mac Namee, and Kelleher (2017) and Badham et al. (2018). Jen Badham has also written a fantistically helpful guide to NetLogo, which you can find here.

ABMs are a relatively new, but widely used, class of models that attempt to understand the macro-effects arising from micro-behaviour. They simulate the behaviour and interactions of individuals, according to a set of pre-defined rules, and are particularly suited to situations where the general theoretical models don’t account for human behaviour (see Buchanan 2008 for an economics example), and for situations where place / proximity / relationship is important.

2.1 What is an ABM?

To quote Auchincloss and Diez Roux (2008), “Agent-based models are computer represenations of systems consisting of a collection of discrete microentities [agents] interacting and changing over discrete time steps that give rise to macrosystems.”

An agent in an ABM is anything that changes how it behaves in response to input from the other agents and the environment. In the ABMs we study and develop, the agents will usually be people. Agents are given rules that determine their behaviour and their response to what is happening in the system. At each time step, the agents all re-evaluate their decisions/behaviour according to the state of all the other agents, and the environment they find themselves in. One of the big advantages of ABMs is that they can encode things like social norms or memes.

We will use NetLogo to simulate ABMs. You can either download this here and run it locally, or use the web version, or load it through AppsAnywhere on a university machine.

2.2 The elements of an agent-based model

Typically, an ABM has three elements:

  • A set of agents, with attributes and rules governing their behaviours
  • A set of agent relationships and rules about how agents interact. This concerns the arrangement and connectedness of the agents.
  • The agents’ environment. As well as interacting with one another, agents can also interact with their environment.

For example, in a simple epidemiological model, agents might be labelled with attributes such as ‘susceptible’, ‘infectious’ or ‘recovered’/‘removed’. If a susceptible agent comes into close contact (what this means will need to be defined in the model) with an infectious agent, they may become infected.

In a more detailed model, different agents can have different behaviours such a whether (or to what extent) they will self-isolate, whether they will wear a mask, or how much they move around. These factors would affect things like how often an agent comes into contact with other agents, or how likely they are to become infected if in contact with an infectious agent. They can also be influenced by the behaviour and decisions of those around them. This gives modellers a lot of functionality that is not easily replicable in a compartmental model.

3 Replicating the SIR model in an ABM

When we discussed the limitations of SIR models in lectures 1 and 2, one of the things we thought about was the assumption of mass action, that is that each person in the system has a uniform influence on every other person. In an ABM, the agents are arranged in space, and so it is natural that the extent to which to agents influence one another depends in some way on the distance between them. We will explore this idea now.

During this lecture and the following workshop, we will see several different types of plot. One of these is of the agents arranged in 2D space.

Agents arranged at random in 2D space. One is infectious.

Figure 3.1: Agents arranged at random in 2D space. One is infectious.

In Figure 3.1 we see 100 points (representing 100 agents) arranged randomly in 2D space. This represents the first time point in our model, where we have one infectious person (or agent) in a population of otherwise susceptible people (or agents). In this model the

Assuming mass action, every other person in the grid has an equal probability of being infected by this one person at time point 2 (let’s say this is 1/50). At time step 2, our plot will therefore look something like Figure 3.2.

The same agents, at the following time step.

Figure 3.2: The same agents, at the following time step.

We see that another person has become infected by the initial infectious person. In line with the mass action assumption of the SIR models, every person (or agent) has an equal effect on every other person, and so the people who are newly infected were chosen (by the computer) at random. Note that in this model the agents aren’t moving at all, so that we can easily see which agent is which. When we go on to look at ABMs in NetLogo, we will explore different types of movement.

Now that there are two infectious people, the probability of each susceptible person becoming infected is higher, and indeed in Figure ??} we now have five infectious people, and fourteen at time point 4.
The same agents, at the following time step.

Figure 3.3: The same agents, at the following time step.

The same agents, at the following time step.

Figure 3.4: The same agents, at the following time step.

We can plot the time series of Susceptible, Infectious and Recovered people through the epidemic as we did in lectures 1 and 2 with the SIR model, and we find the pattern to be similar.

The populations of the three States over the course of the epidemic

Figure 3.5: The populations of the three States over the course of the epidemic

You can see that this looks very similar to the SIR model plots we saw in Lecture 1. Because the ABM relies on random choices (eg. an agent has a probability of being infected) and the model works in whole numbers of agents, the lines are somewhat ‘wibbly’.

3.1 Why this example?

In many ways this example was rather silly - people aren’t randomly spaced on a 2D plane, and they don’t have equal probability of being infected by anyone else in that space. However, this has highlighted some of the shortfalls of the compartmental models that treat the population as one homogeneous mass, and some of the modelling opportunities that agent-based models can introduce. By starting from the ground up, with individual people as agents, we can incorporate some much more realistic behaviour.

3.2 Movement and proximity

The first things we’ll tackle are movement and proximity:

  • Movement - people don’t stay in one place, but move around.
  • Proximity - I am ony likely to be infected if I’m near someone infectious.

This model will start in the same way as before, with 100 people randomly spaced on a grid. However this time, people can move a little at each time step, and can only be infected if there is someone infectious nearby.

5 Monitoring uncertainty

One feature of agent-based models as we have described them is that they are stochastic.

Definition 5.1 A stochastic model is one which, due to inherent uncertainty, will not always return the same output given the same input variables.

This is because many of the stages of the model are performed using random number generation.

Exercise 5.1 List the parts of the ABM described above that are subject to randomness.

Some of the events that are subject to random chance in the model we have looked at are:

  • The initial placement of the turtles
  • The movements each turtle makes at each time
  • Which turtles are exposed (if transmission isn’t local)
  • Whether or not each exposed turtle is infected
  • How long it takes an infected turtle to recover

Thus, running the model with the same input values (by which we mean those chosen using the sliders on the ‘Interface’ panel) many times will result in different outcomes.

5.1 BehaviourSpace

NetLogo provides a way for us to do this, in ‘Tools -> BehaviourSpace’. Here, we can specify the value(s) for each parameter, and how many repetitions we would like of each. We can also specify the variables we wish to monitor.

The BehaviourSpace window.

Figure 5.1: The BehaviourSpace window.

For the experiment set up in Figure 5.1, where we are running the experiment for the same input values 30 times, and monitoring the number of Infected and Recovered turtles, we find the following.

The count of infected turtles over time for 50 ABM runs with the same input values.

Figure 5.2: The count of infected turtles over time for 50 ABM runs with the same input values.

As you can see in Figure 5.2, there is some variation in the height and location of the peak of infections, as well as the point at which the epidemic dies out (you can see these locations by the small ticks on the x-axis as the lines reach zero). This variation is due entirely to the randomness inherent in the model, since each of these 50 runs had the same input parameter values. We can also plot the number of recovered turtles, as in 5.3.

The count of recovered turtles over time for 50 ABM runs with the same input values.

Figure 5.3: The count of recovered turtles over time for 50 ABM runs with the same input values.

Exercise 5.2 Which of these plots do you think would be the most useful in a public health setting?

6 Summary

In this lecture we have

  • Introduced agent based models
  • Walked through a simple epidemic ABM in NetLogo
  • Looked at uncertainty through repeated experiments

In the workshop you will have the opportunity to look into ABMs in more detail, and to experiment with the parameters.

References

Auchincloss, Amy H, and Ana V Diez Roux. 2008. “A New Tool for Epidemiology: The Usefulness of Dynamic-Agent Models in Understanding Place Effects on Health.” American Journal of Epidemiology 168 (1): 1–8.
Badham, Jennifer, Edmund Chattoe-Brown, Nigel Gilbert, Zaid Chalabi, Frank Kee, and Ruth F Hunter. 2018. “Developing Agent-Based Models of Complex Health Behaviour.” Health & Place 54: 170–77.
Buchanan, Mark. 2008. “This Economy Does Not Compute.” New York Times 1: 2008.
Hunter, Elizabeth, Brian Mac Namee, and John D Kelleher. 2017. “A Taxonomy for Agent-Based Models in Human Infectious Disease Epidemiology.” Journal of Artificial Societies and Social Simulation 20 (3).