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] 4 5 1 8 7 9 2 3 10 6
##
## [[2]]
## [1] 0.9743290 0.9438679 1.2472056 0.5080681 0.7962257 0.4738533 1.1775906
## [8] 1.1011904 0.4446450 0.8330244
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] 5 3 2 9 4 6 10 8 7 1
##
## [[2]]
## [1] 2572 2962 3240 1556 2635 2438 1372 2143 2278 3554