btprob | R Documentation |
Calculates the Bradley-Terry probabilities of each item in a fully-connected component of the comparison graph, G_W, winning against every other item in that component (see Details).
btprob(object, subset = NULL, as_df = FALSE)
object |
An object of class "btfit", typically the result |
subset |
A condition for selecting one or more subsets of the components. This can either be a character vector of names of the components (i.e. a subset of |
as_df |
Logical scalar, determining class of output. If |
Consider a set of K items. Let the items be nodes in a graph and let there be a directed edge (i, j) when i has won against j at least once. We call this the comparison graph of the data, and denote it by G_W. Assuming that G_W is fully connected, the Bradley-Terry model states that the probability that item i beats item j is
p_{ij} = \frac{π_i}{π_i + π_j},
where π_i and π_j are positive-valued parameters representing the skills of items i and j, for 1 ≤ i, j, ≤ K. The function btfit
can be used to find the strength parameter π. It produces a "btfit"
object that can then be passed to btprob
to obtain the Bradley-Terry probabilities p_{ij}.
If G_W is not fully connected, then a penalised strength parameter can be obtained using the method of Caron and Doucet (2012) (see btfit
, with a > 1
), which allows for a Bradley-Terry probability of any of the K items beating any of the others. Alternatively, the MLE can be found for each fully connected component of G_W (see btfit
, with a = 1
), and the probability of each item in each component beating any other item in that component can be found.
If as_df = FALSE
, returns a matrix where the i,j-th element is the Bradley-Terry probability p_{ij}, or, if the comparison graph, G_W, is not fully connected and btfit
has been run with a = 1
, a list of such matrices for each fully-connected component of G_W. If as_df = TRUE
, returns a five-column data frame, where the first column is the component that the two items are in, the second column is item1
, the third column is item2
, the fourth column is the Bradley-Terry probability that item 1 beats item 2 and the fifth column is the Bradley-Terry probability that item 2 beats item 1. If the original btdata$wins
matrix has named dimnames, these will be the colnames
for columns one and two. See Details.
Ella Kaye
Bradley, R. A. and Terry, M. E. (1952). Rank analysis of incomplete block designs: 1. The method of paired comparisons. Biometrika, 39(3/4), 324-345.
Caron, F. and Doucet, A. (2012). Efficient Bayesian Inference for Generalized Bradley-Terry Models. Journal of Computational and Graphical Statistics, 21(1), 174-196.
btfit
, btdata
citations_btdata <- btdata(BradleyTerryScalable::citations) fit1 <- btfit(citations_btdata, 1) btprob(fit1) btprob(fit1, as_df = TRUE) toy_df_4col <- codes_to_counts(BradleyTerryScalable::toy_data, c("W1", "W2", "D")) toy_btdata <- btdata(toy_df_4col) fit2a <- btfit(toy_btdata, 1) btprob(fit2a) btprob(fit2a, as_df = TRUE) btprob(fit2a, subset = function(x) "Amy" %in% names(x)) fit2b <- btfit(toy_btdata, 1.1) btprob(fit2b, as_df = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.