Readme in supplementary material for

A Comment on "Cycles and Instability in a Rock-Paper-Scissors Population Game: A Continuous Time Experiment"

Zhijian Wang, Siqian Zhu and Bin Xu

Nov. 19, 2013

http://arxiv.org/abs/1311.2506

 

Aim: Aim of this file is to explain how to replicate the Table 1 in main text.  

 

Figure S1: Explanation of the replication of the results in Table 1 (screenshot) in main text.

 

Prepare: To confirm Results_3.do being runnable by Download the Supplementary Data from
 
http://restud.oxfordjournals.org/content/early/2013/09/10/restud.rdt023

 

Processes 1: In the program file Results_3.do, modify the code following the two steps (Step-1.1 and Step-1.2) in page 2. Then save this program file as Result-3-9WZX.do Results 1: After running Result-3-9WZX.do, file Data4Table11.log will be generated in which the results with (alpha, beta)=(1/4, 1/4) in Table 1 will be replicated.

 

Processes 2: In the program file Results_3.do, modify the code following the two steps (Step-2.1 and Step-2.2) in page 3. Then save this program file as Result-3-2WZX.do Results 2: After running Result-3-2WZX.do, file Data4Table12.log will be generated in which the results with (alpha, beta)=(0.22, 0.40) for S3_DP and (alpha, beta)=(0.23, 0.26) for S3_DM in Table 1 will be replicated. At the same time, all results in Table 2 will be replicated.

 

Processes 3: In the program file Results_3.do, modify the code following the two steps (Step-3.1, Step-3.2 and Step-3.3) in page 4. Then save this program file as Result-3-A1-WZX.do Results 3: Running Result-3-A1-WZX.do, file Data4TableA1.log will be generated in which the results in Table A1 will be replicated.

 

Note: Using Stata 12 and conduct the processes above, following files will be generated and included also in package.

Result-3-9WZX.do (formed after Processes 1) ->> Data4Table11.log ->> results in Table 1
Result-3-2WZX.do (formed after Processes 2) ->> Data4Table12.log ->> results in Table 1 and Table 2

Result-3-A1-WZX.do (formed after Processes3) ->> Data4TableA1.log ->> results in Table A1


 

 

l  Step-1.1: Open and save Results_3.do as Result-3-9WZX.do. Then

Replace line 100-104 in Results_3.do with following commands for readable output file for Table 1.

log using "Data4Table11" , replace            // added for output Table 11

bysort name: tabstat cycle_index trip_neg trip_pos, statistics( mean ) by(session)

** Is the index significantly different from zero? **

collapse (mean) cycle_index trip_neg trip_pos, by(session name adj_speed stability)

by name, sort : signrank cycle_index = 0

log close                               // added for output Table 11

 

l  Step-1.2:

Replace line 42-54 with following commands for correcting two mistakes in all treatments with alpha=beta=0.25 :

** Now count passes through the tripwire **

** Set the start point Pc of Poincare section at (alpha, beta)

** To find cycles in treatment 1, 2, 3, 4, 5, 6, 7, 8, 9, set (alpha, beta)@(0.25, 0.25)=Nash

** To find cycles in S3_DM and S3_DP set (alpha, beta)@(0.23, 0.26) and @(0.22, 0.40) respectively.  

gen alpha=0.25  // confirm cycle set (alpha, beta)@(0.25, 0.25)= Nash

gen beta=0.25

**replace alpha=0.22  if name =="S3_DP" // confirm cycle in (S3_DP) by set (alpha, beta)@(0.22, 0.40)

**replace beta= 0.40  if name =="S3_DP"

**replace alpha=0.23  if name =="S3_DM" // confirm cycle in (S3_DM) by set (alpha, beta)@(0.23, 0.26)

**replace beta= 0.26  if name =="S3_DM"

** Replace following two lines

**---- gen strat0_25=strategy0-0.25

**---- gen laststr0_25=laststrat0-0.25

** with following two lines for generalized Poincare section to trip cycle:

gen strat0_25=strategy0-alpha

gen laststr0_25=laststrat0-alpha

replace laststr0_25=. if per_num!=lastper

** Look for when the strategy 0 less the Nash of 0.25 changes sign from t-1 to t ** /o_46

** Look for when the strategy 0 less alpha changes sign from t-1 to t

gen strat0chgP=0

gen strat0chgN=0

replace strat0chgP=1 if strat0_25>0 & laststr0_25<0  

replace strat0chgN=1 if strat0_25<0 & laststr0_25>0  

** Add following two lines to CORRECT Mistake-2

replace strat0chgP=0.5 if strat0_25>laststr0_25 & (strat0_25==0 | laststr0_25==0)

replace strat0chgN=0.5 if strat0_25<laststr0_25 & (strat0_25==0 | laststr0_25==0)

** And look to see if we are on the right side of strategy 1 compared to Nash of 0.25 **

** And look to see if we are on the right side of strategy 1 compared to beta

gen strat1_25N=0  //o_52

** Replace following line o_53

** ---- strat1_25N = 1 if avestrat1 < 0.25  

** with next two lines using Equation (1) to CORRECT Mistake-1

gen Cy=strategy1+(laststrat1-strategy1)*(alpha-strategy0)/(laststrat0-strategy0)

replace strat1_25N=1 if Cy<beta

