ggol | R Documentation |
Various functions for calculating the likelihood function for order statistics
ggrl(H, ...)
general_grouped_rank_likelihood(H, ...)
goodbad(winners,losers)
elimination(all_players)
rankvec_likelihood(v,nonfinishers)
race(v,nonfinishers)
H |
Object of class |
... |
Numeric or character vectors specifying groups of players with equal rank, with higher-ranking groups coming earlier in the argument list |
all_players , winners , losers |
Numeric or character vectors specifying competitors. See details |
v |
A character vector specifying ranks. Thus
|
nonfinishers |
A character vector with entries corresponding to
competitors who did not finish. Thus
|
These functions are designed to return likelihood functions, in the
form of lists of hyper2()
objects, for typical order statistics
such as the results of rowing heats or MasterChef ments.
Direct use of rankvec_likelihood()
is discouraged: use
suppfun()
instead, for example suppfun(letters)
.
Function ggrl()
is an easily-typed alias for
general_grouped_rank_likelihood()
.
Function goodbad()
is a convenience function for ggrl()
in which a bunch of contestants is judged. It returns a likelihood
function for the observation that the members of one subset were
better than those of another. Thus
goodbad(letters[1:3],letters[4:5])
corresponds to the
observation that d
and e
were put into an elimination
trial (and abc
were not).
Function elimination()
gives a likelihood function for situations
where the weakest player is identified at each stage and
subsequently eliminated from the competition. It is intended for
situations like the Great British Bake-off and Masterchef in which the
observation is which player was chosen to leave the show. In this
function, argument all_players
is sensitive to order, unlike
choose_winners()
and choose_losers()
(an integer
n
is interpreted as letters[seq_len(n)]
). Element
i
of all_players
is the i^\mathrm{th}
player
to be eliminated. Thus the first element of all_players
is the
first player to be eliminated (and would be expected to have the
lowest strength). The final element of all_players
is the last
player to be eliminated (or alternatively the only player not to be
eliminated).
Function rank_likelihood()
is deprecated: use [S3
generic] supp.ranktable()
instead. This takes a character
vector of competitors with the order of elements corresponding to the
finishing order; a Plackett-Luce likelihood function is returned.
Thus v=c("d","b","c","a")
corresponds to d
coming first,
b
second, c
third, and a
fourth. Function
race()
is an arguably more memorable synonym.
An example of race()
is given in inst/rowing.Rmd
, and
examples of ggrl()
are given in inst/loser.Rmd
and
inst/masterchef.Rmd
.
Robin K. S. Hankin
rrank
,ordertable2supp
,race3
W <- hyper2(pnames=letters[1:5])
W1 <- ggrl(W, 'a', letters[2:4],'e') # 6-element list
W2 <- ggrl(W, 'b', letters[3:5],'a') # 6-element list
like_single_list(equalp(W1),W1)
like_series(equalp(W1),list(W1,W2))
if(FALSE){ # takes too long
# run 10 races:
r1 <- rrank(10,p=(7:1)/28)
colnames(r1) <- letters[1:7]
# Likelihood function for r1:
suppfun(r1)
# convert a rank table to a support function:
suppfun(wikitable_to_ranktable(volvo_table))
H <- hyper2()
for(i in 1:20){
H <- H + race(sample(letters[1:5],sample(3,1),replace=FALSE))
}
equalp.test(H) # should not be significant (null is true)
H1 <- hyper2(pnames=letters[1:5])
H2 <- choose_losers(H1,letters[1:4],letters[1:2]) # {a,b} vs {c,d}; {a,b} lost
maxplist(H2,control=list(maxit=1)) # control set to save time
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.