RobinHankin / hyper2

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

bug in home_away() #196

Closed RobinHankin closed 1 year ago

RobinHankin commented 1 year ago
M <- matrix(c(
    NA, 1+5i, 3+11i, NA),
    nrow=2,ncol=2,byrow=TRUE)

teams <- LETTERS[seq_len(2)]
dimnames(M) <- list("@home" = teams,"@away"=teams)
dimnames(M) <- list("@home" = teams,"@away"=teams)
M
##      @away
## @home     A    B
##     A    NA 1+5i
##     B 3+11i   NA
home_away(M)
## log(A^5 * (A + B + home)^-20 * (A + home) * B^11 * (B + home)^3)

This is a bug. A wins at home once, wins away 11 times, and B wins at home 3 times, and away 5 times. The likelihood function returned by home_away() shows 11 away wins for B.