Learn more about models, including the basics for understanding, building, and analyzing agent-based models, with Professor Smaldino in his Introduction to Agent-Based Modeling seminar, January 11-13, 2024.
As scientists, we try to increase our understanding of the world through research. We study objects and systems to learn about their properties and behaviors. Or do we?
Sometimes we do, especially when we want to know about a specific object or system in particular. We measure the salinity of a particular lake, investigate the brain activity of a particular patient, or document the practices of a particular cultural group. However, we often want to understand things that we can’t directly or systematically observe, due to constraints of time, space, budget, or ethics. The evolutionary dynamics of long-lived species, the rise and fall of empires, the effects of a new traffic circle or a risky public health intervention. In these cases, it’s usually not possible to study our targets of interest directly.
Instead, we study something else. We call that something else a model. Models allow us to study a system that is analogous to the one we’re really interested in, and then by virtue of the analogy draw inferences back onto our original system of interest. And because scientists often try to generalize from specific pieces of evidence to generalizable theoretical explanations, models can help us formalize those theories and to test their plausibility and secondary consequences.
A model is any physical or abstract structure that can potentially represent a real-world phenomenon. Using this definition, many—I’d actually venture most—scientists use models. Engineers build physical scale models to test the designs of their constructions before spending the resources to build the real thing. Biomedical and behavioral scientists use animal models to make inferences about genetics, physiology, or development. I’m sure there are scientists whose primary goal is to understand the Norway rat or the fruit fly, but most researchers studying these “model organisms” aspire to more general claims about the biology and behavior of related animals, especially humans. Behavioral experiments like those conducted by psychologists and economics? These are models too.
Consider the famous “marshmallow test.” Researchers sit a child down at a table in front of a marshmallow and then leave the room after informing the child that if—and only if—the marshmallow is still on the table when the researcher returns, the child will get a second marshmallow. There is debate about whether this experimental paradigm tests for willpower, trust in authority, or something else. For our purposes, the important thing is that none of the researchers using it are primarily motivated in the candy-eating habits of the children being tested (I’m pretty sure about this, though you never can tell with some people). Instead, they are interested in general phenomena like willpower or social trust, and are using the marshmallow scenario as a model for the class of scenarios in which these factors come into play.
I discuss all these examples because I want to illustrate their continuity with formal models—mathematical or computational specifications of a system. Formal models are simplified portrayals of systems that allow researchers to clearly state their assumptions about the parts of those systems and then to rigorously and precisely analyze the consequences of those assumptions. Constructing these models forces us to specify all of the components of our theory and gives us the opportunity to test the plausibility of our ideas, examine counterfactuals, and compare between a much wider range of possibilities than is usually possible even for systems that can be directly tested empirically. Formal models are common across many disciplines, from physics to neuroscience, ecology to economics, epidemiology to sociology.
I am particularly interested in models of social dynamics and cultural evolution. Understanding the feedback between individual behavior and social organization is difficult, and it can be challenging to study examples of that feedback empirically. Formal modeling can be very useful for the development and refinement of theory in the social sciences, as in all mature sciences. In October 2023, my book Modeling Social Behavior: Mathematical and Agent-Based Models of Social Dynamics and Cultural Evolution was published. I wrote this book to train researchers to appreciate how models can contribute to their understanding of social systems, and to give readers a toolkit for building their own models.
The book is bookended with chapters that present a philosophical, big-picture overview of how models work and how they can be used in the social sciences. The middle eight chapters feature in-depth presentations of key modeling ideas and techniques, and each of these chapters concludes with reflections on how generalizable the model analyses are, pointers to related work on each topic, and homework problems and model analysis. The book also contains a link to an online repository of NetLogo code for each of the models presented in the book. NetLogo is a free, open source software package and programming language for agent-based modeling, and is widely used for modeling complex adaptive systems. Finally, the book’s penultimate chapter discusses strategies for building new models and guidance on how to integrate formal theoretical models into a robust empirical workflow.
A major focus of the book is on the use of agent-based models. These are computational models in which individuals (agents) are explicitly coded as computational objects that can act and interact with other agents; the dynamics of these interactions are typically explored through simulation.
Agent-based models allow us to consider the macro-level patterns that emerge when many heterogeneous individuals all behave according to their various rules or strategies. It is this consideration of heterogeneity that gives agent-based models their strength. Agents can have positions in space or on a network, and can vary in their properties (e.g., age, ethnicity, resources, or opinions) and behavioral strategies (e.g., their norms and practices).
A key point made in the book is that agent-based modeling is not a competing or alternative approach to purely mathematical equation-based models. Rather, the two approaches are complementary. Mathematical models afford researchers elegance, parsimony, and the possibility of formal proofs, while agent-based models can capture more complicated structures and can also yield intuitions through visual exploration of the simulations.
Of the book’s eleven chapters, eight are focused on explicit modeling topics and techniques. We start with agents situated in space, moving around and reacting to one another, taking the opportunity to familiarize ourselves with programming and visualization using the NetLogo environment. We build up models of flocking or herding, a classic example from collective behavior.
We then move on to Thomas Schelling’s famous model of urban segregation, one of the earliest examples of agent-based modeling in the social sciences (first published in the late 1960s). This model illustrates how weak individual preferences for similar neighbors can give rise to strong patterns of segregation, and provides an opportunity to learn the basics of model analysis.
Next comes a chapter on contagion dynamics. These models originate in epidemiology, but are also influential for understanding the spread of information and the diffusion of innovations. The chapter also introduces an approach that is used in subsequent chapters as well: going back and forth between agent-based models and compact mathematical models.
From the binary world of being either susceptible or infected, we move on in the next chapter to the social dynamics of continuous opinions, and explore how different assumptions about individual cognition and network structure can lead to consensus, extremism, or polarization.
The next three chapters introduce two important ideas in modeling social behavior: evolutionary dynamics and game theory. First, we tackle the evolution of cooperation using the framework of the prisoner’s dilemma game. Throughout this chapter we oscillate between developing intuitions from spatially-explicit agent-based models and then solving analytically for exactly when those intuitions do or do not hold more generally. We then move onto the evolution of norms, using coordination and anti-coordination games. In this chapter we introduce how to model populations with community structure, and explore the evolution of group-beneficial norms and the emergence of inequality between social classes. In the next chapter we tackle models of the scientific process itself, using the relationships between conditional probabilities described by Bayes’ Theorem as a baseline model from which to explore the consequences of social phenomena like publication bias and incentives to publish.
Finally, we get a crash course in network theory, exploring generative models of network structure. We also learn to simulate agent dynamics on networks, using the test case of simple vs. “complex” contagion on small-world networks.
I Teach This Stuff
I teach a full-semester course on this topic at UC Merced, and I have given many shorter workshops are various institutions and conferences. Through Code Horizons, you can take an intensive three-day short course with me on the basics of developing, coding, and analyzing agent-based models. The course focuses on contagion models, but covers approaches that are easily applied to other model systems, including cellular automata, spatially-explicit mobile agents, and network dynamics.
Models Are Cool
Understanding complex systems is difficult. Our brains often struggle with simulating the interactions of many moving parts, each reacting to the others. Luckily, we can equip our imaginations with prostheses that enhance their ability to process complex dynamical systems. Building and analyzing formal models can help us to better understand and theorize about the specific systems we are modeling. But it can also do much more. Cultivating a habit of modeling can help us to develop intuitions for the behavior of complex systems more generally. And in this complicated world of many interwoven complex systems, such intuitions can come in handy.