rhyper3.Rd
Various random hyper3 objects, in the context of the race metaphor.
They return “get you going” examples of hyper3
objects.
The defaults correspond to simple but non-trivial with straightforward
interpretations.
The defaults are
A named integer vector showing numbers of each type of player
A named vector showing strengths of each type of player
Arguments specifying the complexity
of the random hyper3
object returned. See details
Parameter
Further arguments passed to rracehyper3()
or
rpair3()
These functions return hyper3
objects, as indicated by the
3
in their names.
Function rwinner3()
is a low-level helper function that
takes a player number argument pn
, and a player strength
argument ps
. It performs an in silico race, and
returns the (name of) the winner, chosen randomly from a field of
runners with appropriate strengths. It is used repeatedly by
rrace3()
to select a winner from the diminishing pool of
still-running players.
Function rpair3()
returns a hyper3
object
corresponding to repeated pairwise comparisons including a
white-player advantage represented by lambda
.
Function rrace3()
returns a rank statistic corresponding
to finishing order for a Plackett-Luce race. The output can be
passed to ordervec2supp3()
.
Function rracehyper3()
returns a more complicated
hyper3
object corresponding to repeated races.
Function rhyper3()
returns an even more complicated
hyper3
object corresponding to repeated races and pairwise
comparisons.
Argument n
generally specifies the number of distinct types of
players. Files inst/mann_whitney_wilcoxon.Rmd
and
inst/javelin.Rmd
show some use-cases for these functions.
In function rracehyper3()
[and by extension rhyper3()
],
if argument n
exceeds 26 and argument pn
takes its
default value of NULL
, then an error will be returned because
there are only 26 players, one for each letter a
-z
.
rracehyper3()
#> log( (a=1)^9 * (a=1, b=1)^-1 * (a=1, b=1, c=1)^-2 * (a=1, b=1, c=2)^-1
#> * (a=1, b=1, c=3)^-1 * (a=1, b=2, c=1)^-1 * (a=1, b=2, c=2)^-1 * (a=1,
#> b=2, c=3)^-2 * (a=1, b=3, c=3)^-1 * (a=2, b=1, c=2)^-1 * (a=2, b=1,
#> c=3)^-1 * (a=2, b=2, c=3)^-2 * (a=2, b=3, c=3)^-2 * (a=3, b=2, c=3)^-1
#> * (a=3, b=3, c=3)^-3 * (b=1)^8 * (b=1, c=1)^-1 * (b=1, c=3)^-1 *
#> (c=1)^7 * (c=2)^-1 * (c=3)^-1)
rrace3()
#> [1] "d" "a" "c" "c" "a" "b" "b" "b" "b"
rwinner3()
#> [1] "a"
rhyper3()
#> log( (a=1)^3 * (a=1, c=1, e=2)^-3 * (c=1)^2 * (c=1, e=1)^-2 * (c=1,
#> e=2)^-3 * (e=1)^4 * (e=2)^-1)
rpair3()
#> log( (a=1.3)^1 * (a=1.3, d=1)^-1 * (b=1.3)^1 * (b=1.3, d=1)^-1 *
#> (c=1.3)^1 * (c=1.3, e=1)^-1)
ordervec2supp3(rrace3())
#> log( (a=1)^2 * (a=1, b=2, c=1, d=1)^-1 * (a=1, b=3, c=1, d=1)^-1 *
#> (a=2, b=3, c=1, d=1)^-1 * (a=2, b=3, c=2, d=1)^-1 * (a=2, b=4, c=2,
#> d=1)^-1 * (b=1)^3 * (b=1, d=1)^-1 * (b=2, c=1, d=1)^-1 * (b=2, d=1)^-1
#> * (c=1)^2 * (d=1)^1)
table(replicate(100,which(rrace3(pn=c(a=1,b=10),ps=c(a=0.9,b=0.1))=='a')))
#>
#> 1 2 3 4 5 6 7
#> 51 25 11 8 2 1 2