bradleyTerry: Computes the MLE for the BT model using an MM algorithm

Description Usage Arguments Details Value Examples

View source: R/bradleyTerry.R

Description

bradleyTerry Computes the MLE for the BT model using an MM algorithm

Usage

1
bradleyTerry(conf.mat, initial = NA, baseline = NA, stop.dif = 0.001)

Arguments

conf.mat

a matrix of conf.mat class. An N-by-N conflict matrix whose (i,j)th element is the number of times i defeated j.

initial

initial values of dominance indices for the MM algorithm, if not supplied, the 0 vector will be the inital value.

baseline

index for agent to represent baseline dominance index set to 0. If NA, the "sum-to-one" parameterization will be used.

stop.dif

numeric value for difference in log likelihood value between iterations. Used as the convergence criterion for the algorithm.

Details

In order to meet Bradley-Terry assumption, each ID in conf.mat should have at least one win AND one loss. bradleyTerry will return an error if no more than one win or loss was found.

@references Shev, A., Hsieh, F., Beisner, B., & McCowan, B. (2012). Using Markov chain Monte Carlo (MCMC) to visualize and test the linearity assumption of the Bradley-Terry class of models. Animal behaviour, 84(6), 1523-1531.

Shev, A., Fujii, K., Hsieh, F., & McCowan, B. (2014). Systemic Testing on Bradley-Terry Model against Nonlinear Ranking Hierarchy. PloS one, 9(12), e115367.

Value

A list of length 3.

domInds

a vector of length N consiting of the MLE values of the dominance indices. Lower values represent lower ranks.

probMat

an N-by-N numeric matrix of win-loss probabilities estimated by the BT model.

logLik

the model fit.

Examples

1
2
3
4
5
6
7
8
9
# create an edgelist
edgelist1 <- data.frame(col1 = sample(letters[1:15], 200, replace = TRUE),
                        col2 = sample(letters[1:15], 200, replace = TRUE),
                       stringsAsFactors = FALSE)
edgelist1 <- edgelist1[-which(edgelist1$col1 == edgelist1$col2), ]
# convert an edgelist to conflict matrix
confmatrix_bt <- as.conflictmat(edgelist1)
# Computes the MLE for the BT model
bt <- bradleyTerry(confmatrix_bt)

Example output



Perc documentation built on May 12, 2021, 1:08 a.m.