Introduction to z-tree: Day 2

Similar documents
research assistant at VSE/LEE course site: janvavra.github.io consultations by appointment

THE IF STATEMENT. The if statement is used to check a condition: if the condition is true, we run a block

ECE15: Lab #4. Problem 1. University of California San Diego

Classwork 7: Craps. N. Duong & R. Rodriguez, Java Crash Course January 6, 2015

Tic Tac Toe Game! Day 8

Standard EBU settings for EBUScore programs - Gordon Rainsford 5 January 2016

Java Outline (Upto Exam 2)

CMPT 100 : INTRODUCTION TO

Introduction to Computer Science Unit 3. Programs

Review Chapter 6 in Bravaco. Short Answers 1. This type of method does not return a value. a. null b. void c. empty d. anonymous

Session 8.2. Finding Winners Using Arrays

Function Call Stack and Activation Records

CSE 203A: Randomized Algorithms

CS1132 Fall 2009 Assignment 1. 1 The Monty Hall Dillemma. 1.1 Programming the game

do fifty-two: An Introductory Programming Language

Pianola User Guide for Club Members How to analyse your own results and find a partner with Pianola

Problems for Op 2014

Weighted Powers Ranking Method

Introduction to z-tree. Design: Urs Fischbacher Programming: Urs Fischbacher & Stefan Schmid This slides by Ernesto Reuben

2011 NetRiders Skills Challenge Post Secondary Frequently Asked Questions (FAQ)

TWO PLAYER REACTION GAME

ROCK PAPER SCISSORS Rock Paper Scissors Lab Project Using C or C++

VISUAL GUIDE to. RX Scripting. for Roulette Xtreme - System Designer 2.0. L J Howell UX Software Ver. 1.0

Integers and the Coordinate Plane

The Plurality-with-Elimination Method

MATH 1340 Mathematics & Politics

The for Loop. Lesson 11

Programming Lab 1 (JS Hwk 3) Due Thursday, April 28

RANDOM NUMBER GAME PROJECT

Problem A. Ascent Sequences

University of New Mexico Department of Computer Science. Final Examination. CS 561 Data Structures and Algorithms Fall, 2011

Adapted from Code.org curriculum

Voting. Xiaoyue Zhang

def instructions(response): # Add to instruction_string so that it contains information on # how to play rock-paper-scissors instruction_string = ""

Getting Started. Excerpted from Hello World! Computer Programming for Kids and Other Beginners

MIDTERM EXAMINATION Networked Life (NETS 112) November 21, 2013 Prof. Michael Kearns

Last Class: Clock Synchronization. Today: More Canonical Problems

Chapter 5: Probability and Statistics. Middle SchooI Assessments

How It All Stacks Up - or - Bar Charts with Plotly. ISC1057 Janet Peterson and John Burkardt Computational Thinking Fall Semester 2016

do fifty two: Language Reference Manual

Python Programming: An Introduction to Computer Science

Table of contents. Abstract. Disclaimer. Scope. Procedure. AS-IS overview. Audit overview. Conclusion. Appendix A. Automated tools reports 12

CSC101 - BMCC - Spring /22/2019. Lab 07

Lesson 39: Conditionals #3 (W11D4)

The Daily Mail and Lotto 250k Giveaway promotion

econnect Baccarat User Guide EC7 June 2017

Integers Review. Author: Taras Gula me at before reproducing this booklet

Programming Problems 15th Annual Computer Science Programming Contest

What s New in Spotfire DXP 1.1. Spotfire Product Management January 2007

Handling Ties. Analysis of Ties in Input and Output Data of Rankings

Lab 2: Booleans, Strings, Random Numbers, Recursion, Variables, Input function

While Loops A while loop executes a statement as long as a condition is true while condition: statement(s) Statement may be simple or compound Typical

K-Means++: The Advantages of Careful Seeding

Welcome! COMP s1. Programming Fundamentals

MATH 51: MATLAB HOMEWORK 3

Possibilities of Voting

NCAA Instructions Nerdy for Sports

Leader Election in Rings

Homework #2 Assembly Programming

CS 210 Fundamentals of Programming I Spring 2015 Programming Assignment 4

