0

This might be very obvious but I am not seeing it. Normally, if one wants to set one variable out of an array as 'reference', the easiest thing to do is subtract.

e.g

[1,4,10,9,6]

set item 2 at reference,

[-3,0,6,5,2].

How can the original be recovered?

I am using the BradleyTerry2 package in R where the abilities are always referenced, but I would like to recover all of them

> library("BradleyTerry2")
> 
> dat<-data.frame('winner'=c('lakers','bucks','wizards'),'loser'=c('bucks','wizards','lakers'))
> 
> model<-BTm(1,winner,loser,data=dat,refcat='bucks')
> 
> BTabilities(model)
              ability     s.e.
bucks    0.000000e+00 0.000000
lakers  -1.812987e-16 1.632993
wizards -3.625973e-16 1.632993

> model<-BTm(1,winner,loser,data=dat,refcat='lakers')
> BTabilities(model)
             ability     s.e.
bucks   1.570092e-16 1.632993
lakers  0.000000e+00 0.000000
wizards 0.000000e+00 1.632993
Heather Turner
  • 3,264
  • 23
  • 30
ha554an
  • 103
  • 6
  • You need to record what it was, and then you can add it back. If you don't record it, there's no way to know what it was. – Gregor Thomas Apr 08 '20 at 02:29
  • that's exactly my problem, the function does not let me record it, it references on its own as part of the calculation. I looked in the source code but can't seem to figure it out. Haven't looked at much R source code before. – ha554an Apr 08 '20 at 02:33

1 Answers1

0

Gregor Thomas is right that there is no way to recover the original. Thanks to Heather Turner and David Firth, I was able to figure out how to get the value without reference. Don't know how useful this is, but the following gives the sum to 1 BT abilities.

log_a <- BTabilities(baseballModel2)
log_a <- log_a[, "ability"]
print(log_a)
a <- exp(log_a)
a <- a / sum(a)
print(a)
sum(a)
ha554an
  • 103
  • 6