pick.RdA consistent suite of functions that give likelihood functions for a
single pairwise trial between specified sets of competitors;
supercedes trial().
pick(winners, allplayers)
pass(losers, allplayers)
beats(winners, losers)
loses(losers, winners)
trial(winners, players, val=1)Consider a competition between two disjoint sets of players, \(A=\left\lbrace a_1,\ldots, a_n\right\rbrace\) and \(B=\left\lbrace b_1,\ldots, b_m\right\rbrace\).
If \(A\) wins the likelihood function will be \(\frac{a_1+\ldots+a_n}{a_1+\ldots+a_n+b_1+\ldots+b_m}\) and if \(B\) wins the likelihood function will be \(\frac{b_1+\ldots+b_m}{a_1+\ldots+a_n+b_1+\ldots+b_m}\).
We can represent a win for \(A\) with either pick(A, c(A,B)) or
beats(A,B); or pass(B, c(A,B)) or loses(B,A)
Function trial() will be deprecated soon. It is an inefficient
synonym for pick().
The trial() function is used in inst/kka.Rmd (but will
shortly be changed).
pick(letters[1:2], letters[1:5]) # field abcde; ab beats cde
#> log( (a + b) * (a + b + c + d + e)^-1)
pass(letters[1:2], letters[1:5]) # field abcde; ab loses to cde
#> log((a + b + c + d + e)^-1 * (c + d + e))
beats(letters[1:2], letters[3:5]) # field abcde; ab beats cde
#> log( (a + b) * (a + b + c + d + e)^-1)
loses(letters[1:2], letters[3:5]) # field abcde; ab loses to cde
#> log((a + b + c + d + e)^-1 * (c + d + e))
monster <- "home"
players <- letters[1:4]
H <- hyper2()
H <- H + pick(c("a", "b", monster), c(players, monster))
H <- H + pick(c("a", "d", monster), c(players, monster))
H <- H + pick(c("a", monster), c(players, monster))
H <- H + pass(c("c", "d", monster), c(players, monster))
## above see how pick() / pass() is better.
monster <- "cheating"
## Now new players e and f join the chat:
H <- H + beats(c("a", "e"), c("b", "c"))
H <- H + beats(c("a", "c", monster), c("b", "d"))
H <- H + beats(c("e", "f"), c("a", "b", monster))
H <- H + loses(c("a", "f", monster), c("d", "e"))
## above, see beats/loses are more convenient than pick/pass
H
#> log( (a + b) * (a + b + c + cheating + d)^-1 * (a + b + c + d +
#> home)^-4 * (a + b + c + e)^-1 * (a + b + cheating + e + f)^-1 * (a + b
#> + home) * (a + c + cheating) * (a + cheating + d + e + f)^-1 * (a + d +
#> home) * (a + e) * (a + home) * (d + e) * (e + f))