Dr. Philipp Chapkovski



oTree workshop, May 29 - 30 2018

Philipp Chapkovski, University of Zurich



This is a course about how to design and program interactive behavioral experiments using the oTree platform (Chen et al., 2016). oTree is a modern Python- and Django-based platform that allows a fast development of web-applications where participants can communicate with each other over the internet using any kind of modern browsers (including mobiles and tablets). oTree is widely used by numerous behavioral labs all over the world.

The main aim of this 2-day course is to enable participants to build their own experiment, share its code in public repositories (such as GitHub) and to deploy the app on a public web-server. We will briefly discuss how to conduct experiments online using the Amazon Mechanical Turk crowdsourcing platform. This course can also serve as a useful entry point to Python language which is widely used for academic purposes outside the scope of behavioral economics (in data analysis, machine learning or web-scraping).

During these two course days we build a slightly modified version of Public Good game (Zelmer, 2003) which is a standard game to study voluntary contributions and free-riding. In its basic form N players take the decision how much money to invest into a common pot, which is later multiplied by a certain factor and evenly distributed among all the participants. In our version of the game participants are also informed about some demographic characteristics of other members of their groups and the story of previous contributions.

This course will be continued at the advanced level at the University of Mainz on June 4-5, 2018 catching up the same Public Good game and developing it further: we will add the possibility to invest the results of the own efforts (the result of real effort task, as suggested by Graves (2010) and the punishment stage (following Fehr and Gächter 2000). For more information about the advanced level course, please contact Mario Scharfbillig: mario.scharfbillig@uni-mainz.de

These workshops are aimed at Master and Ph.D students. No prior knowledge of Python, or other platforms to build experiments is needed. However, to get a better overview of the course participants’ prior coding knowledge, all participants are required to fill in the questionnaire (available here: http://goo.gl/v665SQ) prior to enrollment.



Chen, D.L., Schonger, M., Wickens, C., 2016. oTree - An open-source platform for laboratory, online and field experiments. Journal of Behavioral and Experimental Finance, vol 9: 88-97

Fehr, E. and Gächter, S., 2000. Cooperation and punishment in public goods experiments. American Economic Review, 90(4), pp.980-994.     

Graves, Philip E., A Note on the Design of Experiments Involving Public Goods (September 30, 2010). CESifo Working Paper Series No. 3187. Available at SSRN

Zelmer, J., 2003. Linear public goods experiments: A meta-analysis. Experimental Economics, 6(3), pp.299-310.


Tentative Timeline (subject to change)

Day 1: May 29

9.30-11.00. Brief introduction to Python and Django

  • Data structures, methods
  • Classes. What is self?
  • Intro to model-view-controller logic
  • Relational databases.

11.30-1.00. General oTree overview:

  • oTree pages and their methods
  • Life span of session in oTree
  • oTree models and their relations

2.00-3.30. Going live with your study:

  • Treatments and settings
  • GitHub
  • Publishing the first game to Heroku

4.00-5.30. Adding interactivity:

  • Multiround game – how to get the data from previous games
  • Roles and conditional page formation
  • Accessing data from other rounds

Day 2: May 30

9.30-11.00. Interactivity II:

  • Groups – accessing data of other players
    • Waiting for other players
    • Group- and subsession level operations in waiting pages
  • Changing group composition

11.30-1.00. Getting cleaner code and data:

  • Form validation and formation
  • Delivering pages on timeout
  • Following DRY (Do Not Repeat Yourself) principle: subclassing the pages

2.00-3.30. Making user experience better:

  • Templates: dynamically change the page contents
  • Accessing data from other apps (participant.vars, session.vars)
  • Dealing with static files (images)
  • Showing graphs with previous contributions

4.00-5.30. Testing the apps and going online:

  • Writing tests
  • Using browser and ‘normal’ bots
  • Posting apps on Amazon mTurk

General Data

  • Abbreviation
  • Semester
    summer semester 18
  • Target Groups
  • Course Type
  • Course Language
  • Departments
    Faculty of Business, Economics and Social Sciences

Place and Time

  • Place
    Von Melle Park 9 Raum A510
  • Time
    at 29/05/2018 from 09:00 to 18:00
  • Place
    Von Melle Park 9 Raum A510
  • Time
    at 30/05/2018 from 09:00 to 18:00

Recognition Modalities

  • Number of Semester Hours
  • Amount of Credit Points
  • Creditable as
    • WiSo doctoral program: WiSo methods for Economics
    • WiSo doctoral program: WiSo methods for Social Economics
    • WiSo doctoral program: WiSo methods for Social Siences

Registration Modalities

  • Type of Place Allocation
    Manual Place Allocation (after the registration deadline)
  • Information about Registration
  • Max. Number of Participants