pairwise {hyper2}R Documentation

Pairwise comparisons

Description

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.

Usage

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)

Arguments

M

Matrix of pairwise comparison results

maxit

Maximum number of iterations

start

Starting value for iteration; if missing, use equalp()

tol

Numerical tolerance for stopping criterion

give

Boolean with default FALSE meaning to return the evaluate and TRUE meaning to return all iterations

home_games_won, away_games_won

Matrices showing home games won and away games won

lambda

The home ground advantage (or white advantage in chess)

D

Weight of draw

A

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

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.

Note

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.

Author(s)

Robin K. S. Hankin

References

See Also

maxp

Examples

 #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
# e.g. Agassi beats Becker 10 times and loses 4 times
pairwise(M)
zermelo(M)
# 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)
# home_away3(M2,lambda=1.2)  # works but takes too long (~3s)
home_away3(M2[1:3,1:3],lambda=1.2) 

M <- kka_array[,,1] + 1i*kka_array[,,3] # ignore draws
home_away(M)
# home_away3(M,lambda=1.3)  # works but takes too long (~3s)

white_draw3(kka_array,1.88,1.11)

[Package hyper2 version 3.1-0 Index]