To cite the hyper2 package in publications, please use Hankin (2017). This file creates likelihood functions H and H_coll, which appear in the package as interzonal and collusion respectively. It also presents some analysis of the datasets using the hyper2 package.

jj <- read.table("stockholm1962.txt",header=FALSE)
results <- as.matrix(jj[,-(1:2)])
players <- as.character(jj$V1)
nationality <- as.character(jj$V2)
rownames(results) <- players
colnames(results) <- players
points <- rowSums(results,na.rm=TRUE)

Now some comparison between stockholm1962.txt (results) and stockholm1962_matches.txt (results2):

H <- hyper2(pnames=c("white","draw",players))
H_coll <- hyper2(pnames=c("white","draw","collusion",players))

restab <- read.table("stockholm1962_matches.txt",header=FALSE)
stopifnot(all(unique(sort(c(as.character(restab$V1),as.character(restab$V2)))) == sort(players)))
results2 <- matrix(0,length(players),length(players))
rownames(results2) <- players
colnames(results2) <- players
diag(results2) <- NA

for(i in seq_len(nrow(restab))){
    white_player <- as.character(restab[i,1])
    black_player <- as.character(restab[i,2])
    match_result <- as.character(restab[i,3])

    nw <- which(players==white_player)
    nb <- which(players==black_player)

    if(match_result == "1-0"){ # white win
        results2[nw,nb] <- 2
        results2[nb,nw] <- 0

        H[c(white_player             ,"white"       )] %<>% inc()
        H[c(white_player,black_player,"white","draw")] %<>% dec()

        if(nationality[nw]=="USSR" & nationality[nb]=="USSR"){
            H_coll[c(white_player             ,"white"       )] %<>% inc()
            H_coll[c(white_player,black_player,"white","collusion")] %<>% dec()
        } else {
            H_coll[c(white_player             ,"white"       )] %<>% inc()
            H_coll[c(white_player,black_player,"white","draw")] %<>% dec()
        }
    } else if(match_result == "0-1"){ # black wins
        results2[nw,nb] <- 0
        results2[nb,nw] <- 2
        H[c(             black_player               )] %<>% inc()
        H[c(white_player,black_player,"white","draw")] %<>% dec()

        if(nationality[nw]=="USSR" & nationality[nb]=="USSR"){
            H_coll[c(             black_player                    )] %<>% inc()
            H_coll[c(white_player,black_player,"white","collusion")] %<>% dec()
        } else {  # collusion not playing
            H_coll[c(             black_player               )] %<>% inc()
            H_coll[c(white_player,black_player,"white","draw")] %<>% dec()
        }

    } else if (match_result == "1/2-1/2"){ # draw
        results2[nw,nb] <- 1
        results2[nb,nw] <- 1
        H[c(                                  "draw")] %<>% inc()
        H[c(white_player,black_player,"white","draw")] %<>% dec()

        if(nationality[nw]=="USSR" & nationality[nb]=="USSR"){
            H_coll[c(                                  "collusion")] %<>% inc()
            H_coll[c(white_player,black_player,"white","collusion")] %<>% dec()
        } else {  # collusion not playing
            H_coll[c(                                  "draw")] %<>% inc()
            H_coll[c(white_player,black_player,"white","draw")] %<>% dec()
        }
    } else {
        stop("not possible")
    }
}  # i loop closes

So, results [from the square matrix] and results2 [from the 3-column dataframe] should match:

stopifnot(all(results[!is.na(results)] == results2[!is.na(results2)]))

Now some maximum likelihood estimation.

H_maxp <- maxp(H)
H_maxp
##      white       draw    Fischer     Geller  Petrosian   Korchnoi      Filip 
## 2.5868e-02 7.0232e-02 1.5282e-01 8.2099e-02 3.3356e-02 5.2589e-02 5.2522e-02 
##   Gligoric      Benko      Stein    Uhlmann   Portisch      Pomar   Olafsson 
## 4.2981e-02 4.4059e-02 8.0256e-02 8.1948e-02 5.7431e-02 3.1393e-02 4.7111e-02 
##  Bolbochan     Barcza      Bilek   Bisguier   Yanofsky     Bertok     German 
## 2.4104e-02 2.4101e-02 3.7777e-02 1.3022e-02 1.3680e-06 1.0005e-06 9.8650e-03 
##   Schweber   Teschner    Cuellar      Aaron 
## 1.0165e-06 1.5749e-02 1.3010e-02 7.7004e-03
small <- 0.01


maxlike_free <- maxp(H_coll,startp=c(small,small,small/2,rep(small,22)),give=TRUE)
print("l")
## [1] "l"
dput(maxlike_free$value)
## -239.374896808407
jj <- maxlike_free$par
maxlike_free <- maxp(H_coll,startp=jj,give=TRUE)
dput(maxlike_free$value)
## -239.374896799213
H_coll_maxp <- maxlike_free$value
samep.test(H_coll,c("draw","collusion"))
## 
##  Constrained support maximization
## 
## data:  H_coll
## null hypothesis: draw = collusion
## null estimate:
##      white       draw  collusion    Fischer     Geller  Petrosian   Korchnoi 
## 2.7002e-02 6.8445e-02 6.8445e-02 1.4541e-01 7.6341e-02 2.7828e-02 4.7145e-02 
##      Filip   Gligoric      Benko      Stein    Uhlmann   Portisch      Pomar 
## 4.8519e-02 3.9705e-02 3.9243e-02 7.4762e-02 7.6348e-02 5.3070e-02 2.6904e-02 
##   Olafsson  Bolbochan     Barcza      Bilek   Bisguier   Yanofsky     Bertok 
## 4.2533e-02 2.2722e-02 2.1418e-02 3.3990e-02 1.2726e-02 4.5531e-06 3.5002e-06 
##     German   Schweber   Teschner    Cuellar      Aaron 
## 1.0188e-02 2.4565e-05 1.6079e-02 1.2783e-02 8.3612e-03 
## (argmax, constrained optimization)
## Support for null:  -241.87 + K
## 
## alternative hypothesis:  sum p_i=1 
## alternative estimate:
##      white       draw  collusion    Fischer     Geller  Petrosian   Korchnoi 
## 1.4467e-02 3.7671e-02 4.1164e-01 8.9348e-02 5.7870e-02 2.4014e-02 3.5589e-02 
##      Filip   Gligoric      Benko      Stein    Uhlmann   Portisch      Pomar 
## 2.9569e-02 2.4518e-02 2.3834e-02 5.3810e-02 4.6322e-02 3.2258e-02 1.6879e-02 
##   Olafsson  Bolbochan     Barcza      Bilek   Bisguier   Yanofsky     Bertok 
## 2.6655e-02 1.2392e-02 1.2623e-02 2.1161e-02 7.1505e-03 1.0000e-06 1.0001e-06 
##     German   Schweber   Teschner    Cuellar      Aaron 
## 5.2761e-03 1.0002e-06 8.4737e-03 5.8633e-03 2.6095e-03 
## (argmax, free optimization)
## Support for alternative:  -238.3 + K
## 
## degrees of freedom: 1
## support difference = 3.5767
## p-value: 0.0074821

Package dataset

Following lines create interzonal.rda, residing in the data/ directory of the package.

interzonal <- H
interzonal_maxp <- H_maxp
collusion <- H_coll
collusion_maxp <- H_coll_maxp
save(interzonal,collusion,interzonal_maxp,collusion_maxp,
file="interzonal.rda")

References

Hankin, R. K. S. 2017. “Partial Rank Data with the hyper2 Package: Likelihood Functions for Generalized Bradley-Terry Models.” The R Journal 9 (2): 429–39.