RobinHankin / hyper2

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

negative weights #221

Closed RobinHankin closed 3 months ago

RobinHankin commented 9 months ago

Using negative weights does not and should not work. But the error messge is unhelpful:

library("hyper2")
#> Loading required package: cubature
H <- hyper3()
H[c(a=1,b=-3)] <- 5
#> Error in eval(expr, envir, enclos): Not compatible with STRSXP: [type=NULL].

Created on 2024-02-21 with reprex v2.1.0

RobinHankin commented 3 months ago

A better example:

library("hyper2")
#> Loading required package: cubature
hyper3_bw(list(c("a","b"),c("a","b","d")),list(c(1,4),c(1,3,4)),c(1,-1),letters[1:5])
#> log( (a=1, b=3, d=4)^-1 * (a=1, b=4)^1)
hyper3_bw(list(c("a","b"),c("a","b","d")),list(c(1,4),c(1,-3,4)),c(1,-1),letters[1:5])
#> log( (a=1, b=-3, d=4)^-1 * (a=1, b=4)^1)

Above we see the second call has a negative weight but it seems to work fine.