实验经济学软件ztree教程课件教学课件_第1页
实验经济学软件ztree教程课件教学课件_第2页
实验经济学软件ztree教程课件教学课件_第3页
实验经济学软件ztree教程课件教学课件_第4页
实验经济学软件ztree教程课件教学课件_第5页
已阅读5页,还剩112页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、 Readings to Do lToday lBasic Experiments and Questionnaires (Tutorial pp. 7-16, 77-81) lTomorrow lRunning Experiments and Recovering Data (Tutorial pp. 83-89) lFunctions and Control Structures (Tutorial pp. 17- 41) Programming A Simple Public Goods Game lRecall the idea of a Public Goods Game: lSom

2、e group of people, size N, receive an endowment of money lEvery person chooses some proportion of their endowment to contribute lTotal contributions are multiplied by X 1, then everyone receives that amount back lTotal payoff = (Endowment Contribution) + (X * Total Contributions) / N Opening zTree E

3、s ist nicht englisch! Changing the language setting will not affect currently open treatments. You need to open a new treatment to have the defaults set to English. You must change the language setting every time you open zTree, even if your program was written under the “English” setting, because o

4、therwise server messages will display in German when you run the program. Setting Language by Default Stages of a Simple Public Goods Game lSubjects are broken into groups of N lSubjects receive their endowment lSubjects make a choice for contribution lCalculate the size of the total public contribu

5、tion and multiply by X lReport earnings (endowment kept + share of the public good) to all subjects l(Repeat?) Terminology lStage: In an experiment, one screen display on which a subject can take one or a few actions lTreatment: A related series of stages through which subjects pass; can be repeatin

6、g lSession: A series of treatments all performed on the same subjects in sequence Stages of a Simple Public Goods Game lSubjects are broken into groups of N lSubjects receive their endowment lSubjects make a choice for contribution lCalculate the size of the total public contribution and multiply by

7、 X lReport earnings (endowment kept + share of the public good) to all subjects Background Stage Stage 1 Stage 2 More Terminology lProgram: A set of procedures used to assign variables, calculate payoffs, store information, etc. lActive Screen: The screen on which subjects see information and make d

8、ecisions lWaiting Screen: A “placeholder” screen that subjects see after they make decisions in a stage and are waiting for other subjects to finish the stage Stages of a Simple Public Goods Game lSubjects are broken into groups of N lSubjects receive their endowment lSubjects make a choice for cont

9、ribution lCalculate the size of the total public contribution and multiply by X lReport earnings (endowment kept + share of the public good) to all subjects Background Stage Stage 1 Stage 2 program program program active screen active screen Order of Execution Step 1: Setting the General Background

10、Parameters lDouble-click on Background to show the General Parameters dialog lSet Number of Subjects to the right size (in this case, 8) lSet Number of Groups to the right size (in this case, 2) lSet Practice Periods to 0 (we will discuss this later) lSet Paying Periods to 1 (no repetitions of the t

11、reatment) Setting the Background Parameters (Continued) lExchange rate lMost economic experiments involve some form of cash reward lThe reward unit within the program (Experimental Currency Units, or ECUs) can be denominated differently than the cash reward lWe set a 1 ECU = $1 (or “1 Franc”) exchan

12、ge rate subjects see their real payoffs during the experiment lLump Sum Payment: ECUs you give the subject that can change during the experiment (a “bankroll”) lShow-up Fee: Dollars / Francs that are paid at the end of the experiment (XEFS standard is $10) Step 2: Set Non-General Background Paramete

13、rs for the Experiment lThink about what variable parameters we have in this experiment lthe number of subjects (gen. background) lthe number of periods (gen. background) lX the “efficiency factor” lthe size of the endowment Set these in a list at the top of the program makes them easy to change for

14、different treatments Create a Program to Store the Variables lPlace cursor on Session lSelect New Program from the Treatment menu Creating a New Program lUnder Table select Subjects lCreate two variable names for X and the Endowment lSyntax: lvariablename = number; lPress OK About “Tables” of Variab

15、les lzTree stores variables in several different tables: lSubjects holds variables that may be different between subjects and between periods (most reliable) lGlobals holds variables that will be the same for all subjects but may differ between periods (have had trouble with this in the past) lSumma

