版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
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. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024年產(chǎn)00萬(wàn)噸鋼鐵生產(chǎn)線建設(shè)合同
- 2024正式版車輛轉(zhuǎn)讓合同標(biāo)準(zhǔn)范本
- 土建承包合同范本2024年
- 2024幼兒園合作合同范文
- 上海買房合同書(shū)
- 2024個(gè)人店鋪出租合同范本
- 2024華碩電腦經(jīng)銷商訂貨單合同大客戶
- 商鋪合作經(jīng)營(yíng)協(xié)議
- 2024臨時(shí)工合同協(xié)議書(shū)版臨時(shí)工合同范本
- 2024新媒體主播合同
- 部編版語(yǔ)文二年級(jí)上冊(cè)《語(yǔ)文園地三我喜歡的玩具》(教案)
- 軟件開(kāi)發(fā)項(xiàng)目驗(yàn)收方案
- 崗位整合整治與人員優(yōu)化配置實(shí)施細(xì)則
- 康復(fù)治療技術(shù)的職業(yè)規(guī)劃課件
- 蜜雪冰城營(yíng)銷案例分析總結(jié)
- 交換機(jī)CPU使用率過(guò)高的原因分析及探討
- 易制毒化學(xué)品安全管理崗位責(zé)任分工制度
- 住宿服務(wù)免責(zé)聲明
- 2023年醫(yī)療機(jī)構(gòu)消毒技術(shù)規(guī)范醫(yī)療機(jī)構(gòu)消毒技術(shù)規(guī)范
- MOOC 家庭與社區(qū)教育-南京師范大學(xué) 中國(guó)大學(xué)慕課答案
- 構(gòu)造法與數(shù)列課件高三數(shù)學(xué)二輪復(fù)習(xí)
評(píng)論
0/150
提交評(píng)論