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.1866e-02 6.6354e-02 1.2989e-01 7.1609e-02 3.4630e-02 5.7462e-02 5.5242e-02 
##   Gligoric      Benko      Stein    Uhlmann   Portisch      Pomar   Olafsson 
## 4.4029e-02 4.8781e-02 7.9160e-02 7.6861e-02 6.2210e-02 3.3549e-02 5.1161e-02 
##  Bolbochan     Barcza      Bilek   Bisguier   Yanofsky     Bertok     German 
## 2.8070e-02 2.9731e-02 3.9350e-02 1.4853e-02 2.1516e-05 1.0007e-06 1.1870e-02 
##   Schweber   Teschner    Cuellar      Aaron 
## 1.4722e-06 1.7065e-02 1.7110e-02 9.1224e-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)
## -245.715250060412
jj <- maxlike_free$par
maxlike_free <- maxp(H_coll,startp=jj,give=TRUE)
dput(maxlike_free$value)
## -245.715248692429
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.6672e-02 6.8122e-02 6.8122e-02 1.3603e-01 7.5887e-02 2.8571e-02 4.8269e-02 
##      Filip   Gligoric      Benko      Stein    Uhlmann   Portisch      Pomar 
## 4.8497e-02 4.0083e-02 4.0027e-02 7.6372e-02 7.5729e-02 5.3780e-02 2.8209e-02 
##   Olafsson  Bolbochan     Barcza      Bilek   Bisguier   Yanofsky     Bertok 
## 4.2996e-02 2.2974e-02 2.3144e-02 3.4315e-02 1.3218e-02 4.6345e-06 8.0941e-06 
##     German   Schweber   Teschner    Cuellar      Aaron 
## 1.0798e-02 5.1689e-06 1.6413e-02 1.3618e-02 8.1319e-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.9272e-02 5.4859e-02 1.6604e-01 8.9397e-02 7.3552e-02 4.0264e-02 6.1973e-02 
##      Filip   Gligoric      Benko      Stein    Uhlmann   Portisch      Pomar 
## 4.6988e-02 3.7522e-02 4.3145e-02 6.5783e-02 6.3506e-02 4.7609e-02 3.0060e-02 
##   Olafsson  Bolbochan     Barcza      Bilek   Bisguier   Yanofsky     Bertok 
## 3.7287e-02 2.1956e-02 2.2235e-02 2.8264e-02 1.1975e-02 2.5598e-05 1.0001e-06 
##     German   Schweber   Teschner    Cuellar      Aaron 
## 9.0485e-03 3.5261e-06 1.1097e-02 1.1736e-02 6.4076e-03 
## (argmax, free optimization)
## Support for alternative:  -239.83 + K
## 
## degrees of freedom: 1
## support difference = 2.0442
## p-value: 0.04318

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.