rrace.RdReturns a rank vector suitable for interpretation with race().
rrace(strengths)Uses a simple recursive system to generate the ranks.
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.
o <- c(a=0.4, b=0.3, c=0.2, d=0.1)
rrace(o)
#> [1] "b" "d" "a" "c"
suppfun(rrace(o))
#> log( a * (a + b + c + d)^-1 * b * (b + c + d)^-1 * c * (c + d)^-1)
table(replicate(100,rrace(o)[1])) # should be about 40% "a"
#>
#> a b c d
#> 36 33 22 9
as.ranktable(t(replicate(10, rrace(o)))) # same as rrank(10,o)
#> A ranktable:
#> c1 c2 c3 c4
#> [1,] c d b a
#> [2,] b c a d
#> [3,] b a c d
#> [4,] d a b c
#> [5,] a d b c
#> [6,] a c d b
#> [7,] a c b d
#> [8,] d b a c
#> [9,] a d b c
#> [10,] d a b c