hturner / BradleyTerry2

BradleyTerry2 package for Bradley-Terry models in R
18 stars 0 forks source link

Predictors, Covariates... how to specify? #12

Open systats opened 4 years ago

systats commented 4 years ago

Hi guys,

I try to add covariates to a BT model but the estimates are all NA. Here is an example:

library(BradleyTerry2)

repex <- dplyr::tibble(
  product_a = as.factor(c(1, 2, 3, 4)),
  product_b = as.factor(c(4, 1, 2, 3)),
  rating_a = c(1, 0, 0, 1),
  rating_b = 1 - rating_a,
  user = as.factor(c("aa1", "aa1", "bb2", "bb2"))
)

# This works
bt1 <- BTm(cbind(rating_a, rating_b), product_a, product_b, id = "product", formula = ~ product, data = repex)
# This doesnt (with user)
bt2 <- BTm(cbind(rating_a, rating_b), product_a, product_b, id = "product", formula = ~ product + user, data = repex)

Does someone know how to specify this model correctly to account for user biases (not player but contest specific predictors)? I tried it also with several thousands of instances but no useful estimate could be obtained. Thanks in advance for any suggestion!