set.seed(1) knitr::opts_chunk$set(echo = TRUE) library("hyper2") library("disordR")
knitr::include_graphics(system.file("help/figures/hyper2.png", package = "hyper2"))
To cite the hyper2
package in publications, please use @hankin2017_rmd.
Here we analyse results from the men's javelin, 2020 Summer Olympics.
javelin_table <- read.table("javelin.txt",header=TRUE) a <- javelin_table # saves typing javelin_table
Above, we see that Chopra threw 87.03m on his first throw, 87.58m on
his second, and so on. Vadlejch threw 83.98m on his first throw, etc.
We may convert this to a named vector with elements being the throw
distances, and names being the competitors, using
attemptstable2supp3()
:
javelin_vector <- attemptstable2supp3(a,decreasing=TRUE,give.supp=FALSE) javelin_vector o <- javelin_vector # saves typing
Above we see that Chopra threw the longest and second-longest throws
of 87.58m and 87.03 respectively; Vadlejch threw the third-longest
throw of 86.67m, and so on. NA
entries correspond to no-throws. It
is easy to plot the data in visual form:
n <- length(levels(as.factor(names(o)))) plot(o,pch=16,col=rainbow(n)[as.factor(names(o))]) legend("topright",pch=16,col=rainbow(n),legend=levels(as.factor(names(o))))
Now convert the attempts table to a hyper3
object, again using
function attemptstable2supp3()
but this time pass give.supp=TRUE
.
However, note that there are two reasonable interpretations: firstly,
we simply ignore no-throws [in the package docs, these are sometimes
referred to as "DNF", or "Did not finish", following Formula 1
terminology]:
javelin1 <- ordervec2supp3(v=names(o)[!is.na(o)]) H1 <- javelin1 # saves typing javelin1_maxp <- maxp(H1) m1 <- javelin1_maxp
Secondly, we may treat no-throws as being inferior to any actual
measured throw. To do this it is easiest to pass give.supp=TRUE
to
attemptstable2supp3()
:
javelin2 <- attemptstable2supp3(a,decreasing=TRUE,give.supp=TRUE) H2 <- javelin2 # saves typing javelin2_maxp <- maxp(H2) m2 <- javelin2_maxp
Investigation:
rbind(one=m1,two=m2) pie(m1) pie(m2) dotchart(m1,pch=16) dotchart(m2,pch=16) abline(0,1) ordertransplot(m1,m2)
equalp.test(javelin1) equalp.test(javelin2)
Following lines create javelin.rda
, residing in the data/
directory of the package.
save(javelin1,javelin2,javelin_table,javelin_vector,javelin1_maxp,javelin2_maxp, file="javelin.rda")
https://en.wikipedia.org/w/index.php?title=Athletics_at_the_2020_Summer_Olympics_%E2%80%93_Men%27s_javelin_throw&oldid=1051014985
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.