set.seed(0) knitr::opts_chunk$set(echo = TRUE) library("hyper2") library("magrittr") options("digits" = 5)
knitr::include_graphics(system.file("help/figures/hyper2.png", package = "hyper2"))
To cite the hyper2
package in publications, please use @hankin2017_rmd.
Function keep_flawed()
can be confusing. Originally, the package
included a function keep()
but this used flawed logic, hence the
name of its replacement. Here is a tiny example that should clarify
things. We will use a subset of skating_table
:
jj <- skating_table[1:3,1:6] rownames(jj) <- letters[1:3] jj
Above, rows of object jj
correspond to competitors and columns to
judges. Object jj
does not function as a rank table because the
entries are not sequential (judge J2
, for example, has no
second-ranked competitor).
We could convert explicitly:
a <- apply(jj,2,rank) a
So each column 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(a) OT
(function ordertable2supp()
does this automatically, so
ordertable2supp(jj)
would have given the same result). 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"))
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")
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.
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.