CR example SAS

****** An example of a submission for the extensive form game prediction competition ***

This example is an implementation (using SAS) of CR model described in the competition web site.  
This model was estimated to fit the estimation experiment.

The current program has three parts.  

Part 1 reads the input (parameters of the games). It should appear without any change in all SAS submissions.

Part 2 derives the predictions of the model. The participants should express their ideas at 
this parts.  They can use parts of the baseline models if they wish.

Part 3 creates the output file, and computes the model's scores.  It should appear without any change in all SAS submissions.

In summary, the SAS submissions should be identical to the following example with the exception of Section 2.  
Thus, when submitted the program should be set to read and fit the estimation experiment. In the cover letter the submitters should state the MSD on the estimation data set. The organizers will first run the submitted program on the estimation data set to make sure that they can 
replicate the stated MSD score. Then, on December 2nd 2011 they will modify Part 1 and 3 of the submission (by replacing the filenames and the normalization variables) to derive the predictions of the model and its MSD score in the competition experiment. 

Note: This example can be used as a first draft of a submission.  To try different models on the estimation set you should simply modify Section 2 (and download the two data sets from the competition site

;
**************************Part 1: Input***********************************;
**** This part should appear without any change in all the SAS submissions;

options linesize=78 pagesize=999;
libname out '';

data ext1; 
infile 'ext_est_param.txt';
input Game f1 s1 f2 s2 f3 s3;


****************Part 2: The derivation of the prediction******************;
*****charness rabin 2002*******;

data ext1; set ext1; 
array f{3} f1 f2 f3;
array s{3} s1 s2 s3;
array rcr{3} rcr1-rcr3;
array scr{3}  scr1-scr3;

 

do i=1 to 3;
 rcr{i}=0; if s{i}>f{i} then rcr{i}=1;
 scr{i}=0; if s{i}<f{i} then scr{i}=1; 
end;

data ext1; set ext1;
nsim=1000; 

do roe1=.05 to .05 by .05;  
do sigma1=0 to 0 by .05; 
do delta1=0.6 to .6 by .05; 
 do roe2 = 0.05 to .05 by .05; 
  do sigma2 = 0.05 to .05 by .05;
  do teta= 0.1 to 0.1 by .01;
   do delta2= 2.9 to 2.9 by .2 ; 
do id=1 to nsim;
output;
 end; end; end; end;end; end; end;end;

data ext1; set ext1;

if nsim>1 then do;
    del2=delta2*ranuni(0)*2;
    sig2=sigma2*ranuni(0)*2;
    ro2=roe2*ranuni(0)*2;

del1=delta1*ranuni(0)*2;
    sig1=sigma1*ranuni(0)*2;
    ro1=roe1*ranuni(0)*2;

    tet=-teta*ranuni(0)*2;
end;

if nsim=1 then do;
del1=delta1;
    sig1=sigma1;
ro1=roe1;
del2=delta2;
    sig2=sigma2;
    ro2=roe2;
    tet=-teta;
end;

array f{3} f1 f2 f3;
array s{3} s1 s2 s3;
array rcr{3} rcr1-rcr3;
array scr{3}  scr1-scr3;
array crb{3}  crb1-crb3;
array cra{3} cra1-cra3;
array crab{3} crab1-crab3;


qcr=0; if s1>max(s2,s3) and sum(f1,s1)>=max(sum(f2,s2),sum(f3,s3)) then qcr=-1;


*for player 2****;
do i=2 to 3;
 crb{i}=s{i}*(1-ro2*rcr{i}-sig2*scr{i}-tet*qcr)+ f{i}*(ro2*rcr{i}+sig2*scr{i}+tet*qcr);

**and to what player 1 thinks of player 2 preferences;
 crab{i}=s{i}*(1-ro1*rcr{i}-sig1*scr{i}-tet*qcr)+ f{i}*(ro1*rcr{i}+sig1*scr{i}+tet*qcr);
end;

pcb=1/(1+exp(del2*(crb2-crb3)));
*maxown=max;

*****for player1;

do i=1 to 3;
 cra{i}=f{i}*(1-ro1*scr{i}-sig1*rcr{i})+ s{i}*(ro1*scr{i}+sig1*rcr{i});
end;


***player1 assumes that player2 has social (CR) preferences; 
cb=0;
rand= round(ranuni(0)*1+0,1);
if crab2<crab3 then cb=1; 
if crab2=crab3 then cb=rand;


pcra=1/(1+exp(del1*(cra1-cra{cb+2})));

proc sort; by roe1 sigma1 teta delta1 roe2 sigma2 delta2 game s1 f1 s2 f2 f3 s3;
proc means noprint; by roe1  sigma1 teta delta1 roe2 sigma2 delta2  game s1 f1 s2 f2 f3 s3;
 var pcra pcb ;
output out =ext1 mean= pcra pcb ;


**************Part 3: The output *******************************************;
*** This part should appear without any change in all the SAS submissions*******;

data out.model_est; set ext1; 

data c; infile 'ext_est_res.txt'; 
input game f1 s1 f2 s2 f3 s3 pr pb;

data test; merge out.model_est c;
by game;

data test; set test;

msda=(pcra-pr)**2;
msdb=(pcb-pb)**2;


proc means noprint; 
 var msda msdb;
output out =o mean= msda msdb ;
proc sort; by msdb msda;
proc print;
run;

Č
ċ
ď
ext_est_param.txt
(2k)
Games Competition,
Feb 8, 2011, 5:19 AM
ċ
ď
ext_est_res.txt
(3k)
Games Competition,
Feb 8, 2011, 5:19 AM
Comments