Building and Understanding Individual Based Models to Inform Health Policy

Welcome to this tutorial to help you self-learn how to build individual-based models to inform health policy. This is intended to be an accessible introduction which requires no existing knowledge.

What is an Individual-based Model?

Each time the model program is run it generates values of variables that represent the characteristics of individuals and simulates how these change over time. By building a model that accurately reflects real changes in people over time, we can evaluate the potential effects of a policy of introducing a health intervention.

Here is a video describing individual-based models to inform health care policy:

(You don’t need to have watched this video to get started on the tutorial!)

Get started

We will use a programming language called Python. We will use Google Colaboratory (“Colab”) which is a website which makes it easy to get started.

The links to click for all the content are below.

You may want to watch this very brief video that shows you what to expect when you click on the first link.

Building an individual-based model

  • Part 1: Introduction to Colab, time steps, variables, print function, range function, “for” loops. [Start]

  • Part 2: Python dictionaries, accessing and updating dictionaries [Start]

  • Part 3: Time step loop, population loop, combining loops and using dictionaries [Start]

  • Part 4: Generating random numbers/ages, round function, “if” statements, updating variable values, the first time step, all other time steps [Start]

  • Part 5: Random choice method, pandas and using tables, using probabilities, “else” statements [Start]

  • Part 6: Adding body mass index (BMI), “elif” statements, creating and calling a function, docstrings [Start]

  • Part 7: Refactoring updating rules into functions [Start]

  • Part 8: Visualizing changes in variable distribution over time, matplotlib and pyplot, values method [Start]

  • Part 9: Adding blood pressure, ordering and data selection, append method [Start]

  • Part 10: Adding mortality, age-specific death rate, booleans, integrating deaths into the model [Start]

  • Part 11: CVD death risk, the math.exp method, adding cause of death, “None” keyword [Start]

  • Part 12: Life years (person-years at risk), CVD death rate, simulating health policy intervention [Start]

  • Part 13: Adding time of death, running model with intervention, comparing results between groups [Start]

Building a transmission model

  • Part 14: Introduction and breakdown of new model structure [Start]

  • Part 15: Exercise: Adding vaccination variable to the new model [Start]

  • Part 16: Adding interactions to the model, the random sample method [Start]

  • Part 17: Adding infection variables to the model (Section 1) [Start]

  • Part 18: Adding infection variables to the model (Section 2) [Start]

  • Part 19: Finalizing our basic transmission model [Start]


This content was created by George Phillips, Loveleen Bansi-Matharu and Andrew Phillips.

Suggested Citation

Phillips G, Bansi-Matharu, Phillips AN. (2024) Building and Understanding Individual Based Models to Inform Health Policy. Available on