Difference between revisions of "Modeling 101"

From Numerus
Jump to navigation Jump to search
 
(4 intermediate revisions by the same user not shown)
Line 12: Line 12:
Another goal of modeling can be to test a hypothesis. This is because what a model fails to predict can be just as revealing as what it does. If the model of a system behaves differently than the real data it is compared too, this means that our understanding of the model is incomplete. As an example, a model indicates that the prey population should be stable but the data indicates it is plummeting. This could indicate many things, whether a predator or disease or lowered birthrate. But clearly there is something strange going on that requires investigation.
Another goal of modeling can be to test a hypothesis. This is because what a model fails to predict can be just as revealing as what it does. If the model of a system behaves differently than the real data it is compared too, this means that our understanding of the model is incomplete. As an example, a model indicates that the prey population should be stable but the data indicates it is plummeting. This could indicate many things, whether a predator or disease or lowered birthrate. But clearly there is something strange going on that requires investigation.


Hopefully this brief introduction to the field of Computation Modeling has given you a sense of it's versatility and applicability. The rest of this introduction will focus on the three primary specialties of NumerusMB: Dynamical Systems Models, Spatial Models, and Network Models.  
Hopefully this brief introduction to the field of Computation Modeling has given you a sense of it's versatility and applicability. The rest of this introduction will focus on the three primary specialties of Numerus: Dynamical Systems Models, Spatial Models, Agent-based Models, and Network Models.


==Dynamical System Models==
==Dynamical System Models==
Dynamical system models represent systems that change over time. Typical examples include a population of organisms, the flow of money in the economy, or a manufacturing process. What each of these diverse ‘systems’ have in common is that they change over time.
Dynamical system models represent systems that change over time. Typical examples include a population of organisms, the flow of money in the economy, or a manufacturing process. What each of these diverse ‘systems’ have in common is that they change over time.


At the heart of a dynamical system model is a set of rules and equations that reflect how the system changes in a particular instant. By rendering these rules in a simulation program like NumerusMB and letting it run, you can see how these momentary changes lead the system to develop.
At the heart of a dynamical system model is a set of rules and equations that reflect how the system changes in a particular instant. By rendering these rules in a simulation program like Numerus and letting it run, you can see how these momentary changes lead the system to develop.


===Goals of Developing Dynamical Systems Models===
===Goals of Developing Dynamical Systems Models===
Dynamical Systems Models are used to describe when something you are measuring moves from one place to another, or transforms from one thing to something else. This may be modelling the flow of Carbon between various reservoirs, or it may be modeling the different cohorts in a population as they age. It can even represent the flow between sick and infected populations. The key point is that you have a measurable quantity being shuffled between categories without being lost in the transfer.
Dynamical Systems Models are used to describe when something you are measuring moves from one place to another, or transforms from one thing to something else. This may be modelling the flow of Carbon between various reservoirs, or it may be modeling the different cohorts in a population as they age. It can even represent the flow between sick and infected populations. The key point is that you have a measurable quantity being shuffled between categories without being lost in the transfer.
===Dynamical Systems Models in NumerusMB===
In NumerusMD we use the Stock and Flow objects. Stocks represent a pool of what we are measuring: infected population, nitrogen in lake water, and so on. Flows represent the movement of what we are measuring from one stock to another. This would be the flow of people from uninfected to infected population, or nitrogen from lake water to the algae population. Flows can also represent a source or sink of our measured quantity. A Source flow could represent immigration and births adding people, while a Sink flow would could represent people's deaths. Similarly a Source for nitrogen could represent runoff from farmland.


