In Silico Experimentation

M. Drew LaMar
March 20, 2019

Learning Objectives for Chapter 8

  • Develop an understanding of what makes the results of ABMs more vs. less emergent, by looking at two of NetLogo's library models (subtle).
  • Start using the most important techniques in agent-based science: designing and analyzing simulation experiments to test hypotheses and develop understanding about how an ABM works and how well it reproduces the system it models (concrete).
  • Master the use of BehaviorSpace, NetLogo's extremely useful tool for automatically running simulation experiments and producing output from them (concrete).
  • For the first of many times, analyze output produced by NetLogo models by importing results to other software for graphing and statistical analysis (concrete).

Learning Objectives for Chapter 8

  • Develop an understanding of what makes the results of ABMs more vs. less emergent, by looking at two of NetLogo's library models (subtle).
  • Start using the most important techniques in agent-based science: designing and analyzing simulation experiments to test hypotheses and develop understanding about how an ABM works and how well it reproduces the system it models (concrete).
  • Master the use of BehaviorSpace, NetLogo's extremely useful tool for automatically running simulation experiments and producing output from them (concrete).
  • For the first of many times, analyze output produced by NetLogo models by importing results to other software for graphing and statistical analysis (concrete).

Emergence

From

local agent rules and behavior

to

emergent system-level dynamics

Emergence

Question #1: What dynamics of the system and what model outcomes emerge - arise in relatively complex and unpredictable ways - from what behaviors of the agents and what characteristics of their environment?

Question #2: What other model dynamics and outcomes are instead imposed - forced to occur in direct and predictable ways - by the model’s assumptions?

Qualitative Criteria for Emergence

  • Emergent phenomenon is not simply the sum of the properties of the model's individuals (nonlinear),
  • Emergent phenomenon is a different type of result than individual-level properties (system-level), and
  • Emergent phenomenon cannot easily be predicted from the properties of the individuals (complex).

Discuss: Do the butterfly model’s corridor width results (system-level phenomenon) meet the three criteria for being emergent?

Example: Simple Birth Rates

From Info tab:

“This is a simple model of population genetics. There are two populations, the REDS and the BLUES. Each has settable birth rates. The reds and blues move around and reproduce according to their birth rates. When the carrying capacity of the terrain is exceeded, some agents die (each agent has the same chance of being selected for death) to maintain a relatively constant population. The model allows you to explore how differential birth rates affect the ratio of reds to blues.”

Example: Simple Birth Rates

Simple Birth Rates

Example: Simple Birth Rates

What shape is the graph?

In-Silico Experiments

Using BehaviorSpace to run in silico experiments.

Question: Why do we need to run experiments?

Answer: When all parameters are fixed, stochasticity in the system leads to results that are different each time it is run. Thus, we need to estimate the average results, as well as the variability around those averages.

Experiments allow us to include replicates of several different scenarios, where a scenario is the model with a specific set of parameters, initial conditions, and inputs.

In-Silico Experiments

Two main types of experiments:

  • Sensitivity experiment: Vary one parameter over a wide range to see how model response changes (single-factor).
  • Contrast scenarios: Look at differences in model response between two or several distinctly different scenarios.

The contrast scenario is most similar to typical experimental designs with a control and treatment.

Example: Simple Birth Rates

Let's learn BehaviorSpace!

BehaviorSpace

Example: Simple Birth Rates

mydata <- read.csv("Simple Birth Rates experiment-table.csv", header=TRUE, skip=6)
str(mydata)
'data.frame':   300 obs. of  6 variables:
 $ X.run.number.    : int  4 3 2 6 5 7 8 9 11 12 ...
 $ red.fertility    : int  2 2 2 2 2 2 2 2 2 2 ...
 $ carrying.capacity: int  1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ...
 $ blue.fertility   : num  2.1 2.1 2.1 2.1 2.1 2.1 2.1 2.1 2.2 2.2 ...
 $ X.step.          : int  121 149 200 97 139 140 150 123 70 78 ...
 $ ticks            : int  121 149 200 97 139 140 150 123 70 78 ...

Example: Simple Birth Rates

We need to replicate this figure:

Replicate This

Example: Simple Birth Rates

First, we need the blue fertility values:

(bf.vals <- unique(mydata$blue.fertility))
 [1] 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7
[18] 3.8 3.9 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 5.0

Example: Simple Birth Rates

Second, we need to compute the average ticks until red extinction.

N <- length(bf.vals) # How many bf.vals?
time.to.red.extinction <- rep(0,N) # Initialize
sdev <- rep(0,N)
for (i in 1:N) {
  # Subset the data
  tmp <- subset(mydata, mydata$blue.fertility == bf.vals[i])

  # Compute average over subsetted data
  time.to.red.extinction[i] <- mean(tmp$ticks)

  # Compute standard deviation over subsetted data
  sdev[i] <- sd(tmp$ticks)
}

Example: Simple Birth Rates

Let's plot!

plot(bf.vals, time.to.red.extinction, pch=19, xlab="Blue fertility", ylab="Ticks until red extinction")

arrows(bf.vals, time.to.red.extinction-sdev, bf.vals, time.to.red.extinction+sdev, length=0.05, angle=90, code=3)

Example: Simple Birth Rates

plot of chunk unnamed-chunk-5

Replicate This