Reputation: 1017
I have data on 23 'players'. Some of them played against each other (but not every possible pair) one or multiple times. The dataset I have (see dput below) includes the number of times one player won and lost against another player. I use it to fit a BT model using BradleyTerry2 package. The issue I have is that the model gives me the coefficients for 22 players not 23. Can anyone help me figure out what the problem is, please?
Below is the dput of my data (head)
structure(list(player1 = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("a12TTT.pdf",
"a15.pdf", "a17.pdf", "a18.pdf", "a21.pdf", "a2TTT.pdf", "a5.pdf",
"B11.pdf", "B12.pdf", "B13.pdf", "B22.pdf", "B24.pdf", "B4.pdf",
"B7.pdf", "B8.pdf", "cw10-1.pdf", "cw15-1TTT.pdf", "cw17-1.pdf",
"cw18.pdf", "cw3.pdf", "cw4.pdf", "cw7_1TTT.pdf", "cw13-1.pdf"
), class = "factor"), player2 = structure(c(4L, 5L, 8L, 9L, 10L,
12L), .Label = c("a12TTT.pdf", "a15.pdf", "a17.pdf", "a18.pdf",
"a21.pdf", "a2TTT.pdf", "a5.pdf", "B11.pdf", "B12.pdf", "B13.pdf",
"B22.pdf", "B24.pdf", "B4.pdf", "B7.pdf", "B8.pdf", "cw10-1.pdf",
"cw15-1TTT.pdf", "cw17-1.pdf", "cw18.pdf", "cw3.pdf", "cw4.pdf",
"cw7_1TTT.pdf", "cw13-1.pdf"), class = "factor"), win1 = c(0,
1, 1, 1, 2, 0), win2 = c(1, 1, 0, 1, 0, 2)), row.names = c(NA,
6L), class = "data.frame")
The code I am using:
BTm(cbind(win1,win2), player1, player2, data= prep)
I also tried
BTm(cbind(win1,win2), player1, player2, ~player, id="player", data= prep)
And it gives me the same result (i.e. the same player is missing, and the 22 coefficients for the rest are the same).
If that is relevant, I created 'prep' using the below code.
prep<-countsToBinomial(table(ju$winner, ju$loser))
ju$winner and ju$loser are two columns in which rows are individual games and the winner is in the first column. I also tried the following code to fit the model:
BTm(1, p1, p2, data=ju)
In this case p1 and p2 are the same as columns winner and losser, but transformed so as to have the same level factors (so that the function would work). I am not sure I used this alternative correctly, and I mention it because in this case I also have one player missing (although a different one).
Upvotes: 0
Views: 41
Reputation: 1017
After reading more carefully the documentation for the package, I found that when estimating the model the function removes one script/player/contestant as a reference. Its value is always 0. So my understanding is that if you want to do any further analysis, you have to find what player was removed and reintroduce it in the data frame with the value for its ability 0.
Upvotes: 0