
In this lecture, we learn how to install oTree in the development enviroment PyCharm. Note: since March 2021 the oTree default syntax has changed somewhat. This course will gradually be updated to also support the new syntax but for now please use pip3 install -U "otree<5" when installing oTree. We will discuss the new format in one of the later sections of the course and you can decide to switch to it after that.
In this lecture we take a look at our first oTree app. Note that I deleted the sample games and added an app called overview app between lecture 1 and this lecture. In this lecture I am not going to show how I created this overview_app, we will learn how to do this in lecture 3. You can download it from the resource secion of this lecture if you want to.
Note: In an update that was released in December 2021 the class Constants was renamed to C. Also, the default variables in this class are now in all caps instead of lowercase e.g. num_rounds changed to NUM_ROUNDS . So whenever the video tells you to write “Constants.variable_name” you should write “C.VARIABLE_NAME” instead. The old format still works, so you can continue to use the example code provided in the Course but it is recommended that you learn the new format instead.
In this lecture, we develop a simple example experiment in which subjects can enter a number which gets multiplied by a constant factor.
In this lecture, we learn how to develop experiments with multiple rounds.
In this lecture, we learn how to develop multiplayer experiments, using the example of a prisoner's dilemma game.
In this lecture, we learn how to use the oTree template language. In particular we look at if conditionals and for loops. We do this by developing a public goods game.
In this lecture, we learn how to randomise subjects into different treatments.
In this lecture, we learn how to randomise the question order of our experiments.
In this lecture, we learn how to implement attention checks in oTree. We develop an experiment in which subjects are asked a question about the instructions and only those who answer correctly can continue to the main experiment
In this lecture, we learn how to use JavaScript with oTree. We develop an experiment in which subjects perform an addition task and we use JavaScript to check if their result is correct.
In this lecture, we learn how to embedd images and videos into our oTree experiments.
In this lecture, we learn how to develop experiments with real time interaction between participants using oTree LivePages. We create an auction task in which subjects make back and forth bids for a good.
In this lecture, we can learn how to validadte user input.
In this lecture, we learn how to understand error messages for errors in Python, the oTree Template language and JavaScript.
In this lecture, we learn how to deploy our experiments to the cloud platform Heroku, to make them available for subjects.
In this lecture, we learn how we can automate the testing of our experiment using bots.
Since March 2021 oTree has a new default style of writing code. In this lecture we look at the difference between the old and the new format and discuss form whom it makes sense to stick with the old format and who should switch to the new one.
In this lecture, we look at a fresh oTree installation and familiarise ourselves with the different files.
In this lecture, we develop our first experiment - a simple survey in which subjects answer some questions.
In this lecture, we learn how to develop experiments with multiple rounds. We develop a multi round real effort task in which subjects have to add numbers.
In this lecture, we learn how to use the oTree template language. In particular we look at if conditionals and for loops. We do this by developing a public goods game.
In this lecture, we learn how to randomise the question order of our experiments.
In this lecture, we learn how to randomise subjects into different treatments.
In this lecture, we learn how to develop multiplayer experiments, using the example of a prisoner's dilemma game.
In this lecture, we learn how to use HTML and CSS to style our experiments by modifying the prisoner's dilemma app we created in an earlier lecture.
In this lecture, we learn how to use JavaScript with oTree. We develop an experiment in which subjects perform an addition task and we use JavaScript to check if their result is correct before allowing them to progress to the next page.
In this lecture, we learn how to develop experiments with real time interaction between participants using oTree LivePages. We create an auction task in which subjects make back and forth bids for a good.
In this lecture, we learn how to implement attention checks in oTree. We develop an experiment in which subjects are asked a question about the instructions and only those who answer correctly can continue to the main experiment
In this lecture, we learn how to understand error messages for errors in Python, the oTree Template language and JavaScript.
This lecture shows how to install oTree without Pycharm for everyone who prefers to use a different editor.
What is oTree?
oTree is a framework to develop social science experiments which can be used both online an in the laboratory.
Why learn oTree?
oTree is a flexible framework that uses Python in the background and HTML/CSS to for the user interface. Because of this flexibility oTree is a one size fits all solution to social science experiments. Once you have mastered oTree you don't need to use any other experimental software again. Moreover, Python is rapidly gaining popularity in data science so you can use the same programming language to design your experiments and to analyse your data.
Why this course?
Because oTree is so flexible it can be challenging to get started with oTree. This course is designed to solve this problem by providing a step-by-step introduction into oTree that covers everything from installing oTree on your computer to developing experiments with complex oTree functionality such as LivePages.
What is covered in this course?
Installing oTree
Overview over oTree
Developing a simple survey experiment
Experiments with multiple rounds
Multiplayer experiments
Overview over the oTree template language
User interface design with HTML and CSS
Randomising the question order
Experiments with multiple treatments
Responsive pages - Using JavaScript with oTree
Debugging oTree experiments
Deploying the experiment to a Heroku server
What are the prerequisites for this course?
The course requires basic knowledge of Python. If you have never worked with Python before, check out one of the many free Python courses on Udemy.
Who is the target Audience for this course?
This course is targeted at academics, who do experimental economics or another experimental social science. It is suitable both for students and faculty.