hyper3(B=list("a",c("a","b"),"b"),W=list(1.2,c(1.2,1),1),powers=c(3,4,-7))
hyper3(list(c(a=1.2),c(b=1),c(a=1.2,b=1)),powers=c(3,4,-7))
## Above two objects should be identical.
## Third method, send a matrix:
M <- matrix(rpois(15,3),5,3)
colnames(M) <- letters[1:3]
hyper3(M,c(2,3,-1,-5,1)) # second argument interpreted as powers
## Standard way to generate a hyper3 object is to create an empty object
## and populate it using the replacement methods:
a <- hyper3() # default creation method [empty object]
a[c(p1=1.3)] <- 5
a[c(p2=1 )] <- 2
a[c(p1=1.3,p2=1)] <- -7
a
chess3 # representative simple hyper3 object
H1 <- rankvec_likelihood(letters[sample(6)])
H2 <- rankvec_likelihood(letters[sample(6)])
H1["a"] <- as.weight(1.2) # "a" has some disadvantage in H1
H1[c("b","c")] <- as.weight(2:3) # "b" and "c" have some advantage in H1
H2[c("c","d")] <- as.weight(1.5) # "c" and "d" have some advantage in H2
H1+H2
Run the code above in your browser using DataLab