Last chance! 50% off unlimited learning
Sale ends in
bratt(refgp = "last", refvalue = 1, init.alpha = 1, i0 = 0.01)
"vglmff"
(see vglmff-class
).
The object is used by modelling functions such as vglm
.brat
).
The probability that Competitor $i$ beats Competitor $j$ is
$\alpha_i / (\alpha_i+\alpha_j+\alpha_0)$, where all the $\alpha$s are positive.
The probability that Competitor $i$ ties with Competitor $j$
is $\alpha_0 / (\alpha_i+\alpha_j+\alpha_0)$. Loosely, the $\alpha$s can be thought
of as the competitors' `abilities', and $\alpha_0$
is an added parameter to model ties. For identifiability, one of
the $\alpha_i$ is set to a known value refvalue
,
e.g., 1. By default, this function chooses the last competitor to
have this reference value. The data can be represented in the form of
a $M$ by $M$ matrix of counts, where winners are the rows and
losers are the columns. However, this is not the way the data should
be inputted (see below).Excluding the reference value/group, this function chooses $\log(\alpha_j)$ as the first $M-1$ linear predictors. The log link ensures that the $\alpha$s are positive. The last linear predictor is $\log(\alpha_0)$.
The Bradley Terry model can be fitted with covariates, e.g., a home advantage variable, but unfortunately, this lies outside the VGLM theoretical framework and therefore cannot be handled with this code.
brat
,
Brat
,
binomialff
.# citation statistics: being cited is a 'win'; citing is a 'loss'
journal = c("Biometrika", "Comm.Statist", "JASA", "JRSS-B")
m = matrix(c( NA, 33, 320, 284,
730, NA, 813, 276,
498, 68, NA, 325,
221, 17, 142, NA), 4,4)
dimnames(m) = list(winner = journal, loser = journal)
# Add some ties. This is fictitional data.
ties = 5 + 0*m
ties[2,1] = ties[1,2] = 9
# Now fit the model
fit = vglm(Brat(m, ties) ~ 1, bratt(refgp=1), trace=TRUE)
fit = vglm(Brat(m, ties) ~ 1, bratt(refgp=1), trace=TRUE, cri="c")
summary(fit)
c(0, coef(fit)) # log-abilities (in order of "journal"); last is log(alpha0)
c(1, Coef(fit)) # abilities (in order of "journal"); last is alpha0
fit@misc$alpha # alpha_1,...,alpha_M
fit@misc$alpha0 # alpha_0
fitted(fit) # probabilities of winning and tying, in awkward form
predict(fit)
(check = InverseBrat(fitted(fit))) # probabilities of winning
qprob = attr(fitted(fit), "probtie") # probabilities of a tie
qprobmat = InverseBrat(c(qprob), NCo=nrow(ties)) # probabilities of a tie
check + t(check) + qprobmat # Should be 1's in the off-diagonals
Run the code above in your browser using DataLab