==Spatial Models==
==Spatial Models==
Line 30: Line 27:
===Goals of Developing Spatial Models===
===Goals of Developing Spatial Models===
Spatial models are, obviously enough, used for studying the behavior of entire landscapes. They can address the population density of a city, and misbehavior in a classroom, or the interaction between plant cover rainfall and wildfire. However it is important to note that the landscape can be metaphorical. The key requirement for a Spatial Model is simply that each cell has a fixed distance from each by some metric, and that the cells interact with each other. A Spatial Model can also provide critical context for an Agent Based model. In a model of honeybee behavior and pollination, for example, the bee agents will have a direct impact on the landscape and vice versa.
Spatial models are, obviously enough, used for studying the behavior of entire landscapes. They can address the population density of a city, and misbehavior in a classroom, or the interaction between plant cover rainfall and wildfire. However it is important to note that the landscape can be metaphorical. The key requirement for a Spatial Model is simply that each cell has a fixed distance from each by some metric, and that the cells interact with each other. A Spatial Model can also provide critical context for an Agent Based model. In a model of honeybee behavior and pollination, for example, the bee agents will have a direct impact on the landscape and vice versa.
===Spatial Models in NumerusMB===
Spatial models in NumerusMB use a CellMatrix to represent the landscape of the simulation. The Cell is the fundamental unit of analysis. A CellMatrix maintains an array of cells in either a Cartesian or Hexagonal lattice topology, in which individual cells are aware of both their location and their neighborhoods. Conway's Game of Life [citation] is an example of such a model, with the cells “alive” and “dead” depending on the state of each individual cell's neighbors. Each cell's behavior is individually programmed as a Capsule, which is then assigned to the CellMatrix.


==Agent Based Models==
==Agent Based Models==
Agent based models study the interaction of objects in space. Agents are objects with a specific set of rules, and can represent anything from ants to grains of sand. They move and interact in a simulated region of space. The interaction between the Agents, and sometimes their interaction with the landscape, are the core of this field. In some ways an Agent Based model is similar to Spatial Model, but unlike a Cell an Agent has no neighbors and it's position is not fixed.
Agent based models study the interaction of objects in space. Agents are objects with a specific set of rules, and can represent anything from ants to grains of sand. They move and interact in a simulated region of space. The interaction between the Agents, and sometimes their interaction with the landscape, are the core of this field. In some ways an Agent Based model is similar to Spatial Model, but unlike a Cell an Agent has no neighbors and it's position is not fixed.


Agent Based Models are a useful tool for describing how complex behavior emerges from the interactions of the individual components. The classic agent based model is a flock of birds organizing itself based on the simple rules followed by each agent. NumerusMB includes a number of examples including the Game of Life, the SIR model, and Antz.
Agent Based Models are a useful tool for describing how complex behavior emerges from the interactions of the individual components. The classic agent based model is a flock of birds organizing itself based on the simple rules followed by each agent. Numerus includes a number of examples including the SIR model, and Antz.


===Advantages and Disadvantages===
===Advantages and Disadvantages===
Agent Based Models are a tool, and like any tool they are better at solving some problems and worse at solving others. They tend to be a bit harder both conceptually and practically to put together, since they have more components to them than simple analytical models. Despite this, however, they generally require a smaller base of knowledge about the system that someone is trying to model. It is easy, for example, to know that someone who is sick has a certain probability of infecting someone they interact with. It is more difficult to come up with an equation to demonstrate the rate at which someone infects other people without knowing how often they interact, how contagious they are, and whether or not people they interact with are susceptible to infection or not. In this situation, it makes sense simulate a spatial dimension in order to make up for information that is not necessarily obvious. Another situation in which agent based models shine is large systems whose group behavior is important. In the flocking model discussed above, the individual behavior of the birds is meaningless and even distracting. But when seen in the context of the larger group, important trends appear from the noise that define the model's behavior.
Agent Based Models are a tool, and like any tool they are better at solving some problems and worse at solving others. They tend to be a bit harder both conceptually and practically to put together, since they have more components to them than simple analytical models. Despite this, however, they generally require a smaller base of knowledge about the system that someone is trying to model. It is easy, for example, to know that someone who is sick has a certain probability of infecting someone they interact with. It is more difficult to come up with an equation to demonstrate the rate at which someone infects other people without knowing how often they interact, how contagious they are, and whether or not people they interact with are susceptible to infection or not. In this situation, it makes sense simulate a spatial dimension in order to make up for information that is not necessarily obvious. Another situation in which agent based models shine is large systems whose group behavior is important. In the flocking model discussed above, the individual behavior of the birds is meaningless and even distracting. But when seen in the context of the larger group, important trends appear from the noise that define the model's behavior.
===Agent Based Models in NumerusMB===
Agent based models in NumerusMB are models that make use of an AgentVector. The AgentVector contains the population of Agents, as well as their location. In addition, NumerusMB includes Simworlds and Networlds. A SimWorld combines an AgentVector with a CellMatrix that provides a landscape. The Networld component uses a NodeNetwork for the same purpose.  The ''SIR'' model is an example of an agent vector, with agents moving about an open space in three possible states, Susceptible, Infected, and Recovered. The ''Antz'' model is a more complicated model that uses both an agent vector and a cell matrix in order to simulate how ants collect food and leave a path for other ants to follow in order to find the same food.
NumerusMB has a lot of tools that make agent based models simpler and more robust. In particular, it is very easy to have access to all agents and cells from each individual agent, and to incorporate a wide variety of local and global effects. It also makes it simple to set up multiple Sim Worlds in order to see various outcomes simultaneously. It is also built on arrays and methods, which makes it simple to work on a small level to tweak the model to the user’s liking. On the other hand, the visual side of NumerusMB makes it so that it is easy to quickly and efficiently set up the shell of an agent based model and immediately get down to the more important details involved in the model. A savvy NumerusMB programmer will begin an agent based model visually and slowly transition over to handling the methods and functions in a more programming heavy reference frame.


