research assistant at VSE/LEE email: vavra.jn@gmail.com consultations by appointment course site: janvavra.github.io presentations, guides for installation, links, code. currently under review, will email you when ready (ETA tomorrow evening)
Design and program your own simple economic experiment using otree experimental platform. PhD thesis in experimental? Post-doc positions Research Data gathering
1. 16.02. - Intro 2. 23.02. Basic Examples, Examples of documentation for the project 3. 02.03. - More advanced examples 4. 09.03. - Extensions (JavaScript, CSS)
1. Submit a project documentation with team members names (groups of 1-3 people) to March 7 th 23:59 (two days before the last seminar). It should be based on provided template and examples (next lecture) given in seminars. 2. Submit a programmed project to March 23 rd 23:59 (two weeks after last seminar). Program should be fully working and contain instructions and main part of the experiment (questionnaire is optional)
www.otree.org Documentation and code examples: http://otree.readthedocs.io/en/latest/
1. Why otree? 2. Why Python? 3. otree and web technologies 4. otree project structure 5. Demonstration 6. Thinking in otree 7. Tasks for next week
Yesterdays assignment: for today read the paper (10 pages) http://www.otree.org/otree.pdf
Runs on every operating system and device (PC, tablets, smartphones). Requirements: server: Python client: web browser Its based on rich set of technologies used in web development Object Oriented Programming, Model View Controller architecture Programmed using Python, HTML5, CSS3 (Bootstrap) and JavaScript Based on Django web framework used by Instagram, Washington Times
Opensource, flexible, you can program almost anything You can reuse available libraries from both Python and JavaScript!! Python: numpy, matplotlib, pandas, sympy, pyomo.. JavaScript: React.js, Angular.js, Plotly.js. Conditional formatting, complicated graphical elements Simulation of energy networks, markets clearings during the experiments Multiple treatments, complicated matching.
No need for paper instructions Automated testing of experiments using bots (test.py, advanced topic, not there) Insight to current web technologies Real-time feedback and results of the experiment Great tools for coding PyCharm, SublimeText..
In the Lab Kiosk mode in browser, runs over LAN network Online Amazon Mechanical Turk, easy hosting on Heroku Field/Classroom Use Wi-Fi router and one laptop as a server Users work on own devices or you will distribute yours (only browser is needed) otree has inbuilt production server, helps to set up and install things
No support for real-time interaction of players (yet) No possibility of real-time auction, real-time chat Games must consists of steps or stages, will see later (can be hacked to have it, but don t, many risks) otree is based on Django Django is standalone Python web framework Real-time experiment can be programed in Django using JavaScript, AJAX, React... But Django is not preprogrammed to shuffle groups, execute code at the start of the new round
Easy to learn, widely used Main objective is readability of the code and ease of development Python 3.X+ Python tutorial on the otree page is sufficient We only need it as a tool! http://otree.readthedocs.io/en/latest/python.h tml
Can use any database technology (default is SQLite, in production PostgreSQL) Stores permanent data about the experiment. Uses SQL language, but otree/django provides a bridge in Python. Provides logic of the experiment backend Written in Python/Django Served webpages to the client (sends code that client translated to webpage) Loads into memory of the server to execute commands Displays webpages Returns user submitted data to server and server saves it to database
otree code resides in a folder folder contains code for your experiments + another things that otree needs
Each part is in different folder (as an app) in otree to be reusable
Rules of the game: Each player makes a guess from 0 to 100 (whole numbers). After all players make their guesses, average of their guesses is taken. This average is multiplied by 5/4. Player with closest guess to 5/4 of average wins. If there are multiple winning players, winner is determined at random within them. Price for the winner: 300 CZk How to play 1. Connect to Wi-Fi mobilelee password: password 2. Connect to 192.168.110.10/room/exp using your browser
Keynesian beauty contest Are prices of stocks based on fundamental value, or on opinion of others? Is there a Nash equilibrium? How do you derive it? Does it help you to know it for winning the game? Iterated rationality of other agents What about other variants of the game? 4/3 of the average, or more? only the average 2/3 of the average, or less?
1. Walkthrough the Python tutorial on otree page 2. Choose your weapon 1. Install and use PyCharm (reccomented) or other text editor 3. Install otree using guide on webpage 4. Play with the demos on the otree page 5. Take a look at the three tutorial experiments in the otree documentation