To cite the hyper2 package in publications, please use Hankin (2017). This vignette showcases package idiom that I find cool.

setweight() plays nicely with beats() et seq:

beats("a","b") |> setweight("a", 1.888)
## log( (a=1.888)^1 * (a=1.888, b=1)^-1)

As of fixing issue 231, we can use swait():

beats("a","b") |> swait(a=0.9)
## log( (a=0.9)^1 * (a=0.9, b=1)^-1)

0.1 advantage()

Function pwa() is nice but a bit cumbersome. Look:

(H <- suppfun(letters[1:5]))
## log( a * (a + b + c + d + e)^-1 * b * (b + c + d + e)^-1 * c * (c + d + e)^-1 * d * (d +
## e)^-1)
H |> advantage(c="steroids")
## log( a * (a + b + c + d + e + steroids)^-1 * b * (b + c + d + e + steroids)^-1 * (c + d +
## e + steroids)^-1 * (c + steroids) * d * (d + e)^-1)

Nice, eh?

The above is good for a single competitor with a single advantage. We would need hyper3 objects if more than one competitor had the same advantage:

suppfun(letters[1:4]) |> pwa23(a='cheat', b='cheat', a='steroids')
## log( (a=1, b=1, c=1, cheat=2, d=1, steroids=1)^-1 * (a=1, cheat=1, steroids=1)^1 * (b=1,
## c=1, cheat=1, d=1)^-1 * (b=1, cheat=1)^1 * (c=1)^1 * (c=1, d=1)^-1)

Above we see

\[ \frac{a}{a+b+c+d}\cdot \frac{b}{ b+c+d}\cdot \frac{c}{ c+d}\longrightarrow \frac{a+\text{cheat}+\text{steroids}}{a+b+c+d+2\text{cheat}+\text{steroids}}\cdot \frac{b+\text{cheat}}{ b+c+d+\text{cheat}}\cdot \frac{c}{ c+d} \]

1 Distributivity of pwa23()

I have been wondering whether pwa23() is linear in the sense that it commutes past addition:

H1 <- suppfun(letters[c(1,2,3,4,5)])
H2 <- suppfun(letters[c(3,2,1,4,5)])

bad <- letters[2:4]

Ha <- (H1 |> pwa23_multiple(bad)) + (H2 |> pwa23_multiple(bad))
Hb <- (H1+H2) |> pwa23_multiple(bad)

We can see that Ha is f(H1) + f(H2) and Hb is f(H1+H2). Are they the same?

Ha == Hb
## [1] TRUE

References

Hankin, R. K. S. 2017. “Partial Rank Data with the hyper2 Package: Likelihood Functions for Generalized Bradley-Terry Models.” The R Journal 9 (2): 429–39.