12_biol_200_lab_12.Rmd
Notes:
Lab will meet in the A262 computer lab this week – across from Love Lounge.
We will be using the software program Vensim for this week’s lab.
Objectives:
Understand basic modeling concepts and terminology, and the role of model building in the scientific process.
Understand how stock and flow simulation models can be used to model system dynamics.
Gain experience building simple dynamic simulation models of population growth (with and without resource limitation) and interspecific interactions.
Understand the role that positive and negative feedback play in regulating system dynamics. Practice using causal loop diagrams to identify feedback interactions.
KEY WORDS: causal loop diagram; dynamic simluation model; exponential growth; feedback (positive and negative); flow; logistic growth; model; statistical model; stock; system dynamics
In the most general sense, a model can be defined as a simplified, abstract representation of reality that is designed to help explain and/or predict causal relationships in nature. The models we create in science are intentionally designed to contain the minimum degree of complexity necessary to address the questions and problems we seek to understand. We attempt to solve our question or problem in the modeling world and then interpret the implications of our findings in the real world.
Conceptual models. In conceptual models, assumed relationships are made explicit, often in the form of logical statements and diagrams that indicate relationships. Mechanistic hypotheses, theories, and maps of relationships among ecological components (for example, food webs) are all conceptual models. In this lab, you will gain experience with one type of conceptual model, causal loop diagrams, which are used to identify and understand the ways in which positive and negative feedback influence the interactions within systems.
Physical and biological models. The lab rat (Rattus norvegicus), the fruit fly (Drosophila melanogaster), and the plant thale cress Arabidopsis thaliana are good examples of organisms chosen as biological models for laboratory studies of physiology, genetics, or behavior. These organisms are relatively easy to maintain, breed, and manipulate in the lab. We assume that the results of many experiments on these organisms can be generalized to understand the processes occurring in natural populations of many other taxa. In ecology, we often construct simplified model ecosystems in the field or lab, like the experimental wetlands at Jones Farm, which are the ecological equivalent of the lab rat. Accurately translating findings from experiments conducted on biological models to the real world is an important and challenging part of the process.
Mathematical and computational models. These models are elaborations of conceptual models in which hypotheses and relationships between system components are expressed mathematically and are often analyzed using computers. The statistical models we have used in the past few weeks are examples of mathematical models.
In lab this week you will gain hands-on experience with another type of mathematical model, dynamic simulation models. These models are used to explore how and why system components change over time. We are typically interested in understanding how internal components of a system interact with each other and with the outside world in ways that generate the behavior or the system dynamics that we observe. The mechanisms associated with our hypotheses are built into the equations governing interactions in these models.
Simulation modeling can be thought of as a kind of experimentation. Just as with other types of experiments, discrepancies between the output of a simulation model and the behavior of the real world reveal gaps or inaccuracies in our understanding of the system dynamics. A simulation model that has been tested under a variety of conditions and accurately reproduces patterns observed in nature can, with great caution, be used to predict what might happen under new sets of conditions that have not yet been experienced. In many cases, dynamic simulation models provide the only means available for predicting the behavior of complex systems. For example, simulation models are essential tools for predicting the consequences of current human decisions on the future climate.
A “good” model is one that provides useful insight into the specific question or problem that it was designed to address. The modeling process should therefore always start with a well-defined question or problem.
Three key goals of experimental science (including modeling) are to achieve high degrees of control, realism, and generality. Control is the ability to manipulate an experimental system and to quantitatively and precisely relate cause and effect. Realism is the extent to which the knowledge we gain from our experiment or model world is directly translatable to the patterns and processes we are seeking to understand or manage in the real world. Generality is the range of different types of systems to which our experiment or model findings apply.
The tools we use to understand the real world must strike a balance between control, generality, and realism—it is usually difficult or impossible to maximize all three goals. For example, experiments conducted in whole natural ecosystems generally have a low degree of control, a high degree of realism and an intermediate level of generality. Computational models, on the other hand, provide a very high degree of control and often a high degree of generality. However, the realism of a computer model is constrained by the accuracy of the assumptions upon which the model is built. As we say, “garbage in, garbage out.” In this light, computational models are particularly useful for identifying gaps in our knowledge and deficiencies in our assumptions, thereby forcing us to revise our hypotheses.
Note that a given positive feedback loop can often operate in either expanding or contracting directions. For example, in the positive feedback loop shown in Figure 2 below, a pessimist might note that increasing CO2 leads to increasing temperature which leads to increasing decomposition of soil organic matter, which increases CO2 (positive feedback). Many climate scientists are concerned about the possibility that we may be reaching a tipping point in which this positive feedback loop kicks into high gear. At the same time, considering a compound feedback loop (Figure 3 below) that encompasses additional factors left out of the positive loop, we see that successful efforts to increase plant growth (perhaps through planting or fertilization) can potentially lead to decreased CO2, decreased temperature, and decreased decomposition, thereby reducing other sources of feedback (positive feedback, but in the direction of minimization).
In most living systems positive feedback is ultimately constrained by negative feedback. Feedback loops are almost always embedded in larger feedback loops. The dynamics we observe are, to some extent, controlled by the boundaries that exist in reality and in our models.
Start by brainstorming a list of variables associated with the phenomenon under consideration. Then, begin your causal loop diagram by selecting only those key system elements that are important and causally related to each other.
Arrows between variables are used to indicate the direction of causality. For instance, if you have two variables, “amount of coal burned” and “amount of acid rain generated” an arrow would be directed from the coal to the acid rain (i.e., the burning of coal affects the generation of acid rain). A causal loop is a set of variables that are connected with a complete circle of causality; tracing arrows in a forward direction eventually leads from one variable back to that same variable.
Points of arrows are labeled with a (\(+\)) or (\(-\)) sign to indicate positive or negative effect between the connected variables. For example, in X \(\rightarrow\) (\(+\)) Y , the (\(+\)) symbol means that change in X causes Y to change in the same direction (i.e., if X decreases, then this necessarily causes Y to decrease). Important: when labeling, consider each pair of variables connected by an individual arrow in isolation from all others (completely ignore all other variables and arrow connectors while you are labeling each pair).
Determine the overall sign of a feedback loop by counting the total number of (\(-\)) signs at the arrowheads within a complete loop of arrows. The loop is a positive feedback if there is an even number of (\(-\)) signs (or no \(-\) signs). The loop is a negative feedback if there is an odd number of (\(-\)) signs. Place a large (\(+\)) or (\(-\)) sign in the center of each loop to indicate the overall direction. Compound causal loops contain several interacting feedback loops, some of which may be positive and some of which may be negative.
Box or budget models are widely used to conceptualize a system as being composed of stocks, flows, additional variables, and feedback connections that control flows. A stock, also known as a “state variable” or “level”, is any system component that stores stuff. The “stuff” can be energy, materials, number of organisms, information, or anything that can accumulate or be depleted over time. Flows, also known as rate equations or differential equations, describe the movement of stuff into and out of stocks. With box models, a key aspect of the conceptualization process (Step 2 in model building, above) involves translating your understanding of causal relationships into a system of stocks and flows.
Stocks (or levels) are typically represented as boxes and flows (or rates) are represented as arrows that extend into and out of stocks to represent movement in (black arrowheads, for us) and movement out (no arrowhead). Thinner blue arrows indicate direct relationships among variables that control flows. In the conceptual model immediately below (Figure 4), the growth in the size of the POPULATION stock occurs via a Births inflow that is dependent on both the size of the POPULATION and the Depletion flow out of a RESOURCE stock. The Death flow out of the POPULATION is dependent only on the current size of POPULATION. The RESOURCE itself grows through a Regeneration flow and is consumed through a Depletion flow. By itself, this conceptual model tells us a good deal about dependencies and relationships among variables. The associated simulation model would include the specific equations controlling the flows into and out of the stocks.
Many phenomena can be understood in terms of stocks and flows. For example, the ecology of a wetland ecosystem is strongly influence by hydrology. So if we were creating a model to answer questions about wetland processes, we would likely want to model factors controlling water levels. Inflows might in-clude: direct precipitation, streamflow from its drainage basin, and groundwater inputs. Outflows might include evaporation from the water surface, transpiration from the leaves of plants, overflow to downstream ecosystems, and groundwater discharge. Different processes control each of these flows and are likely to change seasonally and as the ecosystem matures. For example, evaporation is influenced by air temperature, wind speed, and exposed water area. Transpiration (loss of water through the leaves) is influenced by these same factors, but is also controlled by the total leaf area which, in turn, is a function of season, plant type, and wetland age.
Approach: The best way to begin building a simulation model is to start with a minimum degree of complexity and to sequentially add more complex elements. The exercises below take this approach; we will start with a very simple model and then add features to represent a greater degree of ecological complexity. These models employ widely used formulas that can be combined to create much more sophisticated models.
How to maximize learning while building models: You will be introduced to the modeling software Vensim and will then be guided through the development of the models below. In order to maximize learning (and actually perform scientific inquiry), you must mentally simulate the model dynamics before you let the program run through the simulation. In this context, we mean actually sketching out on paper the pattern that you expect your model to produce, and it means talking through the rationale for your expectations with your group. The process of evaluating discrepancies between your expectations and the actual model output is what allows you to test your mechanistic understanding of the relationships in the model and thereby build new thinking skills. If you run a model before you have completely thought through potential behavior you will end up developing post-hoc (after-the-fact) explanations that do not meaningfully test, challenge, or advance your understanding. That is bad science!
Introduction to Vensim
Your instructor will give you an introduction to the features of Vensim and will show you how to begin building your models starting with this first model of a constant rate of inflow.
To start, find and open the Vensim PLE program (either look in the Applications/Programs folder or use the Search function). Once the program opens, click the New Model icon, which will open up a Model Settings window. We want to use the following values for Model Settings:
Model Settings | |
INITIAL TIME = | 0 |
FINAL TIME = | 100 |
TIME STEP = | 0.1 |
Units for Time | Day |
Once you verify those settings, click OK to close the window. Next, click the Save icon to give your model a name and save it. Let’s call this one “AConstant”. You can just save it to the desktop if you would like. For all of the following models, be sure to sketch out your predictions before running the model. For each model, use the pages provided in lab to sketch out what the graphical output will look like.
Background and question: It is sometimes the case that the flow into a stock is not dependent on the amount of stuff stored in that stock. What pattern of stock growth occurs when the flow into a stock is constant? An example is flow of water from a stream into a wetland that has no outlet; the existing volume of water does not affect the rate at which stream water flows into the wetland. Check out the conceptual model below. Now, before building the model in Vensim, predict what’s going to happen to the value of the Water in Wetland stock over time.
Conceptual model:
What to do: You will build the conceptual model pictured above, starting with the stock (level), then adding the flow (rate). Then insert the initial stock value and value for stream flow (see below). You will also add a graph to your model to view the output. Make sure you predict the pattern you expect to see over time in the value of Water in Wetland BEFORE you actually run the model. Then try to understand and explain discrepancies.
To create this model, click on the Level icon and then click in the middle of the open window. Name the new stock “Water in Wetland” and click Enter. Now add your flow by clicking the Rate icon, clicking about an inch to the left of your stock and then click on the Water in Wetland stock. The flow should appear, like in the image above, with a black arrow pointing into the stock.
Next, we need to set up starting values for our stock and for stream flow. To do that, we click on the Equations icon, which will highlight all the components of our model. Now click on Water in Wetland. A box pops up with parameters for this variable. Add the following into the appropriate spaces in this popup then do the same for Stream Flow.
INITIAL CONDITIONS OR EQUATIONS | ||
Variable | Initial value / Equation | Units |
---|---|---|
Water in Wetland | 10.0 | thousands of gallons |
Stream Flow | 0.1 | thousands of gallons per day |
Notice that in this case, our “equation” was just a constant value but in future we will enter equations into this box that involve the other variables in the model. Now, we are ready to run our model and view the results. To Run the model, click the Simulate icon. When you are asked whether to overwrite the current dataset, choose Yes. Now, view your results as a graph by clicking the Graph icon on the left sidebar. A graph will popup that shows how Water in Wetland changed over time (days). Does the output look like you predicted?
Comments: Flow equations describe the rate of inflow or outflow and are expressed in units of stock per time. So, in this case, since Water in Wetland has given units of thousands of gallons and we are interested in changes that occur over days, Stream Flow must be in units of thousands of gallons per day. A rate is the change in stuff per time. If our Water in Wetland stock were named W, we would write the complete inflow equation as \(\Delta W / \Delta t\) or \(dW / dt\) = Stream Flow.
To create our next model, let’s open a New Model, like we did for the first one. Fill in the options for Model Settings as in this table. Click OK when you are finished. Click Save and call this model “BTermites”.
Model Settings | |
INITIAL TIME = | 0 |
FINAL TIME = | 100 |
TIME STEP = | 0.1 |
Units for Time | Day |
Background and question: What pattern of stock growth occurs when the flow into a stock is proportional to the current size of the stock? Imagine that a colonizing group of termites have just invaded a downed tree in a forest (i.e., your second causal loop scenario). Assume that the supply of cellulose is unlimited over the period being modeled. Build the model depicted below, sketch and discuss your predictions, and then run the model.
What to do: Build the model as pictured, starting with the stock (level), then add the flow (rate), next the component variable (growth rate coef R), the add the arrows. To add variables that are neither stocks (levels) nor flows (rates), like the growth rate variable, click the Variable icon then click where you want to place it on the screen, and give it a name. To add arrows, click the Arrow icon, then click where you want the arrow to originate, then click where the arrow is pointing. You can also click intermediate points to make the arrow bend, if you like. Variables that have arrows pointing into them can use those connected variables in their equation.
Conceptual model:
After you build the model, remember next to add the equations, using the following settings.
INITIAL CONDITIONS AND EQUATIONS | ||
Variable | Initial value / Equation | Units |
---|---|---|
Termites | 10 | termites |
Growth rate coefficient R | 0.2 | per day |
Termite Births | Growth Rate Coefficient R*Termites | termites per day |
Now, click the Simulate icon to run the model. To see your results, click on the stock you want to graph and then click the Graph icon to see your results. Does the result match your prediction?
Create another new model named “CFiniteResource” and use the indicated model settings.
Model Settings | |
INITIAL TIME = | 0 |
FINAL TIME = | 100 |
TIME STEP = | 0.1 |
Units for Time | Day |
Background and question: What patterns are evident when a population grows on a finite resource that can be depleted but not replenished? To address this question, consider the same scenario as above, but now over a longer period in which the cellulose in the tree trunk is depleted by several generations of the voracious termites. Build the model that is described below.
Conceptual model:
Once you have set up the model, click the Equations icon and adjust each variable as in this table.
INITIAL CONDITIONS AND EQUATIONS | ||
Variable | Initial value / Equation | Units |
---|---|---|
Termites | 10 | termites |
Termite Biomass | 1000 | kilogram Carbon |
Eating Efficiency | 0.00024 | per termite per day |
Mortality | 0.15 | per day |
Termites per Biomass | 1.2 | termites per kilogram Carbon |
Eating | Termites*Tree Biomass*Eating Efficiency | kilogram Carbon per day |
Birth | Eating*Termites per Biomass | termites per day |
Death | Termites*Mortality | termites per day |
Finally, you are ready to run the model and view the graph. Click the Simulate icon. Now, to view the graph of what happens to the Termites stock over time, click Termites then click the Graph icon. Did you correctly predict the result?
Create a new model and name it “DLogistic”, with the model settings as in this table.
Model Settings | |
INITIAL TIME = | 0 |
FINAL TIME = | 100 |
TIME STEP = | 0.1 |
Units for Time | Day |
Background and question: How might a population respond to a situation in which there is a continuous but limited food supply? Imagine our termite population invades a mature forest that is in what ecologists call a “mosaic steady state” in which old trees are falling down and creating patches in which young trees mature. As a whole, the forest has a stable tree population with stable cohorts of trees at different ages (including fallen trees). Let’s assume that (1) termite activity does not disrupt this stability and (2) the rate at which trees fall creates a stable supply of termite food. In this model we will represent the food resources via a carrying capacity, K, as we discussed in class. The coefficient K the maximum number of termites that can be continuously supported by the supply of falling trees within the forest. The number of termites in our population is represented by the stock N and the net growth coefficient is R. Create the conceptual model pictured below and enter the values as in the table.
Conceptual model:
What to do: Build the model depicted above.
INITIAL CONDITIONS AND FLOW EQUATIONS | ||
Variable | Initial value / Equation | Units |
---|---|---|
N |
10 |
termites |
Net Growth |
R * N * (1 - (N / K)) |
termites per day |
R |
0.2 |
per day |
K |
1000 |
(what makes sense here?) |
To run your model, click Simulate. Then, click on N and click on Graph. Were your predictions correct?
Discussion: The model you have just constructed is one version of the “logistic growth equation”, a commonly used formulation for modeling populations growing on a renewable but limited resource. What value does the term (\(1 − (N/K)\)) approach when \(N << K\) (i.e. when the population is far below carrying capacity)? What about when \(N ≈ K\) (when the population is close to carrying capacity)? How does this transition affect the dynamics you observe? When ecologists discuss “r-selected” and “K-selected” species, the r and K terms come from this equation. Based on recent lectures, can you explain how these two life history strategies relate to the logistic growth equation? Discuss with your partner.
Create a new model and name it “EFoxHare”, with the model settings as in this table.
Model Settings | |
INITIAL TIME = | 0 |
FINAL TIME = | 100 |
TIME STEP = | 0.01 |
Units for Time | Month |
Background and question: Biologists have long been interested in understanding the cause of observed oscillations in predator and prey populations. The model in this scenario was independently developed by Alfred Lotka (1924) and Vito Volterra (1926). Both discovered that a relatively simple mathematical model is capable of producing the cyclical dynamics they observed. Since that time, several researchers have been able to reproduce these dynamics in laboratory experiments in which predator and prey species interact in a controlled environment where all external factors are held constant.
Consider a modeling world consisting solely of populations of one predator and one prey species (e.g., Fox F and Hare H). In this simple modeling world, the prey population is unconstrained by food resources. The only constraint preventing exponential growth of the Hare population is the existence of a Fox predator that consumes the Hare. In contrast to the Hare population, the Fox population has only one way of growing, which is by consuming Hare. As in the second termite model, Fox population growth is limited by a natural mortality loss term (exponential decay). The rate of Predation is a function of the size of both the predator and prey populations—the higher the number of each, the more they come into contact and the more Hare that get consumed.
Conceptual model:
What to do: Build the model depicted above.
INITIAL CONDITIONS AND FLOW EQUATIONS | |||
Variable | Value / Equation | Meaning | Units |
---|---|---|---|
Hare | 1500 | Stock, number of hares | hares per unit area |
Fox | 50 | Stock, number of foxes | foxes per unit area |
R Hare | 0.1 | Component, hare birth rate | per month |
H Mortality | 0.002 | Rate foxes predate hares | per fox per month |
F per H | 0.1 | Conversion of hares eaten to foxes | foxes per hare |
F Mortality | 0.2 | Fox mortality rate | foxes per month |
H Birth | R Hare*Hare | Flow, number hares born | hares per area per month |
Predation | H Mortality*Hare*Fox | Flow, hare mortalities due to predation | hares per area per month |
F Birth | F per H*Predation | Flow, number foxes born | foxes per area per month |
F Death | F Mortality*Fox | Flow, fox mortalities | foxes per area per month |
As before, once you have put in all the equations, click the Simulate icon to run your model. For graphing, we’ll do things a little differently because we want to graph multiple variables at the same time. First, we’ll make a graph of Fox and Hare stocks over time. Then we’ll make a second graph, known as a phase plot, of the two stocks against one another. Click on the Control Panel icon (top right) and then click the Graphs tab. Click New and fill out the box that opens following the first column of this table to create the time series graph. Then make a second graph, the phase plot.
SETTINGS FOR GRAPHS | ||
Name | Time Series | Phase Plot |
---|---|---|
Title |
Fox and Hare population growth over time |
Hare pop versus Fox pop |
X-Axis |
click Sel and Choose Fox |
|
First Variable |
click Sel and choose Fox |
click Sel and choose Hare |
Second Variable |
click Sel and choose Hare |
Once you have created the graphs, click on the Time series and then click Display. The graph will pop up. You can then click on Phase plot and Display to pop up the second graph – they may be on top of each other so drag one of them to the side so you can see both. Take a minute to consider what is going on in these plots… did the results match your prediction?
Create a new model and name it “FDisease”, with the model settings as in this table.
Model Settings | |
INITIAL TIME = | 0 |
FINAL TIME = | 100 |
TIME STEP = | 0.01 |
Units for Time | Day |
Background and question: A key attribute of the predator-prey model that you just built is that predation rate is dependent on the density of bothpredator and prey populations. There are many phenomena in the natural and social sciences in which a flow is proportional to the product of two interacting stocks. For example, populations experiencing the spread of an infectious disease often behave in this way. Imagine that a group of Oberlin students returns from fall break infected with a cold virus. Can simple interactions between susceptible and infected students explain the subsequent pattern of disease transmission within the Oberlin community? The rate at which infected individuals transmit the disease to susceptible individuals is controlled by the abundance of both groups and by a contact coefficient you’ll call “Beta”. Beta is analogous to the predation rate coefficient in the predator-prey model.
Conceptual model:
What to do: Start with the conceptual model containing the components described below. For the sake of simplicity, this model assumes that as soon as susceptible people become infected they are contagious and they remain contagious until they become (temporarily) immune. As in your predator-prey model, graph the two stocks against time (time series graph), but also create a phase plot of Infecteds versus Susceptibles. For the sake of simplicity, consider this a closed system.
INITIAL CONDITIONS AND FLOW EQUATIONS | ||
Variable | Initial value / Equation | Units |
---|---|---|
Infecteds | 20 | people |
Susceptibles | 1000 | people |
Temporarily Immune | 0 | people |
Beta | 0.002 | per people per day |
Immunity Coefficient | 0.9 | per day |
Loss of Immunity Coefficient | 0 (initially, then 0.05) | per day |
Becoming Infected | Beta*Susceptibles*Infecteds | people per day |
Becoming Immune | Infecteds*Immunity Coefficient | people per day |
Becoming Susceptible | Temporarily Immune*Loss of Immunity Coefficient | people per day |
Run the model by clicking Simluate. To make your graphs, go to Control Panel and then Custom Graphs, as in the last model. Set up two new graphs with settings as below.
SETTINGS FOR GRAPHS | ||
Name | Time Series | Phase Plot |
---|---|---|
Title |
Disease Transmission Over Time |
Susceptible pop versus Infected pop |
X-Axis |
click Sel and Choose Susceptibles |
|
First Variable |
click Sel and choose Susceptibles |
click Sel and choose Infecteds |
Second Variable |
click Sel and choose Infecteds |
First run the model so that immunity is permanent (“Loss of Immunity Coefficient” = 0). After you have predicted dynamics, run the model, and revise your understanding. With that new understanding, consider what will happen if you change “Loss of Immunity Coefficient” to 0.05? Predict the result then edit Equations again to make “Loss of Immunity Coefficient” be 0.05. Rerun the model, check your graphs, and explain. Did you correctly predict the outcomes?
Please read Sections 1 Background and 2 Box Models: Learning to Think in Stocks and Flows before answering the questions below.
Build the following practice causal loop models. For each of the following, insert arrows and signs for causal loops between the variable pairs for each scenario below. Use the procedures described above in Section 1 Background to label the whole loop as either (\(+\)) or (\(-\)):
( a ) |
Money in a bank account (bank balance) and how much |
Bank balance
|
( b ) |
A colonizing group of termites have just invaded a downed |
Termite population
|
( c ) |
Consider the scenario above, but now over a longer period |
Termite population
|
( d ) |
Consider a predator and prey population composed of |
Fox population
|
Next, consider the causal loop diagrams you created above and draw a rectangle around each of the variables below that is a stock and circle those that are flows (rates). Refer to section 2 Box Models: Learning to Think in Stocks and Flows for instructions.
( a ) |
Bank balance |
Interest |
( b ) |
Termite population |
Births |
( c ) |
Termite population |
Tree Biomass |
( d ) |
Foxes |
Hares |