==Network Based Models==
==Network Based Models==


===Goals of Development Network Based Models===
===Goals of Development Network Based Models===
===Network Based Models in NumerusMB===


==Basic Model Design in Numerus==
==Basic Model Design in Numerus==
Click [[Basic Model Design in Numerus|here]] to see how these concepts are implemented in Numerus.
Click [[Modeling in Numerus|here]] to see how these concepts are implemented in Numerus.

Latest revision as of 18:19, 28 January 2018

The Fundamentals of Computational Modeling

Ultimately, everyone in the world is a modeler. We simply do not always realize it. To exist in the world, to try to understand a system, is to develop a model. Whether your model is that a ball will fall when you release it or a prediction of what your friend will like for their birthday, developing models of how the world behaves is fundamental to how humans approach the world.

Computational modeling, then, is simply a process of formalizing these models and translating them to mathematics. This is done through reducing a complex system to individual components that can be understood. Virtually any system can be addressed this way. The demographics of a population, the movements of flocks of birds, or the spread of a forest fire are all relatively simple to model. It can even address more complicated issues, such as interpersonal interactions or the movements of crowds. Through the use of equations, and the rapid calculation speeds of computers, we can use computational modeling to study the evolution of a system over time. Computational modeling is a vast field, and an introduction such as this can only scratch the surface. But hopefully this brief introduction will give you an idea of the possibilities, and provide a starting point for going forward.

Fundamental to any model is an abstraction of the parts of the ‘system’. Choosing the appropriate level of abstraction is very important. For example, if we are building a population model of honey bees, should the entire population be stored in a single number or should they be divided by age class? What processes, such as birth and death, should be included in the model, and which ones can be ignored? These are the types of decisions modelers have to make.

In general, it is best practice to make the model as abstract as possible while still getting meaningful results. There are two primary reasons, the first being a simple matter of conserving processing power. But more importantly, aggressively simplifying the model also simplifies analysis. It is the classic issue of the map and the territory. As the map becomes more detailed it also becomes harder to interpret, until the map and the territory become indistinguishable: perfectly accurate and perfectly useless. The art of modeling is in choosing the necessary level of detail to answer the question being asked.

When choosing the level of abstraction, it is important to remember that the goal of a model is not necessarily prediction. Prediction is certainly desirable, but not all systems are simple enough to be predicted exactly. Error will always creep in, whether from subtle missing factors or uncertainty in raw data. But this does not mean modeling these systems is useless. Even though specific outcomes will always come with uncertainty, models can tell us about sensitivity: which factors are important in the outcome. Modeling can also show where we are likely to see equilibrium points, and whether they will be stable or unstable. This can help answer very practical questions. Consider a model of a disease. Is the disease going to die out by itself or is it likely to explode? Are we better off trying to vaccinate people against it, or should we improve detection and treatment? What percentage of the population must be vulnerable to produce an outbreak? And given what we know, what are the most likely scenarios to plan for? These critical questions are precisely what computational modeling is designed to answer.