Solving Minesweeper Using CSP

7. Arrays, More Java Looping

Sequential Two-Prize Contests

Problem A Math for a Birthday Present

Three Types of Probability

PRIMES Circle: High School Math Enrichment at MIT

CPSC 427: Object-Oriented Programming

Integration Test Plan. Angry Face Studios

Getting started with social media and comping

Redtooth Quiz center 5 User Manual

Privacy Policy- Introduction part Personal Information

static String usersname; public static int numberofplayers; private static double velocity, time;

Mill Hill School. 13+ Entrance Examination Mathematics. January Time: 1 hour. School: Mark: Materials required for examination

Python 2.7 will also work for this workshop due to certain language rules, however I prefer working with the most current stable version.

Variables and Constants

Introduction to Computer Programming

ASCII Art. Introduction: Python

Programming assignment A

CS 314 Exam 2 Spring

CS3 Midterm 2 Standards and Solutions

Homework 1. Hadachi&Lind October 25, Deadline for doing homework is 3 weeks starting from now due date is:

Keypad Quiz Version 5 Quick Start Guide

Lecture. Simulation && Design. Richard E Sarkis CSC 161: The Art of Programming

Hello World! Computer Programming for Kids and Other Beginners. Chapter 1. by Warren Sande and Carter Sande. Copyright 2009 Manning Publications

CPSC 217 Assignment 3

Privacy Policy. What Information Is Collected? Internet Traffic Data

EGR 111 Loops. This lab is an introduction to loops, which allow MATLAB to repeat commands a certain number of times.

Website Privacy Policy

CS 1301 Pair Homework 2 Conversions Due: Monday January 27th, 2014, before 11:55pm Out of 100 points Files to submit: hw2.py

2018 SmartHealth Wellness Program Frequently Asked Questions (FAQ)

Drawing Shapes on a Coordinate Grid

How to Find Your Most Cost-Effective Keywords

Noughts and Crosses. Step 1: Drawing the grid. Introduction

STRAT. A Program for Analyzing Statistical Strategic Models. Version 1.4. Curtis S. Signorino Department of Political Science University of Rochester

COMP Cams 500 Contest Rules

12-4 Geometric Sequences and Series. Lesson 12 3 quiz Battle of the CST s Lesson Presentation

SIMULTANEOUS EQUATIONS

Assignment 6: Dodo keeps getting smarter

Register of Processings Manual Version: Mei 2018

Fundamentals of Computer Science. Sentinel Based Repetition

Transcription:

Introduction to z-tree: Day 2 Andrew W. Bausch NYU Department of Politics bausch@nyu.edu January 10, 2012 Andrew W. Bausch January 10, 2012 1 / 27

Overview: Interactive Games Individual decision making experiments Subject s payoffs only depend on subject s own decisions Programs in the treatment only process information of a single subject Interactive experiments Payoffs of a subject also depend on the behavior of other subjects Programs have to access information from records of other subjects Andrew W. Bausch January 10, 2012 2 / 27

Overview: Interactive Games Matching Scope Operator & the same function Programming an experiment with interaction Andrew W. Bausch January 10, 2012 3 / 27

Matching Random Partner Matching In interactive experiments subjects are assigned into groups and the game is played repeatedly over several rounds Who interacts with whom in a given round? z-tree has built-in functions, but just as easy to do it yourself and you retain more control Andrew W. Bausch January 10, 2012 4 / 27

Matching Random Partner Matching In the first stage, create a one-line Program in the Subjects Table randgroup = random(); This generates a random number that we will use to create the groups End this program so the subjects can access each other s randgroup Andrew W. Bausch January 10, 2012 5 / 27

Matching Random Partner Matching continued Create a second Program in the Subjects Table right below the first Define GroupSize in Background ranking = count(randgroup >= : randgroup); ranking = ranking - 1; GroupNum = rounddown(ranking / GroupSize,1); We rank each subjects random number and make groups based on the ranking Andrew W. Bausch January 10, 2012 6 / 27

