MATLAB code for Bradley-Terry models
Here are a few MATLAB functions that perform
estimation in the Bradley-Terry model and its
extension to the multicomparison case referred to
as the Plackett-Luce model.
For an explanation of these models, see
the paper "MM algorithms for generalized Bradley-Terry models".
I've made minor changes made in the code, so the results of
running these algorithms on the given datasets do not agree
perfectly with published results
(they're pretty close, though!).
Here are three different ways to fit a plain Bradley-Terry model
given a dataset in win-matrix form (explained in the comments of
the code). There is also a MATLAB (version 5) dataset
with the results of the 1997 NFL season. For details on this dataset
and on the three methods, see
"Optimization transfer using surrogate objective functions".
- btmm.m, which uses an MM method
- btqn.m, which uses a quasi-Newton accelerated
- btnr.m, which uses a Newton-Raphson method
- btcov.m, which returns an approximate covariance
matrix for the MLE.
- nfl1997.mat, the MATLAB version of the NFL
Here are at least two, maybe four, ways to fit a Plackett-Luce
model. Unfortunately, I don't guarantee the success of algorithms
placknr.m or placknr2.m; neither of these works, for example, with
the NASCAR example given below.
See the documentation in the code to understand how the dataset
should be coded.
Unlike in the Bradley-Terry case, there really seems to be no good
reason to use Newton-Raphson here; the placknr3 algorithm, which is
a hybrid MM-Newton-Raphson algorithm, is included just for the sake
of completeness and so one can (sort of) compare MM to Newton-Raphson
in this example.
- plackmm.m, which uses an MM method
- placknr.m, an unmodified Newton-Raphson algorithm
- placknr2.m, which uses step-halving withint
a Newton-Raphson algorithm (theoretically, this ought to work because of
the strict concavity of the loglikelihood; but numerically,
the theory doesn't always help!)
- placknr3.m, which uses a hybrid MM
and Newton-Raphson algorithm (i.e., it uses MM whenever the NR
step doesn't increase the likelihood).
a MATLAB 5 dataset that can be used to test the algorithm;
this is the same dataset referred to in my paper.
a text version of the same dataset.
an Excel spreadsheet containing all the NASCAR results plus some other stuff.
You'll need this file to match the drivers with their ID numbers
in nascar.mat. I'm not a racing fan, so there are some details
about this spreadsheet I can't fully explain; mostly it's pretty
self-explanatory though. This spreadsheet was painstakingly compiled
using a great deal of cutting and pasting!
Last modified: June 24, 2003