The best way to describe this function is with an example:
> x <- c(d=2,a=3,b=1,c=4)
> x
d a b c
2 3 1 4
In the above, we see x
is an order vector showing that d
came second, a
came third, b
came first, and c
came
fourth. This is difficult to deal with because one has to search
through the vector to find a particular competitor, or a particular
rank. This would be harder if the vector was longer.
If we wish to answer the question “where did competitor a
come? where did b
come?” we would want an order vector
in which the competitors are in alphabetical order. This is
accomplished by ordertrans()
:
> o <- ordertrans(x)
> o
a b c d
3 1 4 2
(this is equivalent to o <- x[order(names(x))]
). Object o
contains the same information as x
, but presented differently.
This says that a
came third, b
came first, c
came
fourth, and d
came second. In particular, the Plackett-Luce
order statistic is identical:
> ordervec2supp(x) == ordervec2supp(o)
> [1] TRUE
There is a nice example of ordertrans()
in
inst/eurovision.Rmd
, and file inst/ordertrans.Rmd
provides
further discussion and examples.
Function ordertrans()
takes a second argument which allows the
user to arrange an order vector into the order specified.
Function ordertrans()
also works in the context of hyper3
objects:
x <- c(d=2,a=3,b=1,a=4)
x
d a b a
2 3 1 4
ordertrans(x)
a a b d
3 4 1 2
Object x
shows that d
came second, a
came third and
fourth, and b
came first. We can see that ordertrans()
gives the same information in a more intelligible format. This
functionality is useful in the context of hyper3
likelihood
functions.