MCMCBradTerr: Bayesian Approximation of Bradley Terry Pairwise Comparisons

Description Usage Arguments Details Value References Examples

Description

The function generates a posterior of player ratings using the methods detailed in E.S. Adams 2005 with the MCMCpack package.

Usage

1
2
MCMCBradTerr(intData, fixed.player = 1, b0 = 0, B0 = 0.001,
  beta.start = 0, MLE = FALSE, ...)

Arguments

intData

An object of class "interData" which provides the data frame for the analysis

fixed.player

either the position of the player in the intData object to have their player rating fixed to zero or their name.

b0

The prior mean of players rating under a multivariate normal prior. This can either be a scalar or a column vector with dimension equal to the number of players (excluding those who only have tie interaction outcomes) - 1. If this takes a scalar value, then that value will serve as prior mean rating for all of the players.

B0

The prior precision of player rating under a multivariate normal prior. This can either be a scalar or a square matrix with dimensions equal to the number of players (excluding those who only have tie interaction outcomes) - 1. If this takes a scalar value, then that value times an identity matrix serves as the prior precision of player ratings.

beta.start

Intial values of the players excluding the first player which fixed to zero. Must be numeric vector of length equal to number of players (excluding those who only have tie interaction outcomes) - 1. If this takes a scalar value that value will be the start for all player ratings (excluding the first player who is fixed at zero).

MLE

logical indicating to use MLE instead of bayesian methods. Default is set to FALSE.

...

Further arguments to be passed to the MCMClogit function

Details

MCMCBradTerr uses the MCMClogit function from MCMCpack with a specially formatted data frame in order to obtain a posterior distribution of the player ratings of a group. A single player is fixed to a rating of zero and may be specified via the fixed.player parameter. Per the methods of E.S. Adams 2005 the fixed player should be alternated over several analyses in order to see if the model is sensitive to this specification. It is also advised that prior to running the MCMCBradterr function that the user subsets the "interData" object such that all ties are removed.

Value

If MLE == FALSE An mcmc object that contains the posterior sample. This object can be summarized by functions provided by the coda package. Else a glm pbject will be returned.

References

E.S. Adams (2005) Bayesian Analysis of Linear Dominance Hierarchies. Animal Behaviour.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# generate generic data
interactions <- data.frame (a = sample (letters [1:10], 100, T),
                            b = sample (letters [1:10], 100, T),
                            o = sample (c(-1,-1,0,1,1), 100, T),
                            d = Sys.time () + runif (100, 40, 160))
# convert to interData object
id1 <- intTableConv (interactions)
# remove ties
id1.noTies <- subset (id1, ties = FALSE)
# apply Bradley-Terry MCMC function
posterior <- MCMCBradTerr (id1.noTies)
# plot posterior distributions
plot (posterior)
# MLE used instead
summary (MCMCBradTerr (id1.noTies, MLE = TRUE))

nmmarquez/linHierarchy documentation built on May 23, 2019, 9:28 p.m.