pairwise.Rd
Function pairwise()
takes a matrix of pairwise comparisons and
returns a hyper2
likelihood function. Function
zermelo()
gives a standard iterative procedure for likelihood
maximization of pairwise Bradley-Terry likelihoods (such as those
produced by function pairwise()
).
Function home_away()
takes two matrices, one for home wins and
one for away wins. It returns a hyper2
support function that
includes a home advantage ghost. Function home_away3()
is the
same, but returns a hyper3
object. A complex matrix is
interpreted as real parts being the home wins and imaginary parts away
wins.
Function white_draw3()
returns a hyper3
likelihood
function for pairwise comparisons, one of whom has a home team-type
advantage (white player in the case of chess). It is designed to
work with an array of dimensions \(n\times n\times 3\),
where \(n\) is the number of players. It is used in
inst/kka.Rmd
to create chess3
likelihood function.
pairwise(M)
zermelo(M, maxit = 100, start, tol = 1e-10, give = FALSE)
home_away(home_games_won, away_games_won)
home_away3(home_games_won, away_games_won,lambda)
white_draw3(A,lambda,D)
Matrix of pairwise comparison results
Maximum number of iterations
Starting value for iteration; if missing, use
equalp()
Numerical tolerance for stopping criterion
Boolean with default FALSE
meaning to return the
evaluate and TRUE
meaning to return all iterations
Matrices showing home games won and away games won
The home ground advantage (or white advantage in chess)
Weight of draw
Array of dimension n*n*3
, with A[,,i]
corresponding to white wins, white draws, and white losses for
i=1,2,3
. The canonical example would be kka_array
,
see inst/kka.Rmd
for details
In function zermelo()
, the diagonal is disregarded.
If home_games_won
is complex, then the real parts of the
entries are interpreted as home games won, and the imaginary parts as
away games won.
D. R. Hunter 2004. “MM algorithms for generalized Bradley-Terry models”. The Annals of Statistics, volume 32, number 1, pages 384–406
S. Borozki and others 2016. “An application of incomplete pairwise
comparison matrices for ranking top tennis
players”. arXiv:1611.00538v1
10.1016/j.ejor.2015.06.069
R. R. Davidson and R. J. Beaver 1977. “On extending the Bradley-Terry model to incorporate within-pair order effects”. Biometrics, 33:693–702
An extended discussion of pairwise()
is given in
inst/zermelo.Rmd
and also inst/karate.Rmd
. Functions
home_away()
and home_away3()
are described and used in
inst/home_advantage.Rmd
; see Davidson and Beaver 1977.
Experimental function pair3()
is now removed as
dirichlet3()
is more general and has nicer idiom;
pair3(a=4, b=3, lambda=1.88)
and dirichlet3(c(a=4, b=3),
1.88)
give identical output.
#Data is the top 5 players from Borozki's table 1
M <- matrix(c(
0,10,0, 2,5,
4, 0,0, 6,6,
0, 0,0,15,0,
0, 8,0, 0,7,
1 ,0,3, 0,0
),5,5,byrow=TRUE)
players <- c("Agassi","Becker","Borg","Connors","Courier")
dimnames(M) <- list(winner=players,loser=players)
M
#> loser
#> winner Agassi Becker Borg Connors Courier
#> Agassi 0 10 0 2 5
#> Becker 4 0 0 6 6
#> Borg 0 0 0 15 0
#> Connors 0 8 0 0 7
#> Courier 1 0 3 0 0
# e.g. Agassi beats Becker 10 times and loses 4 times
pairwise(M)
#> log(Agassi^17 * (Agassi + Becker)^-14 * (Agassi + Connors)^-2 * (Agassi
#> + Courier)^-6 * Becker^16 * (Becker + Connors)^-14 * (Becker +
#> Courier)^-6 * Borg^15 * (Borg + Connors)^-15 * (Borg + Courier)^-3 *
#> Connors^15 * (Connors + Courier)^-7 * Courier^4)
zermelo(M)
#> Agassi Becker Borg Connors Courier
#> 0.30345344 0.11650669 0.44416163 0.10115551 0.03472273
# maxp(pairwise(M)) # should be identical (takes ~10s to run)
M2 <- matrix(c(NA,19+2i,17,11+2i,16+5i,NA,12+4i,12+6i,12+2i,19+10i,
NA,12+4i,11+2i,16+2i,11+7i,NA),4,4)
teams <- LETTERS[1:4]
dimnames(M2) <- list("@home" = teams,"@away"=teams)
home_away(M2)
#> log(A^4 * (A + B + home)^-42 * (A + C + home)^-31 * (A + D + home)^-26
#> * (A + home)^39 * B^15 * (B + C + home)^-45 * (B + D + home)^-36 * (B +
#> home)^54 * C^16 * (C + D + home)^-34 * (C + home)^40 * D^11 * (D +
#> home)^35)
# home_away3(M2,lambda=1.2) # works but takes too long (~3s)
home_away3(M2[1:3,1:3],lambda=1.2)
#> log( (A=1)^2 * (A=1, B=1.2)^-21 * (A=1, C=1.2)^-17 * (A=1.2)^28 *
#> (A=1.2, B=1)^-21 * (A=1.2, C=1)^-14 * (B=1)^9 * (B=1, C=1.2)^-16 *
#> (B=1.2)^38 * (B=1.2, C=1)^-29 * (C=1)^12 * (C=1.2)^29)
M <- kka_array[,,1] + 1i*kka_array[,,3] # ignore draws
home_away(M)
#> log(Anand^15 * (Anand + Karpov + home)^-43 * (Anand + Kasparov +
#> home)^-34 * (Anand + home)^24 * Karpov^12 * (Karpov + Kasparov +
#> home)^-64 * (Karpov + home)^25 * Kasparov^20 * (Kasparov + home)^45)
# home_away3(M,lambda=1.3) # works but takes too long (~3s)
white_draw3(kka_array,1.88,1.11)
#> log( (Anand=1)^15 * (Anand=1.11, Karpov=1.11)^49 * (Anand=1.11,
#> Kasparov=1.11)^46 * (Anand=1.88)^24 * (Anand=2.11, Karpov=2.99)^-49 *
#> (Anand=2.11, Kasparov=2.99)^-43 * (Anand=2.99, Karpov=2.11)^-43 *
#> (Anand=2.99, Kasparov=2.11)^-37 * (Karpov=1)^12 * (Karpov=1.11,
#> Kasparov=1.11)^129 * (Karpov=1.88)^25 * (Karpov=2.11,
#> Kasparov=2.99)^-94 * (Karpov=2.99, Kasparov=2.11)^-99 * (Kasparov=1)^20
#> * (Kasparov=1.88)^45)