research assistant at vse/lee · 2. choose your weapon 1. install and use pycharm (reccomented) or...

Post on 06-Jul-2020

4 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

• 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 economicexperiment 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 7th 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 23rd

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.html

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.

Displays webpages

Returns user submitted data to server and server saves it to database

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

• 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 mobileLEEpassword: 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 weapon1. 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

top related