An introduction to agent-based modelling with Python

General information

This course addreses people who (1) want to learn agent-based modeling (ABM) and (2) do not want to use a specialized platform such as Netlogo, but want to learn a general purpose programming language that is also well suited for ABM.

During the course you will learn basic knowledge in the programming language Python. While we focus on concepts necessary for ABM, the course teaches enough basics such that you can quickly learn to apply Python in other contexts, such as econometrics, network analysis or machine learning.

There are many good reasons to learn Python, aside from the fact that it is an excellent choice for programming ABMs, including:

  • It is one of the fastest growing programming languages!
  • More and more jobs are available for Python programmers!
  • It is one of the languages with the fatest growing communify!
  • Its a general purpose language that can be used in manifold ways!
  • It is rather easy to communice, yet at the same time very powerful!
  • Many more reasons…

This course is divided into several blocks, most of them are conseucutive. Yet, people who already have some knowledge can also work on the blocks independently from each other. This might be particularly useful for the blocks on matrix algebra, data processing and visualization.

For the moment, the videos of the course are available only in German. See here for the German webpage of the course with the links to the teaching videos.

The English version only consists of the scripts and homework assignments, as well as the solutions. But I am working on the English videos and hope to publish them soon.

For any queries, or if you want to get the solutions to the exercises, please feel free to contact me via email: claudius@claudius-graebner.com.

Introductory texts on economic methodology

I am convinced that all research methods in the social sciences come with both advantages and disadvantages. To weight these pros and cons, and to choose your methods wisely, basic knowledge in the philosophy of science, most notably epistemology and methodology, is required. Here I provide you with a list of some introductory texts that I personally found very useful in this context.

A summary of the most important concepts, a more detailed exposition of the usefulness of epistemology for applied researchers, as well as an exposition of an epistemological framework explaining how we can use formal models to learn about reality is given in this open access article that has been published in the Journal of Artificial Societies and Social Simulation (JASSS):

How to Relate Models to Reality? An Epistemological Framework for the Validation and Verification of Computational Models

The article also contains a summary of the most important philosophical concepts when it comes to the choice and justification of formal modelling techniques.

Introduction to Python

The German version of the course already contains the teaching videos.

Installation guidelines

Introduction to the graphical interface of the Spyder IDE

Block 1: Basics

Script

Exercises block 1

Exercises (html, online).

For the solutions, please contact me via email.

Block 2: Classes and object-oriented programming

Script

Exercises block 2

Exercises (html, online).

For the solutions, please contact me via email.

Block 3: Numpy, data processing, and visualization

First script: matrix algebra and stochastics

Second script: Data processing

Third script: Visualization

Example output (many time series)

Exercises block 3

Exercises (html, online)

For the solutions, please contact me via email.

Block 4: Agent-based models of technology choice

There is no script available for this block since it is about building an ABM from scratch (see the german videos ). Yet, you can have a look at the final implementation of the model in Python.

Example implementation of the model (just as in the video, a bit more comments)

Exercises block 4

Exercises (html, online)

For the solutions, please contact me via email.

Back to main page.