To cite the hyper2 package in publications, please use Hankin (2017).
This file presents some speculative experimental work which is under
development. Do not confuse this file with icons.Rmd, which creates
the icons objects in the package.
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 <- sort(icons_maxp,decreasing=TRUE) # sort in decreasing order
icons_maxp
## NB PB L THC OA WAIS
## 0.252304 0.224582 0.173644 0.170113 0.110686 0.068671
Recall samep.test():
samep.test(icons,c("NB","THC"))
##
## Constrained support maximization
##
## data: icons
## null hypothesis: NB = THC
## null estimate:
## NB L PB THC OA WAIS
## 0.209060 0.175554 0.227870 0.209060 0.109874 0.068582
## (argmax, constrained optimization)
## Support for null: -175.98 + K
##
## alternative hypothesis: sum p_i=1
## alternative estimate:
## NB L PB THC OA WAIS
## 0.252304 0.173644 0.224582 0.170113 0.110686 0.068671
## (argmax, free optimization)
## Support for alternative: -175 + K
##
## degrees of freedom: 1
## support difference = 0.98583
## p-value: 0.16027
I will calculate all pairwise distances between the icons, as measured
by the support difference [penultimate line of the output above, named
statistic in the object for consistency with other tests in R]
M <- matrix(0,6,6)
p <- names(icons_maxp)
rownames(M) <- p
colnames(M) <- p
for(i in seq_len(6)){
for(j in seq_len(6)){
if(i != j){M[i,j] <- samep.test(icons,p[c(i,j)])$statistic}
}
}
M
## NB PB L THC OA WAIS
## NB 0.000000 0.084169 0.8130461 0.9858289 3.20674 6.4970
## PB 0.084169 0.000000 0.3847325 0.4603617 2.32110 5.4088
## L 0.813046 0.384732 0.0000000 0.0023084 0.86195 2.9809
## THC 0.985829 0.460362 0.0023084 0.0000000 0.75044 2.7563
## OA 3.206739 2.321100 0.8619462 0.7504358 0.00000 0.5954
## WAIS 6.496962 5.408845 2.9809307 2.7562598 0.59540 0.0000
(M <- round(M*100))
## NB PB L THC OA WAIS
## NB 0 8 81 99 321 650
## PB 8 0 38 46 232 541
## L 81 38 0 0 86 298
## THC 99 46 0 0 75 276
## OA 321 232 86 75 0 60
## WAIS 650 541 298 276 60 0
Observations: the triangle inequality is broken, consider NB-L
(81), L-PB (38) and PB-NB (8)
plot(phangorn::upgma(as.dist(M)))
hyper2 Package: Likelihood Functions for Generalized Bradley-Terry Models.” The R Journal 9 (2): 429–39.