View Single Post
  #3   Spotlight this post!  
Unread 13-03-2014, 18:14
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,050
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: paper: Weeks 1-2 Elo Analysis

Quote:
Originally Posted by Michael Hill View Post
Included is perl code I used.
Here's Connor's translated to GNU AWK 4.0.1. Input is standard export.csv file.

Code:


BEGIN {FS=","; ln10=log(10); kFactor=24;}

(NR>1) && (($4=="Q")||($4=="E"))  {

for(i=8;i<=13;++i){if(!($i in Elo)){Elo[$i]=1200}}
avgRedElo  = (Elo[$8]  + Elo[$9] + Elo[$10])/3;
avgBlueElo = (Elo[$11] + Elo[$12] + Elo[$13])/3;

x = ((avgBlueElo - avgRedElo)/400)*ln10;  Ea = 1/(1 + exp(x));
x = ((avgRedElo - avgBlueElo)/400)*ln10;  Eb = 1/(1 + exp(x));

if($6>$7){Sa=1; Sb=0} else if($7>$6){Sa=0; Sb=1} else {Sa=0.5; Sb=0.5}

dRa = kFactor*(Sa-Ea);
dRb = kFactor*(Sb-Eb);

Elo[$8]+=dRa;
Elo[$9]+=dRa;
Elo[$10]+=dRa;

Elo[$11]+=dRb;
Elo[$12]+=dRb;
Elo[$13]+=dRb;
}

END{
PROCINFO["sorted_in"] = "@val_num_desc";
for (TeamNum in Elo) {print TeamNum "," Elo[TeamNum]}}

Last edited by Ether : 14-03-2014 at 09:13.
Reply With Quote