How to Build a Basic Epidemic Model

PDF Version of this Tutorial
  • Now let's infect some of the Turtles to start.

  • Let's get the agents to move around.

  • We will make infection happen when agents collide with each other.

  • Now we want to create a variable controlled by a slider that determines the probability of recovery after an agent gets infected.

  • In many populations some individuals start out with some immunity to a disease. We can easily model that here by giving some of the agents an attribute called "immunity." We will create a new variable for each agent that can be set to True if the agent is immune to the disease, and False if the turtle can get sick.

  • So just how would you know if there are fewer red agents than there were before? It would be useful to monitor this by showing the number of red agents while the simulation is running.

  • It would also be useful to see how the numbers of infected and healthy agents compare over time. You can analyze these numbers with a line graph.