Introduction to Agent-Based Modeling (ABM)

M. Drew LaMar
March 10, 2021

“In science, we usually want to understand how things work, explain patterns that we have observed, and predict a system's behavior in response to some change.”
- Railsback & Grimm

Example: Hardening of Portland Cement

Hypotheses/Models

g1 <- lm(y ~ 1, data=cement)
g2 <- lm(y ~ x1 + x2, data=cement)
g3 <- lm(y ~ x1 + x2 + x1*x2, data=cement)
g4 <- lm(y ~ x3 + x4, data=cement)
g5 <- lm(y ~ x3 + x4 + x3*x4, data=cement)

Example: Hardening of Portland Cement

Hypotheses/Models

aictab(list("Constant" = g1, 
            "x1 + x2" = g2, 
            "x1 + x2 + x1*x2" = g3, 
            "x3 + x4" = g4, 
            "x3 + x4 + x3*x4" = g5), 
       second.ord = TRUE)

Example: Hardening of Portland Cement

Hypotheses/Models


Model selection based on AICc:

                K   AICc Delta_AICc AICcWt Cum.Wt     LL
x1 + x2         4  69.31       0.00   0.94   0.94 -28.16
x1 + x2 + x1*x2 5  74.72       5.40   0.06   1.00 -28.07
x3 + x4         4  83.74      14.43   0.00   1.00 -35.37
x3 + x4 + x3*x4 5  88.22      18.90   0.00   1.00 -34.82
Constant        2 111.54      42.22   0.00   1.00 -53.17

Example: Hardening of Portland Cement

Model averaging (Multimodel Inference)

\[ \mathbf{g} = \sum_{i=1}^{R}w_{i}g_{i}. \]

Example: Hardening of Portland Cement

As an example, create an arbitrary input \( x_{1} \), \( x_{2} \), \( x_{3} \), and \( x_{4} \) and look at the predicted values.

X <- data.frame(x1 = 0.14, x2 = 0.40, x3 = 0.52, x4 = 0.05)
modavgPred(list("Constant" = g1,
                "x1 + x2" = g2,
                "x1 + x2 + x1*x2" = g3,
                "x3 + x4" = g4,
                "x3 + x4 + x3*x4" = g5), 
           second.ord = TRUE, 
           newdata = X)

Example: Hardening of Portland Cement


Model-averaged predictions on the response scale
based on entire model set and 95% confidence interval:

  mod.avg.pred uncond.se lower.CL upper.CL
1       53.176     3.242   46.821   59.531

One more hoorah for statistics...

Statistics have multiple modalities or goals. These include:

  • estimation of parameters, [Estimation]
  • testing of hypotheses, [Hypothesis Testing]
  • exploration of covariation, [Multicollinearity]
  • prediction into new conditions, [Statistical Modeling, Regression]
  • selecting among choices (e.g. models) [Model Selection]

  Brian McGill (aka Dynamic Ecologist)

From phenomenological to mechanistic

“All other things being equal, mechanistic models are more powerful since they tell you about the underlying processes driving patterns. They are more likely to work correctly when extrapolating beyond the observed conditions.”
- Bolker (2008) Ecological models and Data in R, p7

How about some definitions?

From phenomenological to mechanistic

Mechanistic model: A hypothesized relationship between the variables in the data set where the nature of the relationship is specified in terms of the biological processes that are thought to have given rise to the data. The parameters in the mechanistic model all have biological definitions and so they can be measured independently of the data set referenced above.

Phenomenological/Statistical model: A hypothesized relationship between the variables in the data set, where the relationship seeks only to best describe the data.

From phenomenological to mechanistic

“A statistical model foregoes any attempt to explain why the variables interact the way they do, and simply attempts to describe the relationship, with the assumption that the relationship extends past the measured values. Regression models are the standard form of such descriptions…”
- in “Ecological Detective” by Hilborn and Mangel

Statistical Modeling

  1. Model formulation: Construct functional relationships that represent biological hypotheses [e.g. linear or nonlinear models]
  2. Model fitting: i.e. parameter estimation [e.g. least squares or maximum likelihood estimation]
  3. Model diagnostics: Make sure assumptions of model formulations hold [e.g. analyze residuals]
  4. Model selection: Choose the best model or set of models [e.g. AIC, forward/backward selection]
  5. Model use: Use the model for prediction or inference [e.g. multimodel inference]

Mechanistic Modeling (process-driven modeling)

The process-driven modeling cycle

Modeling cycle

  1. Formulate the question and Assemble hypotheses: The Scientific “Deep Thinking” part
  2. Choose model structure: Model Design \( \leftrightarrow \) Experimental Design
  3. Implement the model: Model formulation, model fitting, model diagnostics, and model selection.
  4. Analyze the model: What information is contained in our model? What does it imply or predict about the real world?

Model Diagnostics

“Because the assumptions in the first version of a model are experimental, we have to test whether they are appropriate and useful. For this, we need criteria for whether the model can be considered a good representation of the real system. These criteria are based on patterns or regularities that let us identify and characterize the real system in the first place.”
- Railsback & Grimm

tl;dr ->

  • Statistical models are validated by comparison to quantitative information (data).
  • Mechanistic models are validated by comparison to qualitative information (patterns).

Model Diagnostics

“Because the assumptions in the first version of a model are experimental, we have to test whether they are appropriate and useful. For this, we need criteria for whether the model can be considered a good representation of the real system. These criteria are based on patterns or regularities that let us identify and characterize the real system in the first place.”
- Railsback & Grimm

Process of modeling (POM) is not “linear”

Just like process of science (POS)

1. Formulate the question

“We need to start with a very clear research question…”

“Very often, even our questions are only experimental and later we might need to reformulate the question, perhaps because it turned out to be not clear enough, or too simple, or too complex.”

2. Assemble hypotheses...

…for essential processes and structures

“But whatever technique we prefer, this task has to combine existing knowledge and understanding, a 'brainstorming' phase in which we wildly hypothesize, and, most importantly, a simplification phase.”

“The modeling cycle must be started with the most simple model possible, because we want to develop understanding gradually, while iterating through the cycle.”

“…just our preliminary understanding of a system is not sufficient for deciding whether things are more or less important for a model. It is the very purpose of the model to teach us what is important.”

3. Choose model structure

Definition: A model is a concrete or abstract simplification of objects and their relationships or processes in the real world.

In this step, we choose:

  • Objects (spatial scale, entities, state variables, parameters)
  • Processes (time scale, parameters)

Verbal formulation of the model!!

4. Implement the model

Mathematical or computational formulation of the model!!

5. Analyze, test, and revise the model

Doing science with models

  • Extract information from model through:

    • Simulation
    • Analysis
  • Use results to:

    • Explain
    • Predict
    • Use as evidence for hypotheses