Learn R Programming

hyper2 (version 3.0-0)

rhyper3: Random hyper3 objects

Description

Various random hyper3 objects, in the context of the race metaphor.

Usage

rwinner3(pn,ps)
rpair3(n=5,s=3,lambda=1.3)
rrace3(pn=c(a=2,b=4,c=2,d=1),ps=c(a=0.3, b=0.1,c=0.2,d=0.4))
rracehyper3(n=4,size=9,ps=NULL,races=3)

Arguments

pn

A named integer vector showing numbers of each player

ps

A named vector showing strengths of each player

n,size,races,s

Arguments specifying the complexity of the random hyper3 object returned

lambda

Parameter

Author

Robin K. S. Hankin

Details

These functions are intended to work with hyper3 objects, as indicated by the 3 in their names.

  • Function rwinner3() returns the winner of a race, chosen according to Plackett-Luce probabilities.

  • Function rpair3() returns a hyper3 object corresponding to repeated pairwise comparisons including a white-player advantage.

  • Function rwinner3() returns a hyper3 support function corresponding to repeated pairwise competition, with a white 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.

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

See Also

rrank,ordertable2supp,ordertrans

Examples

Run this code

rrace3() # moderate-sized default

## player numbers (two "a"s, four "b"s, two "c"s and a "d"):
pn <- c(a=2,b=4,c=2,d=1) 

ps <- c(a=0.3, b=0.1,c=0.2,d=0.4)  # player strengths    

rwinner3(pn,ps)              # winner, randomly chosen
rrace3(pn,ps)                 # A random race
ordervec2supp3(rrace3(pn,ps))  # a hyper3 object
rrace3()                        # a hyper3 object for multiple races

Run the code above in your browser using DataLab