To cite the hyper2 package in publications, please use Hankin (2017).
Here I analyse results from Curacao 1962 using hyper3 formalism
using the weighted Draw monster approach outlined in kka.Rmd:
\[ \left(\frac{\lambda p_1, D(p_1+p_2),p_2}{\lambda p_1+D(p_1+p_2)+p_2}\right)^{(a,b,c)} \left(\frac{p_1, D(p_1+p_2),\lambda p_2}{p_1+D(p_1+p_2)+\lambda p_2}\right)^{(d,e,f)} \]
Above, \(p_1\) plays \(p_2\) a total of \(a+b+c+d+e+f\) times; we have \(a+b+c\) matches with \(p_1\) playing white and \(p_2\) black, with \(a\) wins, \(b\) draws and \(c\) losses [write \(\mathord{+}a\,\mathord{=}b\,\mathord{-}c\)], and \(d+e+f\) matches with \(p_1\) playing black and \(p_2\) playing white with \(\mathord{+}d\,\mathord{=}e\,\mathord{-}f\).
With this model [discussed in a broader context at kka.Rmd],
whatever the value of \(D\) and \(\lambda\), there is a pathology which BT
cannot deal with. Still not quite 100% sure but it seems that the
maximum likelihood estimate of the players’ strengths is zero except
for Fisher and Petrosian; and indeed we see Fisher at 57% and
Petrosian at 42% [with \(\lambda = 1.1, D=1.888\)]. This on the grounds
that these players never lost playing black (there are some \(2\times
3\) tables at the end). This might be considered a defect of the
probability model.
cur_matches <- read.table("stockholm1962_matches.txt", header=FALSE)
colnames(cur_matches) <- c("white", "black", "result")
head(cur_matches)
## white black result
## 1 Aaron Barcza 0-1
## 2 Benko Bisguier 1-0
## 3 Bertok Gligoric 1/2-1/2
## 4 Bolbochan Schweber 1/2-1/2
## 5 Filip Yanofsky 1-0
## 6 Geller Cuellar 0-1
nrow(cur_matches)
## [1] 256
Above, we see on the first line that Aaron (white) lost to Barcza
(black). We will set up hyper2 and hyper3 objects corresponding
to likelihood functions for these observations.
jj <- read.table("stockholm1962.txt",header=FALSE)[,1:2]
(players <- jj$V1)
## [1] "Fischer" "Geller" "Petrosian" "Korchnoi" "Filip" "Gligoric"
## [7] "Benko" "Stein" "Uhlmann" "Portisch" "Pomar" "Olafsson"
## [13] "Bolbochan" "Barcza" "Bilek" "Bisguier" "Yanofsky" "Bertok"
## [19] "German" "Schweber" "Teschner" "Cuellar" "Aaron"
(nationalities <- jj$V2)
## [1] "USA" "USSR" "USSR" "USSR" "TCH" "YUG" "USA" "USSR" "GDR" "HUN"
## [11] "ESP" "ISL" "ARG" "HUN" "HUN" "USA" "CAN" "YUG" "BRA" "ARG"
## [21] "FRG" "COL" "IND"
f <- function(lambda,D){
H3 <- hyper3()
for(i in seq_len(nrow(cur_matches))){
white_player <- cur_matches[i,1]
black_player <- cur_matches[i,2]
result <- cur_matches[i,3]
if(result == "1-0"){ # white player wins
num <- lambda
names(num) <- white_player
} else if(result == "0-1"){ # black player wins
num <- 1
names(num) <- black_player
} else if (result == "1/2-1/2"){ # draw, duh
num <- c(D,D)
names(num) <- c(white_player,black_player)
} else {
stop("this cannot happen")
}
H3[num] %<>% inc()
den <- c(lambda+D,1+D)
names(den) <- c(white_player,black_player)
H3[den] %<>% dec()
}
return(H3)
}
Now use it
H3 <- f(1.1, 1.888)
H3
## log( (Aaron=1)^1 * (Aaron=1.1)^1 * (Aaron=1.888, Bertok=1.888)^1 *
## (Aaron=1.888, Cuellar=1.888)^1 * (Aaron=1.888, Schweber=1.888)^1 *
## (Aaron=1.888, Yanofsky=1.888)^1 * (Aaron=2.888, Benko=2.988)^-1 *
## (Aaron=2.888, Bilek=2.988)^-1 * (Aaron=2.888, Bisguier=2.988)^-1 *
## (Aaron=2.888, Bolbochan=2.988)^-1 * (Aaron=2.888, German=2.988)^-1 *
## (Aaron=2.888, Korchnoi=2.988)^-1 * (Aaron=2.888, Olafsson=2.988)^-1 *
## (Aaron=2.888, Petrosian=2.988)^-1 * (Aaron=2.888, Pomar=2.988)^-1 *
## (Aaron=2.888, Schweber=2.988)^-1 * (Aaron=2.888, Uhlmann=2.988)^-1 *
## (Aaron=2.988, Barcza=2.888)^-1 * (Aaron=2.988, Bertok=2.888)^-1 *
## (Aaron=2.988, Cuellar=2.888)^-1 * (Aaron=2.988, Filip=2.888)^-1 *
## (Aaron=2.988, Fischer=2.888)^-1 * (Aaron=2.988, Geller=2.888)^-1 *
## (Aaron=2.988, Gligoric=2.888)^-1 * (Aaron=2.988, Portisch=2.888)^-1 *
## (Aaron=2.988, Stein=2.888)^-1 * (Aaron=2.988, Teschner=2.888)^-1 *
## (Aaron=2.988, Yanofsky=2.888)^-1 * (Barcza=1)^2 * (Barcza=1.1)^3 *
## (Barcza=1.888, Benko=1.888)^1 * (Barcza=1.888, Bertok=1.888)^1 *
## (Barcza=1.888, Bilek=1.888)^1 * (Barcza=1.888, Bisguier=1.888)^1 *
## (Barcza=1.888, Bolbochan=1.888)^1 * (Barcza=1.888, Geller=1.888)^1 *
## (Barcza=1.888, German=1.888)^1 * (Barcza=1.888, Petrosian=1.888)^1 *
## (Barcza=1.888, Portisch=1.888)^1 * (Barcza=1.888, Schweber=1.888)^1 *
## (Barcza=1.888, Stein=1.888)^1 * (Barcza=1.888, Yanofsky=1.888)^1 *
## (Barcza=2.888, Bertok=2.988)^-1 * (Barcza=2.888, Bilek=2.988)^-1 *
## (Barcza=2.888, Cuellar=2.988)^-1 * (Barcza=2.888, Filip=2.988)^-1 *
## (Barcza=2.888, Fischer=2.988)^-1 * (Barcza=2.888, Geller=2.988)^-1 *
## (Barcza=2.888, Gligoric=2.988)^-1 * (Barcza=2.888, Stein=2.988)^-1 *
## (Barcza=2.888, Teschner=2.988)^-1 * (Barcza=2.888, Yanofsky=2.988)^-1 *
## (Barcza=2.988, Benko=2.888)^-1 * (Barcza=2.988, Bisguier=2.888)^-1 *
## (Barcza=2.988, Bolbochan=2.888)^-1 * (Barcza=2.988, German=2.888)^-1 *
## (Barcza=2.988, Korchnoi=2.888)^-1 * (Barcza=2.988, Olafsson=2.888)^-1 *
## (Barcza=2.988, Petrosian=2.888)^-1 * (Barcza=2.988, Pomar=2.888)^-1 *
## (Barcza=2.988, Portisch=2.888)^-1 * (Barcza=2.988, Schweber=2.888)^-1 *
## (Barcza=2.988, Uhlmann=2.888)^-1 * (Benko=1)^2 * (Benko=1.1)^6 *
## (Benko=1.888, Bolbochan=1.888)^1 * (Benko=1.888, Filip=1.888)^1 *
## (Benko=1.888, Fischer=1.888)^1 * (Benko=1.888, Gligoric=1.888)^1 *
## (Benko=1.888, Korchnoi=1.888)^1 * (Benko=1.888, Petrosian=1.888)^1 *
## (Benko=1.888, Pomar=1.888)^1 * (Benko=1.888, Portisch=1.888)^1 *
## (Benko=1.888, Stein=1.888)^2 * (Benko=1.888, Teschner=1.888)^1 *
## (Benko=2.888, Bertok=2.988)^-1 * (Benko=2.888, Cuellar=2.988)^-1 *
## (Benko=2.888, Filip=2.988)^-1 * (Benko=2.888, Fischer=2.988)^-1 *
## (Benko=2.888, Geller=2.988)^-1 * (Benko=2.888, Gligoric=2.988)^-1 *
## (Benko=2.888, Portisch=2.988)^-1 * (Benko=2.888, Stein=2.988)^-2 *
## (Benko=2.888, Teschner=2.988)^-1 * (Benko=2.888, Yanofsky=2.988)^-1 *
## (Benko=2.988, Bilek=2.888)^-1 * (Benko=2.988, Bisguier=2.888)^-1 *
## (Benko=2.988, Bolbochan=2.888)^-1 * (Benko=2.988, German=2.888)^-1 *
## (Benko=2.988, Korchnoi=2.888)^-1 * (Benko=2.988, Olafsson=2.888)^-1 *
## (Benko=2.988, Petrosian=2.888)^-1 * (Benko=2.988, Pomar=2.888)^-1 *
## (Benko=2.988, Schweber=2.888)^-1 * (Benko=2.988, Uhlmann=2.888)^-1 *
## (Bertok=1.1)^1 * (Bertok=1.888, Bilek=1.888)^1 * (Bertok=1.888,
## Bisguier=1.888)^1 * (Bertok=1.888, Bolbochan=1.888)^1 * (Bertok=1.888,
## Filip=1.888)^1 * (Bertok=1.888, Geller=1.888)^1 * (Bertok=1.888,
## German=1.888)^1 * (Bertok=1.888, Gligoric=1.888)^1 * (Bertok=1.888,
## Pomar=1.888)^1 * (Bertok=1.888, Stein=1.888)^1 * (Bertok=1.888,
## Teschner=1.888)^1 * (Bertok=1.888, Yanofsky=1.888)^1 * (Bertok=2.888,
## Bilek=2.988)^-1 * (Bertok=2.888, Bisguier=2.988)^-1 * (Bertok=2.888,
## Bolbochan=2.988)^-1 * (Bertok=2.888, German=2.988)^-1 * (Bertok=2.888,
## Korchnoi=2.988)^-1 * (Bertok=2.888, Olafsson=2.988)^-1 * (Bertok=2.888,
## Petrosian=2.988)^-1 * (Bertok=2.888, Pomar=2.988)^-1 * (Bertok=2.888,
## Schweber=2.988)^-1 * (Bertok=2.888, Teschner=2.988)^-1 * (Bertok=2.988,
## Cuellar=2.888)^-1 * (Bertok=2.988, Filip=2.888)^-1 * (Bertok=2.988,
## Fischer=2.888)^-1 * (Bertok=2.988, Geller=2.888)^-1 * (Bertok=2.988,
## Gligoric=2.888)^-1 * (Bertok=2.988, Portisch=2.888)^-1 * (Bertok=2.988,
## Stein=2.888)^-1 * (Bertok=2.988, Uhlmann=2.888)^-1 * (Bertok=2.988,
## Yanofsky=2.888)^-1 * (Bilek=1)^2 * (Bilek=1.1)^5 * (Bilek=1.888,
## Bisguier=1.888)^1 * (Bilek=1.888, Bolbochan=1.888)^1 * (Bilek=1.888,
## Filip=1.888)^1 * (Bilek=1.888, Olafsson=1.888)^1 * (Bilek=1.888,
## Portisch=1.888)^1 * (Bilek=1.888, Stein=1.888)^1 * (Bilek=2.888,
## Bisguier=2.988)^-1 * (Bilek=2.888, Bolbochan=2.988)^-1 * (Bilek=2.888,
## German=2.988)^-1 * (Bilek=2.888, Korchnoi=2.988)^-1 * (Bilek=2.888,
## Olafsson=2.988)^-1 * (Bilek=2.888, Petrosian=2.988)^-1 * (Bilek=2.888,
## Pomar=2.988)^-1 * (Bilek=2.888, Portisch=2.988)^-1 * (Bilek=2.888,
## Schweber=2.988)^-1 * (Bilek=2.888, Uhlmann=2.988)^-1 * (Bilek=2.988,
## Cuellar=2.888)^-1 * (Bilek=2.988, Filip=2.888)^-1 * (Bilek=2.988,
## Fischer=2.888)^-1 * (Bilek=2.988, Geller=2.888)^-1 * (Bilek=2.988,
## Gligoric=2.888)^-1 * (Bilek=2.988, Stein=2.888)^-1 * (Bilek=2.988,
## Teschner=2.888)^-1 * (Bilek=2.988, Yanofsky=2.888)^-1 * (Bisguier=1)^1
## * (Bisguier=1.1)^3 * (Bisguier=1.888, Bolbochan=1.888)^1 *
## (Bisguier=1.888, Filip=1.888)^1 * (Bisguier=1.888, Korchnoi=1.888)^1 *
## (Bisguier=1.888, Olafsson=1.888)^1 * (Bisguier=1.888,
## Petrosian=1.888)^1 * (Bisguier=1.888, Pomar=1.888)^1 * (Bisguier=1.888,
## Schweber=1.888)^1 * (Bisguier=1.888, Yanofsky=1.888)^1 *
## (Bisguier=2.888, Bolbochan=2.988)^-1 * (Bisguier=2.888,
## German=2.988)^-1 * (Bisguier=2.888, Korchnoi=2.988)^-1 *
## (Bisguier=2.888, Olafsson=2.988)^-1 * (Bisguier=2.888,
## Petrosian=2.988)^-1 * (Bisguier=2.888, Pomar=2.988)^-1 *
## (Bisguier=2.888, Portisch=2.988)^-1 * (Bisguier=2.888,
## Schweber=2.988)^-1 * (Bisguier=2.888, Uhlmann=2.988)^-1 *
## (Bisguier=2.988, Cuellar=2.888)^-1 * (Bisguier=2.988, Filip=2.888)^-1 *
## (Bisguier=2.988, Fischer=2.888)^-1 * (Bisguier=2.988, Geller=2.888)^-1
## * (Bisguier=2.988, Gligoric=2.888)^-1 * (Bisguier=2.988,
## Stein=2.888)^-1 * (Bisguier=2.988, Teschner=2.888)^-1 *
## (Bisguier=2.988, Yanofsky=2.888)^-1 * (Bolbochan=1)^2 *
## (Bolbochan=1.1)^3 * (Bolbochan=1.888, Gligoric=1.888)^1 *
## (Bolbochan=1.888, Korchnoi=1.888)^1 * (Bolbochan=1.888,
## Olafsson=1.888)^1 * (Bolbochan=1.888, Petrosian=1.888)^1 *
## (Bolbochan=1.888, Portisch=1.888)^1 * (Bolbochan=1.888,
## Schweber=1.888)^1 * (Bolbochan=1.888, Teschner=1.888)^1 *
## (Bolbochan=1.888, Uhlmann=1.888)^1 * (Bolbochan=2.888,
## Cuellar=2.988)^-1 * (Bolbochan=2.888, Filip=2.988)^-1 *
## (Bolbochan=2.888, Fischer=2.988)^-1 * (Bolbochan=2.888,
## Geller=2.988)^-1 * (Bolbochan=2.888, Gligoric=2.988)^-1 *
## (Bolbochan=2.888, Portisch=2.988)^-1 * (Bolbochan=2.888,
## Stein=2.988)^-1 * (Bolbochan=2.888, Uhlmann=2.988)^-1 *
## (Bolbochan=2.888, Yanofsky=2.988)^-1 * (Bolbochan=2.988,
## German=2.888)^-1 * (Bolbochan=2.988, Korchnoi=2.888)^-1 *
## (Bolbochan=2.988, Olafsson=2.888)^-1 * (Bolbochan=2.988,
## Petrosian=2.888)^-1 * (Bolbochan=2.988, Pomar=2.888)^-1 *
## (Bolbochan=2.988, Schweber=2.888)^-1 * (Bolbochan=2.988,
## Teschner=2.888)^-1 * (Cuellar=1)^1 * (Cuellar=1.1)^3 * (Cuellar=1.888,
## Petrosian=1.888)^1 * (Cuellar=1.888, Schweber=1.888)^1 *
## (Cuellar=2.888, Filip=2.988)^-1 * (Cuellar=2.888, Geller=2.988)^-1 *
## (Cuellar=2.888, German=2.988)^-1 * (Cuellar=2.888, Pomar=2.988)^-1 *
## (Cuellar=2.888, Schweber=2.988)^-1 * (Cuellar=2.888, Stein=2.988)^-1 *
## (Cuellar=2.888, Teschner=2.988)^-1 * (Cuellar=2.988, Fischer=2.888)^-1
## * (Cuellar=2.988, Gligoric=2.888)^-1 * (Cuellar=2.988,
## Korchnoi=2.888)^-1 * (Cuellar=2.988, Olafsson=2.888)^-1 *
## (Cuellar=2.988, Petrosian=2.888)^-1 * (Cuellar=2.988,
## Portisch=2.888)^-1 * (Cuellar=2.988, Uhlmann=2.888)^-1 *
## (Cuellar=2.988, Yanofsky=2.888)^-1 * (Filip=1)^3 * (Filip=1.1)^5 *
## (Filip=1.888, Fischer=1.888)^1 * (Filip=1.888, Geller=1.888)^1 *
## (Filip=1.888, Gligoric=1.888)^1 * (Filip=1.888, Olafsson=1.888)^1 *
## (Filip=1.888, Petrosian=1.888)^1 * (Filip=1.888, Pomar=1.888)^1 *
## (Filip=1.888, Portisch=1.888)^1 * (Filip=1.888, Schweber=1.888)^1 *
## (Filip=2.888, German=2.988)^-1 * (Filip=2.888, Korchnoi=2.988)^-1 *
## (Filip=2.888, Olafsson=2.988)^-1 * (Filip=2.888, Petrosian=2.988)^-1 *
## (Filip=2.888, Pomar=2.988)^-1 * (Filip=2.888, Schweber=2.988)^-1 *
## (Filip=2.888, Teschner=2.988)^-1 * (Filip=2.988, Fischer=2.888)^-1 *
## (Filip=2.988, Geller=2.888)^-1 * (Filip=2.988, Gligoric=2.888)^-1 *
## (Filip=2.988, Portisch=2.888)^-1 * (Filip=2.988, Stein=2.888)^-1 *
## (Filip=2.988, Uhlmann=2.888)^-1 * (Filip=2.988, Yanofsky=2.888)^-1 *
## (Fischer=1)^6 * (Fischer=1.1)^7 * (Fischer=1.888, Geller=1.888)^1 *
## (Fischer=1.888, Gligoric=1.888)^1 * (Fischer=1.888, Petrosian=1.888)^1
## * (Fischer=1.888, Pomar=1.888)^1 * (Fischer=1.888, Stein=1.888)^1 *
## (Fischer=1.888, Teschner=1.888)^1 * (Fischer=1.888, Uhlmann=1.888)^1 *
## (Fischer=2.888, Geller=2.988)^-1 * (Fischer=2.888, Gligoric=2.988)^-1 *
## (Fischer=2.888, Stein=2.988)^-1 * (Fischer=2.888, Teschner=2.988)^-1 *
## (Fischer=2.888, Yanofsky=2.988)^-1 * (Fischer=2.988, German=2.888)^-1 *
## (Fischer=2.988, Korchnoi=2.888)^-1 * (Fischer=2.988, Olafsson=2.888)^-1
## * (Fischer=2.988, Petrosian=2.888)^-1 * (Fischer=2.988, Pomar=2.888)^-1
## * (Fischer=2.988, Portisch=2.888)^-1 * (Fischer=2.988,
## Schweber=2.888)^-1 * (Fischer=2.988, Uhlmann=2.888)^-1 * (Geller=1)^4 *
## (Geller=1.1)^6 * (Geller=1.888, German=1.888)^1 * (Geller=1.888,
## Gligoric=1.888)^1 * (Geller=1.888, Korchnoi=1.888)^1 * (Geller=1.888,
## Olafsson=1.888)^1 * (Geller=1.888, Petrosian=1.888)^1 * (Geller=1.888,
## Schweber=1.888)^1 * (Geller=2.888, German=2.988)^-1 * (Geller=2.888,
## Olafsson=2.988)^-1 * (Geller=2.888, Petrosian=2.988)^-1 *
## (Geller=2.888, Pomar=2.988)^-1 * (Geller=2.888, Schweber=2.988)^-1 *
## (Geller=2.888, Teschner=2.988)^-1 * (Geller=2.988, Gligoric=2.888)^-1 *
## (Geller=2.988, Korchnoi=2.888)^-1 * (Geller=2.988, Portisch=2.888)^-1 *
## (Geller=2.988, Stein=2.888)^-1 * (Geller=2.988, Uhlmann=2.888)^-1 *
## (Geller=2.988, Yanofsky=2.888)^-1 * (German=1)^1 * (German=1.1)^2 *
## (German=1.888, Gligoric=1.888)^1 * (German=1.888, Korchnoi=1.888)^1 *
## (German=1.888, Schweber=1.888)^1 * (German=1.888, Stein=1.888)^1 *
## (German=1.888, Teschner=1.888)^1 * (German=2.888, Gligoric=2.988)^-1 *
## (German=2.888, Korchnoi=2.988)^-1 * (German=2.888, Olafsson=2.988)^-1 *
## (German=2.888, Petrosian=2.988)^-1 * (German=2.888, Portisch=2.988)^-1
## * (German=2.888, Uhlmann=2.988)^-1 * (German=2.888, Yanofsky=2.988)^-1
## * (German=2.988, Pomar=2.888)^-1 * (German=2.988, Schweber=2.888)^-1 *
## (German=2.988, Stein=2.888)^-1 * (German=2.988, Teschner=2.888)^-1 *
## (Gligoric=1)^4 * (Gligoric=1.1)^3 * (Gligoric=1.888, Korchnoi=1.888)^1
## * (Gligoric=1.888, Petrosian=1.888)^1 * (Gligoric=1.888, Pomar=1.888)^1
## * (Gligoric=1.888, Portisch=1.888)^1 * (Gligoric=1.888,
## Teschner=1.888)^1 * (Gligoric=1.888, Uhlmann=1.888)^1 *
## (Gligoric=2.888, Pomar=2.988)^-1 * (Gligoric=2.888, Stein=2.988)^-2 *
## (Gligoric=2.888, Teschner=2.988)^-1 * (Gligoric=2.888,
## Yanofsky=2.988)^-1 * (Gligoric=2.988, Korchnoi=2.888)^-1 *
## (Gligoric=2.988, Olafsson=2.888)^-1 * (Gligoric=2.988,
## Petrosian=2.888)^-1 * (Gligoric=2.988, Portisch=2.888)^-1 *
## (Gligoric=2.988, Schweber=2.888)^-1 * (Gligoric=2.988, Stein=2.888)^-1
## * (Gligoric=2.988, Uhlmann=2.888)^-1 * (Korchnoi=1)^1 *
## (Korchnoi=1.1)^8 * (Korchnoi=1.888, Petrosian=1.888)^1 *
## (Korchnoi=1.888, Stein=1.888)^1 * (Korchnoi=1.888, Uhlmann=1.888)^1 *
## (Korchnoi=1.888, Yanofsky=1.888)^1 * (Korchnoi=2.888,
## Portisch=2.988)^-1 * (Korchnoi=2.888, Stein=2.988)^-1 *
## (Korchnoi=2.888, Uhlmann=2.988)^-1 * (Korchnoi=2.888,
## Yanofsky=2.988)^-1 * (Korchnoi=2.988, Olafsson=2.888)^-1 *
## (Korchnoi=2.988, Petrosian=2.888)^-1 * (Korchnoi=2.988, Pomar=2.888)^-1
## * (Korchnoi=2.988, Schweber=2.888)^-1 * (Korchnoi=2.988,
## Teschner=2.888)^-1 * (Olafsson=1)^2 * (Olafsson=1.1)^6 *
## (Olafsson=1.888, Pomar=1.888)^1 * (Olafsson=1.888, Portisch=1.888)^1 *
## (Olafsson=1.888, Yanofsky=1.888)^1 * (Olafsson=2.888,
## Petrosian=2.988)^-1 * (Olafsson=2.888, Portisch=2.988)^-1 *
## (Olafsson=2.888, Uhlmann=2.988)^-1 * (Olafsson=2.888,
## Yanofsky=2.988)^-1 * (Olafsson=2.988, Pomar=2.888)^-1 *
## (Olafsson=2.988, Schweber=2.888)^-1 * (Olafsson=2.988, Stein=2.888)^-1
## * (Olafsson=2.988, Teschner=2.888)^-1 * (Petrosian=1.1)^8 *
## (Petrosian=1.888, Portisch=1.888)^1 * (Petrosian=1.888, Stein=1.888)^1
## * (Petrosian=1.888, Uhlmann=1.888)^1 * (Petrosian=1.888,
## Yanofsky=1.888)^1 * (Petrosian=2.888, Portisch=2.988)^-1 *
## (Petrosian=2.888, Stein=2.988)^-1 * (Petrosian=2.888, Uhlmann=2.988)^-1
## * (Petrosian=2.888, Yanofsky=2.988)^-1 * (Petrosian=2.988,
## Pomar=2.888)^-1 * (Petrosian=2.988, Schweber=2.888)^-1 *
## (Petrosian=2.988, Teschner=2.888)^-1 * (Pomar=1)^1 * (Pomar=1.1)^6 *
## (Pomar=1.888, Portisch=1.888)^1 * (Pomar=1.888, Schweber=1.888)^1 *
## (Pomar=1.888, Stein=1.888)^1 * (Pomar=2.888, Portisch=2.988)^-1 *
## (Pomar=2.888, Schweber=2.988)^-1 * (Pomar=2.888, Uhlmann=2.988)^-1 *
## (Pomar=2.988, Stein=2.888)^-1 * (Pomar=2.988, Teschner=2.888)^-1 *
## (Pomar=2.988, Yanofsky=2.888)^-1 * (Portisch=1)^4 * (Portisch=1.1)^4 *
## (Portisch=2.888, Stein=2.988)^-1 * (Portisch=2.888, Teschner=2.988)^-1
## * (Portisch=2.888, Yanofsky=2.988)^-1 * (Portisch=2.988,
## Schweber=2.888)^-1 * (Portisch=2.988, Uhlmann=2.888)^-1 *
## (Schweber=1.1)^2 * (Schweber=1.888, Yanofsky=1.888)^1 *
## (Schweber=2.888, Uhlmann=2.988)^-1 * (Schweber=2.988, Stein=2.888)^-1 *
## (Schweber=2.988, Teschner=2.888)^-1 * (Schweber=2.988,
## Yanofsky=2.888)^-1 * (Stein=1)^5 * (Stein=1.1)^6 * (Stein=2.888,
## Teschner=2.988)^-1 * (Stein=2.988, Uhlmann=2.888)^-1 * (Stein=2.988,
## Yanofsky=2.888)^-1 * (Teschner=1)^2 * (Teschner=1.1)^1 *
## (Teschner=1.888, Yanofsky=1.888)^1 * (Teschner=2.888, Uhlmann=2.988)^-1
## * (Teschner=2.988, Yanofsky=2.888)^-1 * (Uhlmann=1)^4 * (Uhlmann=1.1)^6
## * (Uhlmann=2.888, Yanofsky=2.988)^-1 * (Yanofsky=1.1)^3)
summary(H3)
## A hyper3 object of size 23.
## pnames: Aaron Barcza Benko Bertok Bilek Bisguier Bolbochan Cuellar Filip Fischer Geller German Gligoric Korchnoi Olafsson Petrosian Pomar Portisch Schweber Stein Teschner Uhlmann Yanofsky
## Number of brackets: 405
## Sum of powers: 0
##
## Table of bracket lengths:
## 1 2
## 42 363
##
## Table of powers:
## -2 -1 1 2 3 4 5 6 7 8
## 2 252 117 9 7 5 3 7 1 2
##
## Table of weights:
## 1 1.1 1.888 2.888 2.988
## 19 23 218 254 254
equalp.test(H3,n=1)
##
## Constrained support maximization
##
## data: H3
## null hypothesis: Aaron = Barcza = Benko = Bertok = Bilek = Bisguier = Bolbochan = Cuellar = Filip = Fischer = Geller = German = Gligoric = Korchnoi = Olafsson = Petrosian = Pomar = Portisch = Schweber = Stein = Teschner = Uhlmann = Yanofsky
## null estimate:
## Aaron Barcza Benko Bertok Bilek Bisguier Bolbochan Cuellar
## 0.043478 0.043478 0.043478 0.043478 0.043478 0.043478 0.043478 0.043478
## Filip Fischer Geller German Gligoric Korchnoi Olafsson Petrosian
## 0.043478 0.043478 0.043478 0.043478 0.043478 0.043478 0.043478 0.043478
## Pomar Portisch Schweber Stein Teschner Uhlmann Yanofsky
## 0.043478 0.043478 0.043478 0.043478 0.043478 0.043478 0.043478
## (argmax, constrained optimization)
## Support for null: -297.85 + K
##
## alternative hypothesis: sum p_i=1
## alternative estimate:
## Aaron Barcza Benko Bertok Bilek Bisguier Bolbochan
## 3.9573e-05 3.5404e-04 4.3809e-04 3.0836e-05 2.9394e-04 1.2877e-04 4.9684e-04
## Cuellar Filip Fischer Geller German Gligoric Korchnoi
## 6.6869e-05 1.0731e-03 5.7130e-01 1.3111e-03 6.7143e-05 4.4481e-04 1.0783e-03
## Olafsson Petrosian Pomar Portisch Schweber Stein Teschner
## 4.1238e-04 4.2035e-01 4.2064e-04 3.4757e-04 5.3196e-05 8.2187e-04 5.9774e-05
## Uhlmann Yanofsky
## 3.1082e-04 1.0557e-04
## (argmax, free optimization)
## Support for alternative: -255.59 + K
##
## degrees of freedom: 22
## support difference = 42.259
## p-value: 2.8839e-09
m1121 <- maxp(f(1.1,2.1), n=1, give=TRUE)
m1123 <- maxp(f(1.1,2.3), n=1, give=TRUE)
pie(m1121$par)
A break here.
profl <- function(v){
lambda <- v[1]
D <- v[2]
H <- f(lambda,v)
return(loglik(maxp(H,n=1),H))
}
Now apply profl():
At this point the Rmd file fails* (probably due to recent defensive programming). So I will comment out all the R code from here on in, and fix it when I get a minute.
# profl(c(1.1,2.1))
# np <- 4
# lambda <- seq(from=0.1, to=1.5, len=np)
# D <- seq(from=0.1, to=0.4, len=np)
# jj <- as.matrix(expand.grid(lambda, D))
# LL <- apply(jj, 1, profl)
# LL
# LL <- LL - max(LL)
# m <- matrix(LL,np,np)
# m
# filled.contour(lambda,D,m,xlab="lambda",ylab="D",nlevels=40)
# res <- cur_matches$V3
# res
# table(res)
# white_wins <- cur_matches[res=="1-0" ,]
# black_wins <- cur_matches[res=="0-1" ,]
# draws <- cur_matches[res=="1/2-1/2",]
# (players <- unique(sort(c(cur_matches[,1],cur_matches[,2]))))
# jj <- rep(0,length(players))
# names(jj) <- players
# jj
# plays_white_wins <- jj
# plays_white_lose <- jj
# plays_white_draw <- jj
# plays_black_wins <- jj
# plays_black_lose <- jj
# plays_black_draw <- jj
# for(i in seq_len(nrow(cur_matches))){
# white_player <- cur_matches[i,1]
# black_player <- cur_matches[i,2]
# result <- cur_matches[i,3]
#
# if(result == "1-0"){
# plays_white_wins[white_player] %<>% inc
# plays_black_lose[black_player] %<>% inc
# } else if(result == "0-1"){
# plays_white_lose[white_player] %<>% inc
# plays_black_wins[black_player] %<>% inc
# } else if(result == "1/2-1/2"){
# plays_white_draw[white_player] %<>% inc
# plays_black_draw[black_player] %<>% inc
# }
# }
#
# plays_white_wins
# plays_white_lose
# plays_black_wins
# plays_black_lose
Now we need some way to describe each player’s wins/losses playing white and black:
# f <- function(player){
# out <- matrix(c(
# plays_white_wins[player], plays_white_lose[player], plays_white_draw[player],
# plays_black_wins[player], plays_black_lose[player], plays_black_draw[player]
# ),byrow=TRUE,2,3)
# dimnames(out) <- list(colour=c("white","black"),match=c("win","lose","draw"))
# return(out)
# }
# f("Fischer")
# f("Korchnoi")
# f("Petrosian")
# M <- f("Aaron")*0
# for(p in players){ M <- M + f(p) }
# M
hyper2 Package: Likelihood Functions for Generalized Bradley-Terry Models.” The R Journal 9 (2): 429–39.