Eurovision Song Contest: collusion 2022 USING HYPER3

knitr::opts_chunk$set(echo = TRUE)
library("hyper2")
library("magrittr")
options("digits" = 5)
abbreviated <- TRUE  # change to FALSE for full names
knitr::include_graphics(system.file("help/figures/hyper2.png", package = "hyper2"))

(takes five minute to run without cache; the time is spent in chunk dotest)

To cite the hyper2 package in publications, please use @hankin2017_rmd. The file eurovision2022_jury_pre_null.txt, used below, refers to the jury vote for the 2022 Eurovision Song contest, pre-nullification; data supplied by Riley Uttley. First we specify the matrix as appearing in the Wikipedia page:

eurovision_table <- as.matrix(read.table("eurovision2022_jury_pre_null.txt", header = TRUE))
excluded <- c(2, 8, 12, 14,15,16)

contestants <- c(
"AU", # Australia        1
"AZ", # Azerbaijan       2 excluded
"BE", # Belgijm          3
"CY", # Cyprus           4
"CZ", # Czech republic   5
"EE", # Estonia          6
"FI", # Finland          7
"GE", # Georgia          8 excluded
"IE", # Ireland          9 
"IL", # Israel          10 
"MT", # Malta           11 
"ME", # Montenegro      12 excluded 
"MK", # North Macedonia 13
"PL", # Poland          14 excluded
"RO", # Romania         15 excluded
"SM", # San Marino      16 excluded
"RS", # Serbia          17
"SE"  # Sweden          18
)

(points <- sort(unique(c(eurovision_table)),decreasing=TRUE))
preference <- eurovision_table*0  
for(i in seq_along(points)){ preference[eurovision_table == points[i]] <- i }
preference
contestants[excluded]
H_excluded <- hyper3()
H_included <- hyper2()
text <- "remove this for R >= 4.6-0"
print(text)
`%notin%` <- Negate(`%in%`)
for(i in excluded){
    d <- preference[,i,drop=TRUE]
    d[d==11] <- 0
    newH <- suppfun(d[!is.na(d)])
    newH <- newH |> pwa23_multiple(contestants[excluded], "collusion")
    H_excluded <- H_excluded + newH
} # i loop closes

for(i in seq_len(ncol(preference))){
    if(i %notin% excluded){
        d <- preference[,i,drop=TRUE]
        d[d==11] <- 0
        d <- d[!is.na(d)]
        newH <- suppfun(d)
        H_included <- H_included + newH
    }
} # i loop closes
H_excluded
mHex <- maxp(H_excluded)
mHin <- maxp(H_included)
dotchart(mHex)
dotchart(mHin)
H <- H_excluded + as.hyper3(H_included)
result <- specificp.gt.test(H, "collusion",0)
result
H_excluded
summary(H_excluded)
summary(H)


Try the hyper2 package in your browser

Any scripts or data that you put into this service are public.

hyper2 documentation built on June 23, 2026, 5:07 p.m.