Another goal of modeling can be to test a hypothesis. This is because what a model fails to predict can be just as revealing as what it does. If the model of a system behaves differently than the real data it is compared too, this means that our understanding of the model is incomplete. As an example, a model indicates that the prey population should be stable but the data indicates it is plummeting. This could indicate many things, whether a predator or disease or lowered birthrate. But clearly there is something strange going on that requires investigation.

Hopefully this brief introduction to the field of Computation Modeling has given you a sense of it's versatility and applicability. The rest of this introduction will focus on the three primary specialties of Numerus: Dynamical Systems Models, Spatial Models, Agent-based Models, and Network Models.

Dynamical System Models

Dynamical system models represent systems that change over time. Typical examples include a population of organisms, the flow of money in the economy, or a manufacturing process. What each of these diverse ‘systems’ have in common is that they change over time.

At the heart of a dynamical system model is a set of rules and equations that reflect how the system changes in a particular instant. By rendering these rules in a simulation program like Numerus and letting it run, you can see how these momentary changes lead the system to develop.

Goals of Developing Dynamical Systems Models

Dynamical Systems Models are used to describe when something you are measuring moves from one place to another, or transforms from one thing to something else. This may be modelling the flow of Carbon between various reservoirs, or it may be modeling the different cohorts in a population as they age. It can even represent the flow between sick and infected populations. The key point is that you have a measurable quantity being shuffled between categories without being lost in the transfer.

Spatial Models

Spatial Models simply represent the behavior of a virtual landscape. The landscape is composed of cells, which can be thought of like pixels. They are the resolution with which we will study the processes of the landscape. As always when modeling, it is best to pick the broadest resolution that will answer your questions. Spatial models can also be combined with Agent Based models, to represent the interaction between the mobile agents and the landscape they inhabit.

Goals of Developing Spatial Models

Spatial models are, obviously enough, used for studying the behavior of entire landscapes. They can address the population density of a city, and misbehavior in a classroom, or the interaction between plant cover rainfall and wildfire. However it is important to note that the landscape can be metaphorical. The key requirement for a Spatial Model is simply that each cell has a fixed distance from each by some metric, and that the cells interact with each other. A Spatial Model can also provide critical context for an Agent Based model. In a model of honeybee behavior and pollination, for example, the bee agents will have a direct impact on the landscape and vice versa.

Agent Based Models

Agent based models study the interaction of objects in space. Agents are objects with a specific set of rules, and can represent anything from ants to grains of sand. They move and interact in a simulated region of space. The interaction between the Agents, and sometimes their interaction with the landscape, are the core of this field. In some ways an Agent Based model is similar to Spatial Model, but unlike a Cell an Agent has no neighbors and it's position is not fixed.

Agent Based Models are a useful tool for describing how complex behavior emerges from the interactions of the individual components. The classic agent based model is a flock of birds organizing itself based on the simple rules followed by each agent. Numerus includes a number of examples including the SIR model, and Antz.

Advantages and Disadvantages

Agent Based Models are a tool, and like any tool they are better at solving some problems and worse at solving others. They tend to be a bit harder both conceptually and practically to put together, since they have more components to them than simple analytical models. Despite this, however, they generally require a smaller base of knowledge about the system that someone is trying to model. It is easy, for example, to know that someone who is sick has a certain probability of infecting someone they interact with. It is more difficult to come up with an equation to demonstrate the rate at which someone infects other people without knowing how often they interact, how contagious they are, and whether or not people they interact with are susceptible to infection or not. In this situation, it makes sense simulate a spatial dimension in order to make up for information that is not necessarily obvious. Another situation in which agent based models shine is large systems whose group behavior is important. In the flocking model discussed above, the individual behavior of the birds is meaningless and even distracting. But when seen in the context of the larger group, important trends appear from the noise that define the model's behavior.

Network Based Models

Goals of Development Network Based Models

Basic Model Design in Numerus

Click here to see how these concepts are implemented in Numerus.