To cite the hyper2 package in publications, please use Hankin (2017). Many years ago, the hyper2 package included a function called keep() but this used flawed logic. So I renamed it keep_flawed().

Here I set out some examples that should clarify the problems with keep() (the ordertable used below can be obtained from skating_table[1:3,1:6] using the bespoke extraction method [.ordertable(), but that is not what this document is discussing).

x <-
    as.ordertable(matrix(
        c(1,3,2,3,1,2,3,1,2,3,1,2,1,3,2,2,1,3),
        3,6,  # dimensions
        dimnames = list(
            c("a","b","c"),
            c("J1","J2","J3","J4","J5","J6"))
    ))
x
## An ordertable:
##   J1 J2 J3 J4 J5 J6
## a  1  3  3  3  1  2
## b  3  1  1  1  3  1
## c  2  2  2  2  2  3

Above, each column of x is a permutation of 123. So, for example judge 1 ranked a first, b third, and c second. We can coerce to a hyper2 object with ordertable2supp():

OT <- ordertable2supp(x)
OT
## log(a^3 * (a + b + c)^-6 * (a + c)^-4 * b^4 * (b + c)^-2 * c^5)

Now suppose we are interested only in the first two competitors, a and b, which are competitors 1 and 2.

keep_flawed(OT, c("a","b"))
## Warning in print.hyper2(x): powers have nonzero sum
## log(a^-1 * (a + b)^-6 * b^2)

Above, function keep_flawed() has effectively taken OT, set c=0, and then discarded the c^5 term. This process, while natural from a computing perspective, has the effect of replacing (a+c)^-4 with a^-4, which has no natural probabilistic interpretation: we are ignoring c’s victories but nevertheless interpreting the joint strength term on the denominator [viz a+c] as a loss for a.

What happens if we keep only a?

keep_flawed(OT,"a")
## Warning in print.hyper2(x): powers have nonzero sum
## log(a^-7)

the above support function is meaningless (?) as, having set b=0 we then treat a+b as simply a which sort of makes sense until we realise that (a+b)^-6 reduces to a^-6. It is as though a has wins only 3 trials out of 8, against a competitor of known zero strength whose (impossible) wins we ignore. Perhaps this has a natural interpretation in probability, but if so I don’t see it.

Conclusions

It does not seem possible to take a hyper2 object and discard certain players. It seems that the only way to discard players is to work with the original observation, discard players in the dataset according to some criterion, and coerce to a likelihood function.

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.