ordervec2supp3: Various functionality for races and hyper3 likelihood...

ordervec2supp3R Documentation

Various functionality for races and hyper3 likelihood functions

Description

\loadmathjax

Various functions for calculating the likelihood function for order statistics in the context of hyper3 likelihood functions. Compare ggol() for hyper2 objects. Used in the constructor() suite of analysis.

Usage

num3(v,helped=NULL,lambda=1)
den3(v,helped=NULL,lambda=1)
char2nv(x)
ordervec2supp3(v,nonfinishers=NULL)
ordervec2supp3a(v,nonfinishers=NULL,helped=NULL,lambda=1)
rankvec_likelihood3(v,nonfinishers=NULL)
ordertable2supp3(a)
cheering3(v,e,help,nonfinishers=NULL)
args2ordervec(...)

Arguments

v

Ranks in the form of a character vector. Element v[1] is the first-placed competitor, element v[2] the second, and so on. For example, ordervec2supp3(c('b','b','a','c','a'))

nonfinishers

Character vector (a set) showing players that did not finish. See details section and examples

a

An ordertable

helped

vector of entities being helped

e, help, lambda

Parameters controlling non-independence with e a named integer vector specifying equivalence classes of the competitors: names correspond to the competitors, values to their equivalence class, and help a numeric vector with entries corresponding to the equivalence classes of e and values the strength of the support

x

A character vector of competitors

...

Arguments passed to args2ordervec()

Details

Function args2ordervec() takes arguments with names corresponding to players, and entries corresponding to performances (e.g. distances thrown by a javelin, or times for completing a race). It returns a character vector indicating the rank statistic. See examples, and also the javelin vignette.

Function ordervec2supp3() takes character vector showing the order of finishing [i.e. a rank statistic], and returns a generalized Plackett-Luce support function in the form of a hyper3 object. It can take the output of args2ordervec() or rrace3(). For example:

ordervec2supp3(c("a","b"),nonfinishers=c("a","b"))

corresponds to a race between two twins of strength a and two twins of strength b, with only one of each pair finishing; a comes first and b comes second; symbolically \mjdeqna\succ b\succ\left\lbrace a,b\right\rbrace\longrightarrow \mathcalL(a,b\left|a+b=1\right.)=\fraca2a+2b\cdot\fracba+2bomitted

Further,

ordervec2supp3(c("a","b"),c("a","b","c"))

corresponds to adding a singleton competitor of strength c who did not finish:

\mjdeqn

a\succ b\succ\left\lbrace a,b,c\right\rbrace\longrightarrow \mathcalL(a,b,c\left|a+b+c=1\right.)=\fraca2a+2b+c\cdot\fracba+2b+comitted

(observe that this likelihood function is informative about \mjseqnc). See the examples section below. Experimental function ordervec2supp3a() is a generalized version of ordervec2supp3() that allows for cheering effects.

Functions num3() and den3() are low-level helper functions that calculate the numerator and denominator for Plackett-Luce likelihood functions with clones; used in ordervec2supp3() and ordervec2supp3a().

Function ordertable2supp3() takes an order table (the canonical example is the constructors' formula 1 grand prix results, see constructor.Rd and returns a generalized Plackett-Luce support function in the form of a hyper3 object.

Function char2nv() takes a character vector and returns a named vector with entries corresponding to their names' counts. It is used in the extraction and replacement methods for hyper3 objects.

Function cheering3() is a generalization of ordervec2supp3(). Competitors who are not mentioned in argument e are assumed to be in an equivalence class of size 1, that is, they are not supported (or indeed suppressed) by anyone else: they are singletons in the terminology of Hankin (2006). Extensive discussions are presented at inst/plackett_luce_monster.Rmd and inst/eurovision.Rmd.

File inst/javelin.Rmd and inst/race3.Rmd show some use-cases for these functions.

Note

Function ordervec2supp3() is mis-named [it takes a rank vector, not an order vector]; it will be renamed rankvec_likelihood3(), eventually.

Author(s)

Robin K. S. Hankin

See Also

ordertable2supp,ordertrans

Examples



ordervec2supp3(c("a","a","b","c","a","b","c"))
ordervec2supp3(rrace3())
ordervec2supp3(c("a","b"),nonfinishers=c("a","b"))  # a > b >> {a,b}



(o <- args2ordervec(a=c(1,6,9), b=c(2,3,4), c=c(1.1,11.1)))
H <- ordervec2supp3(o)
H
# equalp.test(H)   # takes too long for here


## Race: six competitors a-f finishing in alphabetical order.  Mutually
## supporting groups: (acd), (bf), (e).  Competitor "e" is not
## suppported by anyone else (he is a singleton) so does not need to be
## mentioned in argument 'e' and there are only two helpfulnesses to be
## considered: that of (acd) and that of (bf), which we will take to be
## 1.88 and 1.1111 respectively:

cheering3(v=letters[1:6],e=c(a=1,c=1,b=2,d=1,e=2),help=c(1.88,1.1111))




## Another race: four competitors, including two clones of "a", and two
## singletons "b" and "c".  Here "a" helps his clone at 1.88; and "b"
## and "c" help one another at 1.111:

cheering3(v=c("a","b","a","c"),e=c(a=1,b=2,c=2),help=c(1.8,1.111))


## Same race as above but this time there are two clones of "b", one of
## whom did not finish:

cheering3(v=c("a","b","a","c"),e=c(a=1,b=2,c=2),help=c(1.8,1.111),"b")


## Most common case would be that the clones help each other but noone
## else:

cheering3(v=c("a","b","a","c"),e=c(a=1,b=2,c=3),help=c(1.8,1.111,1),"b")




RobinHankin/hyper2 documentation built on April 21, 2024, 11:38 a.m.