Matching Keeping the Same Groups Start with the same two programs as above wrap if(period == 1) around those programs in the second program, put an else statement else{ GroupNum= OLDsubjects.find(same(Subject), GroupNum); } z-tree normally only allows access the value of variables from the Subject s current period Use the OLDsubjects.find function to get each subject s previous value of GroupNum and passing it forward to the current round If we do this every round, the subjects keep the same GroupNum throughout the experiment Andrew W. Bausch January 10, 2012 7 / 27

Scope Operator Main Use Getting information from other subjects The scope operator is a colon : But, easier to read if you use the same function I primarily use the colon when applying a function ranking = count(randgroup >=: randgroup); Andrew W. Bausch January 10, 2012 8 / 27

same Function Passing Information between players Groupaverage = average(same(group), Contribution); Gets all contributions from a subjects group and uses the average function to calculate the group average Passing Information specific information from a player Choice3 = find(same(groupnum)&playernum == 3, Choice); Finds Player 3 in this subject s group and assigns Player 3 s Choice to a variable called Choice3 for all subjects You can create player numbers similar to the way we assigned groups Andrew W. Bausch January 10, 2012 9 / 27

The guessing game (beauty contest) Nagel, R. (1995). Unraveling in guessing games: An experimental study. American Economic Review, 85(5), 1313-1326. Andrew W. Bausch January 10, 2012 10 / 27

The guessing game 6 subjects (2 groups of 3 subjects) Keep the same group throughout Subjects enter a number between 0 and 100 Subject closest to 2/3 of the group s average entry wins a prize of 60 points In case of a tie, the prize is shared equally among the winning group members Continue for 10 rounds Andrew W. Bausch January 10, 2012 11 / 27

Background variables Declare the variables we don t plan on changing by creating a new program under Background I keep them all in the subjects table Andrew W. Bausch January 10, 2012 12 / 27

Setting up Groups Andrew W. Bausch January 10, 2012 13 / 27

Getting a Random Number if(period ==1) { randgroup = random(); } Assigning the Groups if(period == 1) { ranking = count(randgroup >= : randgroup); ranking = ranking - 1; GroupNum = rounddown(ranking / GroupSize,1); } else { GroupNum = OLDsubjects.find(same(Subject), GroupNum); } Note: These must be in two separate programs Andrew W. Bausch January 10, 2012 14 / 27

Set the Active Screen for Stage 1 Can copy and paste from yesterday Minimum input is 0 Maximum input is 100 Andrew W. Bausch January 10, 2012 15 / 27

Get the Group Average Note that we are going to need to use three separate short programs Andrew W. Bausch January 10, 2012 16 / 27

Get the Group Average // Get the group average Groupaverage=average(same(GroupNum), guess); // find 2/3s of it twothirdsgroupave = Groupaverage*2/3; // Calculate the difference Diff = abs(guess - twothirdsgroupave); Andrew W. Bausch January 10, 2012 17 / 27

Calculate the lowest difference Andrew W. Bausch January 10, 2012 18 / 27

Calculate the lowest difference // Calculate the lowest difference for the group Best = minimum( same(groupnum), Diff); // See if this subject is the winner Winner = if(diff == Best, 1, 0); Andrew W. Bausch January 10, 2012 19 / 27

Find the Payoffs Andrew W. Bausch January 10, 2012 20 / 27

Find the Payoffs // Determine how many winners NumWinners = sum(same(groupnum), Winner); // Set the round payoff using the number of winners and //the Winner variable RoundPayoff = Prize*Winner / NumWinners; Andrew W. Bausch January 10, 2012 21 / 27

Conditional Displays We want to tell each subject is she won Add New Plot Text Set Display Condition Winner == 1 <> You won! You were one of < NumWinners 1 > winners Andrew W. Bausch January 10, 2012 22 / 27

Conditional Displays Or lost Add New Plot Text Set Display Condition Winner == 1 You Lost! Andrew W. Bausch January 10, 2012 23 / 27

Displaying the Payoff Add New Plot Text <> Your Payoff this round is < RoundPayoff.1 > Andrew W. Bausch January 10, 2012 24 / 27

Stage 1 Andrew W. Bausch January 10, 2012 25 / 27

Stage 2: Winners Andrew W. Bausch January 10, 2012 26 / 27

Stage 2: Losers Andrew W. Bausch January 10, 2012 27 / 27