---
title: "Pentathlon"
author: "R. K. S. Hankin"
output: bookdown::html_document2
bibliography: hyper2.bib  # copy vignettes/hyper2.bib to inst/
---

```{r setup, include=FALSE}
set.seed(0)
knitr::opts_chunk$set(echo = TRUE)
library("hyper2")
library("magrittr")
options("digits" = 5)
```

```{r out.width='20%', out.extra='style="float:right; padding:10px"',echo=FALSE}
knitr::include_graphics(system.file("help/figures/hyper2.png", package = "hyper2"))
```

To cite the `hyper2` package in publications, please use @hankin2017_rmd.
The [modern
pentathlon](https://en.wikipedia.org/wiki/Modern_pentathlon) is an
Olympic sport that comprises five different events: fencing, swimming,
horse riding, and running.  This short document discusses a dataset
taken from the [2004 Summer
Olympics](https://en.wikipedia.org/wiki/Modern_pentathlon_at_the_2004_Summer_Olympics),
analysing the order statistic for the top seven competitors:

		
* Moiseev		
* Zadneprovskis	
* Capalini	
* Cerkovskis	
* Meliakh		
* Michalik	
* Walther		

(I have removed diacritics from some of the names).


```{r readpentathlontable}
pentathlon_table <- as.matrix(read.table("pentathlon.txt"))
pentathlon_table
```

Thus the top line shows that Moiseev came fifth in shooting, first in
fencing and swimming, sixth in riding, and fifth in running.  The
first column shows that the shooting was won by Meliakh (who came
first), runner up was Machalik, and so on.

We can present the same information in another way:

```{r showranktable}
ordertable_to_ranktable(pentathlon_table)
```


```{r showpiechart,cache=TRUE}
pentathlon <- ordertable2supp(pentathlon_table)
pentathlon_maxp <- maxp(pentathlon)
pentathlon_maxp
pie(pentathlon_maxp)
```

And we can test the null that the competitors all have the same
Plackett-Luce strengths:

```{r testequal,cache=TRUE}
equalp.test(pentathlon)
```


### Package dataset {-}

Following lines create `pentathlon.rda`, residing in the `data/` directory of the package.

```{r,label=savepentathlondataset}
save(pentathlon_table,pentathlon,pentathlon_maxp,file="pentathlon.rda")
```

## References {-}

