Returns a rank vector suitable for interpretation with race().

rrace(strengths)

Arguments

strengths

Named vector with names being players and values being their Bradley-Terry strengths

Details

Uses a simple recursive system to generate the ranks.

Value

Returns a character vector with entries corresponding to the competitor. The first element is the winner, the second the runner-up, and so on, until the final element is the last to cross the finishing line.

Author

Robin K. S. Hankin

See also

Examples


o <- c(a=0.4, b=0.3, c=0.2, d=0.1)
rrace(o)
#> [1] "c" "d" "a" "b"

suppfun(rrace(o))
#> log((a + b + c + d)^-1 * (a + c + d)^-1 * (a + d)^-1 * b * c * d)

as.ranktable(t(replicate(10, rrace(o)))) # same as rrank(10,o)
#> A ranktable:
#>       c1 c2 c3 c4
#>  [1,] a  c  d  b 
#>  [2,] d  b  a  c 
#>  [3,] c  b  a  d 
#>  [4,] b  a  c  d 
#>  [5,] a  c  d  b 
#>  [6,] a  d  c  b 
#>  [7,] a  b  c  d 
#>  [8,] b  c  a  d 
#>  [9,] a  b  c  d 
#> [10,] a  d  b  c