hyper2To cite the hyper2 package in publications, please use Hankin (2017).
powerboat
racing is an important and prestigious sport. Here I analyse a
dataset taken from the 2018 F1 Powerboat world championships.
jj <- read.table("powerboat.txt",header=TRUE)
We need some data cleaning first; specifically a zero entry is treated as “did not start”:
powerboat_table <- ordertable(jj[,1:7])
powerboat_table[powerboat_table==0] <- "DNS"
powerboat_table
## An ordertable:
## POR GBR FRA CHN IND ABU SHA
## Torrente 1 Ret 3 1 1 6 3
## Stark 10 1 1 3 3 Ret 1
## T_AlQamzi 2 4 2 2 Ret 1 Ret
## Morin 5 3 5 7 4 2 Ret
## Chiappe 3 2 15 5 Ret 8 6
## Stromoy Ret 7 7 8 2 4 Ret
## Andersson Ret Ret 6 4 Ret Ret 2
## Selio DNS 5 Ret Ret DNS 3 4
## Edin 9 Ret 4 9 6 Ret 5
## AlHameli 6 8 9 6 8 DNS DNS
## Cantando 8 Ret 14 DNS 5 5 10
## Carella 4 Ret Ret Ret Ret Ret Ret
## Roms Ret DNS Ret 12 7 10 7
## Trask 14 6 12 Ret Ret Ret 8
## Marszalek 11 DNS 8 10 Ret 7 Ret
## Deguisne 12 9 10 11 Ret 9 9
## Benavente 7 10 11 Ret Ret 11 DNS
## Schuft 15 Ret DNS DNS 9 12 11
## Sookbuangbon DNS DNS DNS 13 10 DNP Ret
## Bjerknaes DNS 11 13 DNS DNS DNS DNS
## R_AlQamzi 13 DNS DNS DNS DNS DNS DNS
points <- jj[,8]
names(points) <- rownames(powerboat_table)
points <- points[order(names(points))]
points
## AlHameli Andersson Benavente Bjerknaes Cantando Carella Chiappe Deguisne Edin
## 18 29 5 0 18 9 42 7 25
## Marszalek Morin R_AlQamzi Roms Schuft Selio Sookbuangbon Stark Stromoy
## 8 54 0 9 2 28 1 85 35
## T_AlQamzi Torrente Trask
## 74 89 8
Each row is a driver and each column a venue (apart from the final column, which is points scored). Thus we see from the first column that, in Portugal, Torrente came first, Stark second, T. AlQamzi second, and so on.
In this form we can easily convert to a support function:
powerboat <- suppfun(powerboat_table)
(powerboat_maxp <- maxp(powerboat))
## AlHameli Andersson Benavente Bjerknaes Cantando Carella Chiappe Deguisne Edin
## 0.0500453 0.0251209 0.0276967 0.0103840 0.0364294 0.0059792 0.0614545 0.0457417 0.0536111
## Marszalek Morin R_AlQamzi Roms Schuft Selio Sookbuangbon Stark Stromoy
## 0.0330470 0.1137477 0.0051793 0.0225980 0.0197621 0.0187449 0.0097503 0.1201055 0.0485706
## T_AlQamzi Torrente Trask
## 0.1025993 0.1649633 0.0244692
pie(powerboat_maxp)
par(pty="s")
plot(powerboat_maxp,points/sum(points),xlab="likelihood",ylab="points",pch=16)
abline(0,1)
Following lines create powerboat.rda, residing in the data/
directory of the package.
save(powerboat_table,powerboat,powerboat_maxp,file="powerboat.rda")
hyper2 Package: Likelihood Functions for Generalized Bradley-Terry Models.” The R Journal 9 (2): 429–39.