Disease Dynamics (ABM)
- Create a new State named Healthy.
- Create a new State named Infected.
- Create a new State named Recovered.
- The model diagram should now look something like this:States represent the condition someone is in. So in our model a person can either be healthy, infected, or recovered from the infection. Now, lets add transitions that move a person from state to state.
- Create a new Transition going from the primitive Healthy to the primitive Infected. Name that transition Infection.
- Create a new Transition going from the primitive Infected to the primitive Recovered. Name that transition Recovery.
- The model diagram should now look something like this:Please note that in this model someone who is recovered cannot become sick again. They have gained immunity to the disease.
Now that the model structure has been designed, let's add equations and configure the primitives. - Change the Initial Active property of the primitive Healthy to true.When a state is active, it means a person is in that state. By setting Healthy to start true, we have the person start in the healthy state.
- Change the Trigger Type property of the primitive Infection to Probability.
- Change the Value/Equation property of the primitive Infection to 0.3.
- Change the Trigger Type property of the primitive Recovery to Probability.
- Change the Value/Equation property of the primitive Recovery to 0.2.Using the Probability type for the transition trigger means that the person has a fixed probability of transitioning from one state to the next each year.
- Run the model. Here are sample results:Don't worry if your results do not look exactly like this. This is a stochastic model so each time we run it, we will get different results. Let's give it a try.
- Run the model. Here are sample results:
- Run the model. Here are sample results:When a state takes on the value 1 it means the person is in the state. We can see how the person moves from healthy, to infected, to recovered in these three different simulation runs. Right now we are only simulating a single person. Let's extend our model to simulate a population of people.
- Create a new Folder named Person. The folder should surround the primitives Healthy, Infected, Recovered, Infection and Recovery.
- The model diagram should now look something like this:
- Change the Behavior property of the primitive Person to Agent.
- Create a new Agent Population named Population.
- Change the Agent Base property of the primitive Population to Person.
- The model diagram should now look something like this:
- Run the model. Here are sample results:That looks pretty good! We can see the disease gradually spread through our population of 100 people.
However, right now the probability of a person getting sick is independent of the other people in the model. Let's change the model so the more sick people there are, the higher the likelihood that a healthy person will become sick. - Create a new Variable named Percent Infected.
- Create a new Link going from the primitive Population to the primitive Percent Infected.
- Create a new Link going from the primitive Percent Infected to the primitive Infection.
- The model diagram should now look something like this:Now let's configure the value of Percent Infected and change the Infection transition to use it.
- Change the Equation property of the primitive Percent Infected to Count(FindState([Population], [Infected]))/PopulationSize([Population]).This equation uses the FindState function to select all the people in the Population primitive who are in the Infected state. It then divides the count of those people by the total size of the population.
- Change the Value/Equation property of the primitive Infection to [Percent Infected], and the Recalculate property of the primitive Infection to Yes.The Recalculate property causes the infection rate to be recalculated and updated at every time step of the simulation.
- Run the model. Here are sample results:Nothing happened because we don't have anyone to start the infection. Let's seed the model with a single initial infected person.
- Change the Initial Active property of the primitive Infected to Index(Self) == 1.
- Change the Initial Active property of the primitive Healthy to Index(Self) <> 1.Each of the people in the population is given an unique Index. The first agent will have an index of 1, the second an index of 2, and so on. Self always refers to the current agent. These equations will set the first agent created to start in the Infected state while all the other agents will start in the Healthy state.
- Run the model. Here are sample results:Since this is a stochastic model, each time you run it, you will get slightly different results. Let's give it a try.
- Run the model. Here are sample results:
- Run the model. Here are sample results:That works great! We now have a full Agent-Based Model of disease.
We can also configure the display type to be a map of the people in the model in a two-dimensional geography. Right now, people are placed randomly, but we could configure their locations or make them move around in response to different factors. We could also change the infection rate so the infection spread geographically. - Run the model. Here are sample results:
This tutorial describes how to construct a model of an infectious disease using Insight Maker. Agent-Based Modeling techniques are used in the construction of this model. Before starting the tutorial, make sure you have familiarized yourself with how to create primitives and run models.
No hay comentarios:
Publicar un comentario