Commonly, when considering competitive situations we suspect that one player has an advantage of some type which we would like to quantify in terms of an additional strength. Examples might include racing at pole position, playing white in chess, or playing soccer at one's home ground. Function pwa() (“player with advantage”) returns a modified hyper2 object with the additional strength represented as a reified entity.

pwa(H, pwa, chameleon = "S")

Arguments

H

A hyper2 object

pwa

A list of the players with the supposed advantage; may be character in the case of a named hyper2 object, or an integer vector

chameleon

String representing the advantage

Details

Given an object of class hyper2 and a competitor a, we replace every occurrence of a with a+S, with S representing the extra strength conferred.

However, the function also takes a vector of competitors. If there is more than one competitor, the resulting likelihood function does not seem to instantiate any simple situation.

Nice examples of pwa() are given in inst/cook.Rmd and inst/universities.Rmd.

Value

Returns an object of class hyper2.

Author

Robin K. S. Hankin

Note

Earlier versions of this package gave a contrived sequence of observations, presented as an example of pwa() with multiple advantaged competitors. I removed it because the logic was flawed, but it featured a chameleon who could impersonate (and indeed eat) certain competitors, which is why the third argument is so named.

The aliases commemorate some uses of the function in the vignettes and markdown files in the inst/ directory.

See also

Examples


summary(formula1 |> pwa("Hamilton","pole"))
#> A hyper2 object of size 26.
#> pnames:  Alonso Bottas Button Ericsson Gasly Giovinazzi Grosjean Hamilton Hartley Hulkenberg Kvyat Magnussen Massa Ocon Palmer Perez Raikkonen Resta Ricciardo Sainz Stroll Vandoorne Verstappen Vettel Wehrlein pole 
#> Number of brackets: 262 
#> Sum of powers: 0 
#> 
#> Table of bracket lengths:
#>  1  2  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 
#> 22  1  3  6 12 16 18 19 20 19 20 18 19 18 11 11 10  9  5  4  1 
#> 
#> Table of powers:
#> -20  -9  -6  -5  -4  -3  -2  -1   1   2   5  11  12  13  14  15  16  17  18  19 
#>   1   1   3   1   3   4  12 214   1   1   1   3   1   1   4   2   1   3   1   3 
#>  20 
#>   1 

H <- ordervec2supp(c(a = 2, b = 3, c = 1, d = 5, e = 4))
pwa(H,'a')
#> log( (S + a) * (S + a + b + c + d + e)^-1 * (S + a + b + d + e)^-1 * b
#> * (b + d + e)^-1 * c * (d + e)^-1 * e)

## Four races between a,b,c,d:
H1 <- ordervec2supp(c(a = 1, b = 3, c = 4, d = 2))
H2 <- ordervec2supp(c(a = 0, b = 1, c = 3, d = 2))
H3 <- ordervec2supp(c(a = 4, b = 2, c = 1, d = 3))
H4 <- ordervec2supp(c(a = 3, b = 4, c = 1, d = 2))

## Now it is revealed that a,b,c had some advantage in races 1,2,3
## respectively.  Is there evidence that this advantage exists?

if (FALSE)   # takes ~10 seconds, too long for here
specificp.test(pwa(H1,'a') + pwa(H2,'b') + pwa(H3,'c') + H4,"S")
 # \dontrun{}