RobinHankin / hyper2

https://robinhankin.github.io/hyper2/
5 stars 3 forks source link

salad dataset #155

Closed RobinHankin closed 9 months ago

RobinHankin commented 1 year ago

It would be nice to include the salad dataset from the prefmod package in the examples.

RobinHankin commented 1 year ago

Function ordervec2supp() is not vectorised, so:

library("hyper2")
#> Loading required package: magrittr
#> Loading required package: cubature
library("prefmod")
#> Loading required package: gnm
#> Loading required package: colorspace
#> 
#> Attaching package: 'prefmod'
#> The following objects are masked from 'package:hyper2':
#> 
#>     baseball, tennis
x <- as.matrix(salad)
head(x)
#>      A B C D
#> [1,] 1 2 3 4
#> [2,] 1 2 3 4
#> [3,] 2 1 3 4
#> [4,] 2 1 4 3
#> [5,] 2 1 4 3
#> [6,] 2 3 1 4
H <- hyper2()
for(i in seq_len(nrow(x))){H <- H + ordervec2supp(x[i,])}
H
#> log(A^10 * (A + B)^-3 * (A + B + C)^-2 * (A + B + C + D)^-32 * (A + B +
#> D)^-5 * (A + C)^-7 * (A + C + D)^-23 * (A + D)^-16 * B^31 * (B + C +
#> D)^-2 * (B + D)^-1 * C^29 * (C + D)^-5 * D^26)

Created on 2023-06-23 with reprex v2.0.2

RobinHankin commented 1 year ago

See inst/salad.Rmd