Colley method
library( mau )
# Example without ties
d <- 10
n <- matrix( sample( x = 0:5, size = d * d, replace = TRUE ), d, d )
n <- n + t( n )
diag( n ) <- 0
g <- rowSums( n )
# Number of win matches for each team
w <- sapply( 1:d, FUN = function( i ) sample( x = 1:g[i], size = 1, replace = TRUE ) )
# Number of lost matches for ech team
l <- rowSums( n ) - w
r <- colley_rating( n, w, l )
print( r )
## [[1]]
## [1] 10 9 1 3 7 5 4 8 6 2
##
## [[2]]
## [1] -2.954542 -2.916942 -2.195868 -2.541249 -2.855738 -2.697853 -2.683378
## [8] -2.904877 -2.740441 -2.509112
Offensive - Defensive rating method
A <- matrix( c( 0, 7, 21, 7, 0,
52, 0, 34, 25, 27,
24, 16, 0, 7, 3,
38, 17, 5, 0, 14,
45, 7, 30, 52, 0 ),
nrow = 5, ncol = 5 )
r <- od_rating( A )
print( r )
## $r
## [,1]
## [1,] 20.09702
## [2,] 188.78533
## [3,] 41.79470
## [4,] 84.80018
## [5,] 279.80681
##
## $o
## [,1]
## [1,] 33.98927
## [2,] 151.57374
## [3,] 48.66316
## [4,] 82.04849
## [5,] 114.83557
##
## $d
## [,1]
## [1,] 1.6912590
## [2,] 0.8028894
## [3,] 1.1643379
## [4,] 0.9675509
## [5,] 0.4104102
##
## $iter
## [1] 27
Borda counts
library( mau )
m <- 10
n <- 5
R <- matrix( runif( m * n ), m, n )
v <- sample( x = 50:100, size = n )
r <- borda_count( R, v )
print( r )
## [[1]]
## [1] 4 9 1 10 6 5 3 2 8 7
##
## [[2]]
## [1] 2153 1325 2788 1161 1917 2150 2174 2688 1658 1676