** Now combine them to see if line segment is tripped, and in which direction **  //o_54

 

 

l  Step-2.1: Open and save Results_3.do as Result-3-2WZX.do. Then

Replace line 96-104 with following commands for readable output file for Table 1.

log using "Data4Table12" , replace            // added for output Table 12

** Now construct cycle rotation index **

collapse (sum) trip_pos trip_neg, by(session block blockper per_num name adj_speed stability treatment)

gen cycle_index = (trip_pos - trip_neg)/(trip_neg + trip_pos)

gen c = trip_pos - trip_neg

bysort name: tabstat cycle_index trip_neg trip_pos c treatment, statistics( mean ) by(session)

** Is the index significantly different from zero? **

collapse (mean) cycle_index trip_neg trip_pos c treatment, by(session name adj_speed stability)

by name, sort : signrank cycle_index = 0

by name, sort :  signrank c  = 0  

mean c, over(treatment)  

log close                               // added for output Table 12

l  Step-2.2:

Replace line 42-54 with following commands for confirming cycles in discrete time treatments :

** Now count passes through the tripwire **

** Set the start point Pc of Poincare section at (alpha, beta) ** To confirm cycles in treatment 1, 2, 3, 4, 7, 8, 9, set (alpha, beta)@(0.25, 0.25)=Nash ** S3_DM and S3_DPset @(0.23, 0.26) and @(0.22, 0.40) respectively.  

gen alpha=0.25  // confirm cycle set (alpha, beta)@(0.25, 0.25)= Nash

gen beta=0.25

replace alpha=0.22  if name =="S3_DP" // confirm cycle in (S3_DP) by set (alpha, beta)@(0.22, 0.40)

replace beta= 0.40  if name =="S3_DP"

replace alpha=0.23  if name =="S3_DM" // confirm cycle in (S3_DM) by set (alpha, beta)@(0.23, 0.26)

replace beta= 0.26  if name =="S3_DM"

** Replace following two lines

**---- gen strat0_25=strategy0-0.25

**---- gen laststr0_25=laststrat0-0.25 // ** with following two lines for generalized Poincare section to trip cycle:

gen strat0_25=strategy0-alpha

gen laststr0_25=laststrat0-alpha

replace laststr0_25=. if per_num!=lastper

** Look for when the strategy 0 less the Nash of 0.25 changes sign from t-1 to t ** /o_46

** Look for when the strategy 0 less alpha changes sign from t-1 to t

gen strat0chgP=0

gen strat0chgN=0

replace strat0chgP=1 if strat0_25>0 & laststr0_25<0  

replace strat0chgN=1 if strat0_25<0 & laststr0_25>0  

** Add following two lines to CORRECT Mistake-2

replace strat0chgP=0.5 if strat0_25>laststr0_25 & (strat0_25==0 | laststr0_25==0)

replace strat0chgN=0.5 if strat0_25<laststr0_25 & (strat0_25==0 | laststr0_25==0)

** And look to see if we are on the right side of strategy 1 compared to Nash of 0.25 ** compared to beta

gen strat1_25N=0  //o_52

** ---- strat1_25N = 1 if avestrat1 < 0.25 // Replace o_53 with next 2 lines using Equation (1) to CORRECT Mistake-1

gen Cy=strategy1+(laststrat1-strategy1)*(alpha-strategy0)/(laststrat0-strategy0)

replace strat1_25N=1 if Cy<beta

** Now combine them to see if line segment is tripped, and in which direction **  //o_54

 

 

 

 

l  Step-3.1: Open and save Results_3.do as Result-3-A1-WZX.do. Then

Replace line 100-104 in Results_3.do with following commands for readable output file for Table A1.

log using "Data4TableA1" , replace            // added for output Table A1 in appendix

********************************** Replace the following lines {

********| bysort name: tabstat cycle_index trip_neg trip_pos, statistics( mean ) by(session)

********| ** Is the index significantly different from zero? **

********| collapse (mean) cycle_index trip_neg trip_pos, by(session name adj_speed stability)

********| by name, sort : signrank cycle_index = 0

*********** with following line to replicate Table1A (Algorithm refined [before]) in Appendix 

gen c = (trip_pos - trip_neg)   

bysort name: tabstat cycle_index trip_neg trip_pos c, statistics( mean ) by(session)

** Is the index significantly different from zero? **

collapse (mean) cycle_index trip_neg trip_pos c, by(session name adj_speed stability)

  signrank cycle_index = 0 if name=="S3_DP"

  mean cycle_index if name=="S3_DP"

  signrank c  = 0 if name=="S3_DP"

  mean c if name=="S3_DP"

**************************************** } // end of this replacement

log close                               // added for output Table A1 in appendix

 

l  Step-3.2:

Replace line 42-44 with following commands :

** Now count passes through the tripwire **

gen strat0_25=strategy0-0.22    // replace 0.25 with alpha=0.22 in ****|gen strat0_25=strategy0-0.25

gen laststr0_25=laststrat0-0.22   // replace 0.25 with alpha=0.22 in ****|gen strat0_25=strategy0-0.25

 

l  Step-3.3:

Replace line 53 with following command :

replace strat1_25N=1 if avestrat1<0.40  // replace 0.25 with beta=0.40 in |replace strat1_25N=1 if avestrat1<0.25