Objects of class hyper3
are a generalization of hyper2
objects
that allow the brackets to contain weighted probabilities.
As a motivating example, suppose two players with Bradley-Terry
strengths p_1,p_2 play chess where we quantify the first-mover
advantage with a term omitted. If p_1 plays
white a+b times with a wins and b losses, and
plays black c+d times with c wins and d
losses, then a sensible likelihood function might be
( p_1 p_1 + p_2)^a
(p_2 p_1 + p_2)^b
(p_1 p_1 + p_2)^c
( p_2p_1 + p_2)^d
omitted: see PDF
If a=1,b=2,c=3,d=4 and =1.3omitted appropriate
package idiom might be:
H <- hyper3()
H[c(p1=1.3)] %<>% inc(1) # a=1
H[c(p2=1)] %<>% inc(2) # b=2
H[c(p1=1.3,p2=1)] %<>% dec(3) # a+b=1+2=3
H[c(p1=1)] %<>% inc(3) # c=3
H[c(p2=1.3)] %<>% inc(4) # d=4
H[c(p1=1,p2=1.3)] %<>% dec(7) # c+d=3+4=7
H
> log( (p1=1)^3 * (p1=1, p2=1.3)^-7 * (p1=1.3)^1 * (p1=1.3, p2=1)^-3 *
(p2=1)^2 * (p2=1.3)^4)