hyper3 objectsTo cite the hyper2 package in publications, please use
Hankin (2017). This minimal document reads file icons.txt and
creates R objects icons, icons_matrix, and icons_maxp. The
dataset is discussed extensively in West and Hankin (2008) and Hankin (2010); in
addition to this file, there is a more discursive vignette which may
be viewed by typing vignette("icons") at the command line.
icons_table <- as.matrix(read.table("icons.txt",header=TRUE))
icons_table
## NB L PB THC OA WAIS
## [1,] 5 3 NA 4 NA 3
## [2,] 3 NA 5 8 NA 2
## [3,] NA 4 9 2 NA 1
## [4,] 10 3 NA 3 4 NA
## [5,] 4 NA 5 6 3 NA
## [6,] NA 4 3 1 3 NA
## [7,] 5 1 NA NA 1 2
## [8,] 5 NA 1 NA 1 1
## [9,] NA 9 7 NA 2 0
Thus the first row shows that a total of \(5+3+4+3=15\) respondents were
shown icons NB, L, THC, and WAIS; 5 of them chose NB as
“most concerning”, 3 chose L, 4 chose THC and 3 chose WAIS.
We can use function saffy() to convert the table into a hyper2
object:
icons <- saffy(icons_table)
icons
## log(L^24 * (L + NB + OA + THC)^-20 * (L + NB + OA + WAIS)^-9 * (L + NB
## + THC + WAIS)^-15 * (L + OA + PB + THC)^-11 * (L + OA + PB + WAIS)^-18
## * (L + PB + THC + WAIS)^-16 * NB^32 * (NB + OA + PB + THC)^-18 * (NB +
## OA + PB + WAIS)^-8 * (NB + PB + THC + WAIS)^-18 * OA^14 * PB^30 *
## THC^24 * WAIS^9)
icons_maxp <- maxp(icons)
icons_maxp
## NB L PB THC OA WAIS
## 0.252304 0.173644 0.224582 0.170113 0.110686 0.068671
This file exists for consistency; an extended discussion (and
statistical tests) are presented in the vignette icons.
Following lines create icons.rda, residing in the data/ directory of the package.
save(icons_table,icons,icons_maxp,file="icons.rda")
hyper2 Package: Likelihood Functions for Generalized Bradley-Terry Models.” The R Journal 9 (2): 429–39.