This function fits a standard Bayesian BTL model to ordinal comparison data (e.g., complete rankings, partial rankings, pairwise comparisons, or groupwise comparisons) such that each worth parameter receives an independent Gamma prior.

fit_BTL(
  Pi,
  J,
  a_gamma,
  b_gamma,
  nu0 = NULL,
  num_iters = 100,
  groupwise = FALSE
)

Arguments

Pi

A matrix of preference orderings ("rankings"), such that the (i,j) entry is the index of the jth-most preferred object according to judge i. If groupwise=TRUE, then the index corresponds to the jth-most preferred object among those in row i; if groupwise=FALSE, it is assumed that all unranked objects (if any) are less preferred than those which are ranked.

J

A numeric indicating the total number of objects being compared.

a_gamma

A numeric for the first hyperparameter (shape) in a Gamma prior on each worth parameter.

b_gamma

A numeric for the second hyperparameter (rate) in a Gamma prior on each worth parameter.

nu0

A numeric vector for the initialization of worth parameters, omega, in the MCMC algorithm. Default to NULL, indicating random initialization.

num_iters

A numeric indicating the total number of MCMC iterations.

groupwise

A boolean to indicate whether the observed rankings are complete/partial rankings (FALSE; default) or groupwise comparisons (TRUE).

Value

A list containing a single element, omega, a num_itersxJ matrix of approximate posterior draws of the object-specific worth parameters, omega.

Examples

Pi <- matrix(data=c(1,2,3,NA,NA,1,2,3,4,5),byrow=TRUE,nrow=2)
fit_BTL(Pi=Pi,J=5,a_gamma=5,b_gamma=3,num_iters=10)
#> $omega
#>            [,1]     [,2]     [,3]      [,4]      [,5]
#>  [1,] 3.8148764 1.746479 1.468389 1.5836932 2.0509987
#>  [2,] 1.5001247 1.982093 1.924792 1.3238452 1.6442201
#>  [3,] 1.5860894 2.732243 1.355803 2.5245231 1.6291635
#>  [4,] 1.6577046 2.835634 2.106598 2.2779328 0.9413874
#>  [5,] 0.9186769 2.166558 1.193668 0.6675118 0.9865668
#>  [6,] 1.8565060 1.626987 1.705501 0.9556718 1.4207971
#>  [7,] 2.0358377 2.507341 1.785390 2.2286617 0.8170331
#>  [8,] 1.7375942 2.012884 1.222543 1.9131011 1.1696639
#>  [9,] 1.5465482 1.129508 1.298385 1.7878627 0.3848718
#> [10,] 1.4064562 2.325614 1.520663 2.4730624 0.9226391
#>