16、ry like the subjects table, but used to display running statistics of an experiment for the experimenter on the server lContracts holds buy and/or sell offers in auctions lSession holds variables that may differ across subjects but persists across treatments lIn most cases, the Subjects table is app

17、ropriate Step 3: Ask Subjects for Contributions lPlace cursor on Background lSelect New Stage from the Treatment menu Creating a New Stage lGive the stage a name, like “Contribution” lUnder the Start menu, select Wait for all (so that all subjects enter stage together) lLeave At most one unchecked (

18、used to make choices sequential) lUnder Leave stage after timeout, select No (makes time limit non-binding) lUnder Timeout, select 30 (seconds) Creating a Screen for Subjects to Enter Contribution lPlace cursor on Active Screen lSelect New BoxStandard Box from the Treatment menu Terminology lBox: A

19、container in which text displays and entry buttons are placed on the Active Screen Creating a New Box 1 23 4 5 67 Legend of Box Creation Screen lLabel of the box (not shown to subjects) lSize of the box, in points or percent of the remaining screen lDistance away from the (remaining) screen edge in

20、points or percent lAdjustment of the remaining box (whether to “cut off” the screen above, below, to the left, or to the right of the current box lDisplay Condition (if present, Boolean expression that must be true in order for box to be shown) lButton Position (where to place buttons in this box) l

21、Arrangement (how to arrange buttons) Finishing Creation of The Box Putting an Item into the Box lPlace cursor on Contribution Entry lSelect New Item from the Treatment menu Creating the Text to Display Ways to Display Information in an Item Finishing the Item Text: A Title Box A New Item: Showing th

22、e Endowment The Final Item: An Input Box for Contribution A Button to End the Stage lPlace cursor on the last item under Active Screen lSelect New Button from the Treatment menu lSet the button as shown Step 3: Calculate Public Good lCreate a new stage, call it “Display Outcomes” lHighlight the new

23、stage, then create a new program lEnter this code into the program: lPgood=Efficiencyfactor*sum(same(Group), Contribution); lNote this command: sum(same(Group), Contribution) this tells the computer to sum up the variable “Contribution” for everyone in the same Group More Programs lCreate another pr

24、ogram under the last one, and enter the following code: lN = count(same(Group); lThis command tells the computer to count the number of people with the same group number lCreate a new program under the last one, and enter this code in: lProfit = Pgood / N + (Endowment Contribution); lNote: Profit is

25、 a reserved variable name that zTree uses to record the amount paid to a subject (in ECUs) in every period lPrograms MUST be separate: you cannot use a variable created by a program in another expression until the program has been completely executed Step 4: Display Outcomes lCreate a new Standard b

26、ox, call it “Final Outcome” lSet the box to take up the entire screen lAdd items to the box: lPlace a title on the results lDisplay the amount the subject kept lDisplay the amount of the subjects own contribution lDisplay the total contribution of the group lDisplay the subjects share of the contrib

27、ution lDisplay the final earnings of the subject lPut a button in to leave the stage Set Group Matching Protocol lSelect TreatmentParameter Table lSelect all of the cells corresponding to the different subjects in Period 1 lSelect TreatmentMatchingStranger Thats It! lSave the file using FileSave lWe

28、 are now ready to run an experiment Suggested Homework lTry modifying todays program into a “Common Pool Resource” Game (Ostrom et al. APSR article, “Covenants With and Without a Sword”) l8 agents have a given number of work hours in a day (say, 10) and can allocate them between harvesting a common

29、pool resource (x) and leisure (10-x) lCPR yields diminishing returns to increasingly intense harvesting lPayoff = x*(23X-0.25X2)+5(10-x), where X=sum(x) over all subjects Questionnaires Questionnaires lYou must run a questionnaire at the end of an experiment in order to retrieve the data from that e

30、xperiment lQuestionnaires can be simple, just names and social security numbers, or involve more complicated surveys lToday, we will do a simple example of a questionnaire and show more complicated examples later Create a Questionnaire lGo to FileNew Questionnaire lDouble-click on “Adress” (the Germ

31、an spelling of Address, I think) Basic Questions in Questionnaire Questions left blank will not be asked to the subjects. Label on the “OK” Button What you enter into the blank will correspond to what the header on the answer blank will read; for example, you can use the “Postal Code” blank to gathe

32、r information about Social Security Numbers Adding a Final Display Screen lSelect (single-click) “Adress”, then go to QuestionnaireNew Question Form lYou can add items to this question form, just like you do with a box in a normal treatment lTypical items to display might include: lThe variable Fina

33、lProfit total earnings from the experiment, not including the show-up fee lThe variable ShowUpFee lCreate items (with labels) to display these variables The Final Questionnaire Running a Session Running an Experiment lOpen zTree and Treatment Files on the Experimenter Server lMake sure language is s

34、et correctly lSet Matching protocol (if necessary) lOpen zLeaf on every Subject computer lMake sure language and names are set up correctly on zLeaf programs lCheck to make sure clients are connected lRun experiment treatments lMonitor Subjects table and Clients table lRun questionnaire; read Paymen

35、t files lCollect data and split tables zTrees Advantage: Easy Networking lAll you need to do is open zTree on the experimenter PC first, then open zLeaf on each client PC lMake sure that, in the same directory as zLeaf, there is a notepad file called server.eec with the IP address of the server comp

36、uter on it Setting Language and Name on zLeaf lCreate a shortcut to the zLeaf on each Subject client lIn the Target blank, put in: l/Name lPut in a different name for each Subject client computer so that you can tell them apart Verifying that Clients are Connected: The Clients Table Eight Clients (N

37、amed Correctly) Are Connected to this Server Starting the Treatment Monitor Subject Progress lThe Clients table and the Subjects table provide most of the important information Opening the Subjects Table Current Stage that Subject is in Time Remaining in Stage Variable Values for Each Subject Inform

38、ation in Client and Subject Tables Starting the Questionnaire The “Adress” Form Shown The Payment File lOnce every subject has finished the questionnaire (as you can monitor in the Clients table) a payment file will be written lOpen this file in Excel to see payoffs Payment File Details Collecting a

39、nd Organizing the Data lzTree names files according to date plus a random code: lYYMMDDCC.xxx lY = Year, M = Month, D = Day, C = code lSeveral files are of interest lSubject file: .sbj (Questionnaire answers stored here) lGamesafe: .gsf (Internal zTree Storage) lCollected Tables: .xls (Variables fro

40、m Treatment) Split Tables/Treatments Apart lClose zTree lMake sure zTree is really closed (use Ctrl-Alt-Delete and close any instances of zTree lRe-open zTree, select ToolsSeparate Tables Select the .xls file from the last treatment New Files Created Treatment Number Table Name Sample Treatment Run

41、lOn your desktop, create a shortcut to zLeaf lCall it /Name , where I give you the number How can you test programs on your own? lOpen your treatment with zTree lOpen as many zLeaf Shortcuts on your own computer as necessary to run the treatment lName them differently to help differentiate them lRun

42、 treatment in zTree as normal, switching among zLeafs (using Alt-Tab) to make entries More Complicated Programs: Functions and Simple Control Statements Guess the Sine Function zTree Implements Many Mathematical Functions zTree also Implements Many “Table” Functions Another Example: A “Guess the Ave

43、rage” Game The Scope Operator Within Tables The Scope Operator Between Tables lSuppose that the above program is being executed in table A, and that there is a variable v present in tables A, B, and C lNote that the syntax B.function() executed in table A draws variables from table B for execution;

44、the scope operator moves the execution to the next higher table Techniques: Ranking Subjects Give subjects a rank ties go to a lower number Give subjects a rank ties go to a higher number In the case of a tie, reward subject according to their “average” rank Ranking Subjects boxes in the Container d

45、ivide the column into cells; one item is placed into each box Example: Using Container Boxes More Complicated Programs: Arrays and Iterators Storing Vectors lzTree can store vectors of values by creating array objects lValues for elements of the array are assigned using this syntax: arraynamei=1; Ar

46、rays and Iterator Functions lArrays can be used in conjunction with iterator functions in order to quickly assign a series of values lIterators repeatedly execute a portion of a program, incrementing the value of a variable as it goes lIterator statements must be appended to other functions, like “s

47、um” or “do” using a syntax like iterator(i,10).sum(arraynamei, v) Example of Iterator Syntax Used with Arrays Things zTree Cannot do With Arrays lStore matrices (or arrays that have other arrays as elements) lDo matrix multiplication or other matrix operations More Complicated Programs: Storing Past Histories Storing Information From Previous Periods lSometimes,

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论