Models and Methods in Health Data Science

Lecture 5: Agent based models

Rachel Oughton

20/02/2023

1 Overview

In this lecture, we will cover

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

2 Agent based models

In this section:

Agent based models

Compartmental models think in terms of the population as a whole.

Agent based models (ABMs) model complex systems in terms of the interactions and behaviour of many many agents.


We will only touch on the functionality of ABMS, but

2.1 What is an ABM?

To quote Auchincloss and Diez Roux (2008),

Agent-based models are computer representations of systems consisting of a collection of discrete microentities agents interacting and changing over discrete time steps that give rise to macrosystems.”


An ABM agent is anything that changes how it behaves in response to input from the other agents and the environment.

Agents

Agents have rules that determine their behaviour and responses.


At each time step (‘tick’), the agents all re-evaluate their decisions/behaviour according to

This means ABMs can encode things like social norms or memes.

2.2 The elements of an agent-based model

Typically, an ABM has three elements:


For example, in a simple epidemiological model:

More complex ABMs

In a more detailed model different agents can have different behaviours such as


They can also be influenced by the behaviour and decisions of those around them.


This is not easily replicable in a compartmental model.

3 Replicating the SIR model in an ABM

In this section:

Replicating the SIR model in an ABM

Compartmental models assume mass action:
Each person in the system has a uniform influence on every other person.


We can see how this looks as an ABM.

Example: Mass action ABM 1

Example: Mass action ABM 2

Example: Mass action ABM 3

Example: Mass action ABM 4

Example: Mass action ABM time series

We find a similar pattern to our compartmental SIR models:

Random choices and whole numbers make the lines somewhat ‘wobbly’.

3.1 Why this example?

This was quite a silly example:

We have highlighted some of the shortfalls of the compartmental models and some of the modelling opportunities that agent-based models can introduce.


ABMs can incorporate some much more realistic behaviour.

3.2 Movement and proximity

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


Our next ABM example will start with people randomly spaced on a grid.


However this time,

NetLogo - turtles

For historical reasons, the agents in NetLogo models are called “turtles”. So when you see this in these notes, or in NetLogo code or interface, you can interpret it as “agents” or “person/people”.

4.2 ABM: Exercise

Think back to our compartmental SIR model, where we had \(R_0 = \frac{\beta}{\gamma}\).

How do these ABM parameters relate to \(\beta\) and \(\gamma\)?

5 Monitoring uncertainty

In this section:

Randomness in an ABM

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

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
List the parts of the ABM described above that are subject to randomness.

Randomness in ABMs

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

So \(\textbf{same input}\nRightarrow{\textbf{same output}}\).

5.1 BehaviourSpace

BehaviourSpace enables us to do repeated experiments in Netlogo, to assess uncertainty.


In BehaviourSpace we can specify

BehaviorSpace

BehaviorSpace data in R

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

Variation in height and location of the peak of infections, as well as the point at which the epidemic dies out.

Recovered count

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

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

6 Summary

In this lecture we have

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

7 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.