BTm {BradleyTerry} | R Documentation |
Fits Bradley-Terry models for pair comparison data, including models with structured scores, order effect and missing covariate data. Fits by either maximum likelihood or maximum penalized likelihood (with Jeffreys-prior penalty).
BTm(formula, refcat = NULL, offset = NULL, contrasts = NULL, data = NULL, subset = NULL, br = FALSE, order.effect = NULL, ...)
formula |
A model formula for the Bradley-Terry “ability”
parameters. Response variable should be a data frame containing
contest results: columns include factors named "winner" (by default
column 1) and "loser" (by default column 2), and possibly also
"Freq", a numeric vector recording the
frequency of each contest result (taken to be 1 if omitted).
Variables on
RHS have length equal to the number of players. The special RHS
formula .. specifies the standard Bradley-Terry model
with unstructured abilities. |
refcat |
Character. Which is the “reference” player? Only used with
.. on the RHS of the formula (otherwise ignored if supplied).
Default is the name of the alphanumerically-first player. |
offset |
An optional offset term in the model. A vector of length equal to the number of players. |
contrasts |
As for glm . |
data |
A data frame, in which RHS variables can be found. |
subset |
An optional logical or numeric vector specifying a subset of observations (ie, a subset of rows of the response dataframe) to be used in the fitting process. |
br |
Logical. If TRUE , fitting will be by penalized
maximum likelihood as in Firth (1992, 1993), using
brglm . Default is fitting by maximum likelihood. |
order.effect |
An optional vector, numeric, indicating an order effect to be estimated in the model (for example, a home advantage effect). Values should be 1 where contest winner has the advantage, -1 where loser has the advantage, and 0 where neither player is advantaged. |
... |
Other arguments for glm or brglm |
No allowance is made for tied contests.
Aside from the possibility of an order effect, contest-specific
predictors are not catered for by BTm
. However, the availability of
the model
and x
components in objects of class
BTm
allows a model fitted with only player-specific predictors to be
manipulated subsequently to include further terms involving
contest-specific predictors.
An object of class c("BTm", "glm", "lm")
, or of class
c("BTm", "brglm", "glm", "lm")
if br = TRUE
. Components are as
for glm
or brglm
, with additionally
x0 |
Model matrix for the formula as supplied (rather than
the model matrix actually used in the subsidiary call to glm
or brglm , which is included as component x if the call
includes x = TRUE ). One row for each player. |
offset0 |
The supplied offset vector, if any was specified.
One element for each player. (The offset vector actually used
in the subsidiary call to glm
or brglm is included as component offset .) |
y0 |
The data frame of contest winners and losers, containing only those rows actually used in fitting the model. |
order.effect |
The values of order.effect, if specified. |
abilities |
A two-column matrix of estimated abilities, with the
ability for refcat set to zero if refcat is specified
(otherwise the first player has zero ability). First column is
estimated ability, second column is the standard error for that
estimate. One row for each player. |
Methods specific to the BTm
class of models are
add1.BTm
drop1.BTm
terms.BTm
formula.BTm
Others are inherited from glm
or lm
.
David Firth
Agresti, A (2002) Categorical Data Analysis (2nd ed). New York: Wiley.
Firth, D. (1992) Bias reduction, the Jeffreys prior and GLIM. In Advances in GLIM and Statistical Modelling, Eds. L Fahrmeir, B J Francis, R Gilchrist and G Tutz, pp91–100. New York: Springer.
Firth, D. (1993) Bias reduction of maximum likelihood estimates. Biometrika 80, 27–38.
Firth, D. (2005) Bradley-Terry models in R. Journal of Statistical Software, to appear.
Stigler, S. (1994) Citation patterns in the journals of statistics and probability. Statistical Science 9, 94–108.
## ## Statistics journal citation data from Stigler (1994) ## -- see also Agresti (2002, p448) data(citations) ## First fit the "standard" Bradley-Terry model print(citeModel <- BTm(citations ~ ..)) ## Now the same thing with a different "reference" journal update(citeModel, . ~ ., refcat = "JASA") ## Is the "citeability" of a journal predicted by its country of origin? origin <- factor(c("UK", "USA", "USA", "UK")) print(citeModel2 <- BTm(citations ~ origin)) ## Hmm... not so sure about the origin of "Comm Statist" ... is.na(origin[2]) <- TRUE citeModel2 <- update(citeModel2, . ~ .) ## Now an example with an order effect -- see Agresti (2002) p438 data(baseball) ## Simple Bradley-Terry model as in Agresti p437 print(baseballModel <- BTm(baseball ~ ..)) ## Introduce order effect as in Agresti p438 update(baseballModel, order.effect = baseball$home.adv)