This function fits a Bayesian Rank-Clustered BTL model to ordinal comparison data (e.g., complete rankings, partial rankings, pairwise comparisons, or groupwise comparisons) such that the worth parameters are drawn from a PSSF prior (as defined in Pearce and Erosheva 2024).

fit_RCBTL(
  Pi,
  J,
  a_gamma,
  b_gamma,
  lambda,
  nu0 = NULL,
  num_iters = 100,
  nu_reps = 3,
  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.

lambda

A numeric for the Poisson hyperparameter on the number of non-empty clusters in the partition of worth parameters.

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 outer MCMC iterations (i.e., the number of times the partition is updated in the Gibbs sampler).

nu_reps

A numeric indicating the number of times each worth parameter is drawn per update of the parameter partition. There will be a total of num_itersxnu_reps samples from the posterior.

groupwise

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

Value

A list of 4 elements: omega, a (num_itersxnu_reps)xJ matrix of approximate posterior draws of the object-specific worth parameters, omega; nu a (num_itersxnu_reps)xJ matrix of the unique parameter values corresponding to the jth partition cluster in posterior draw i, g a a (num_itersxnu_reps)xJ matrix indicating the cluster membership of object j in posterior draw i, and K a vector of the number of non-empty partition clusters in each posterior draw.

Examples

Pi <- matrix(data=c(1,2,3,NA,NA,1,2,3,4,5),byrow=TRUE,nrow=2)
fit_RCBTL(Pi=Pi,J=5,a_gamma=5,b_gamma=3,lambda=2,num_iters=5,nu_reps=2)
#> $omega
#>            [,1]     [,2]     [,3]      [,4]     [,5]
#>  [1,] 2.6903096 2.167205 2.167205 2.6903096 2.167205
#>  [2,] 2.4870672 1.020402 1.020402 2.4870672 1.020402
#>  [3,] 2.5823728 1.022356 1.022356 2.5823728 1.022356
#>  [4,] 1.1166087 1.257511 1.257511 1.1166087 1.257511
#>  [5,] 1.5845342 2.490267 2.490267 0.8018633 2.490267
#>  [6,] 1.0488350 1.791004 1.791004 1.3354488 1.791004
#>  [7,] 3.4548519 1.676795 1.676795 2.1210863 1.676795
#>  [8,] 1.2682114 3.282189 3.282189 1.4273731 3.282189
#>  [9,] 0.9868771 1.739470 1.739470 0.8848360 1.739470
#> [10,] 2.3788136 2.747735 2.747735 1.0574828 2.747735
#> 
#> $nu
#>            [,1]      [,2]     [,3] [,4] [,5]
#>  [1,] 2.1672053 2.6903096       NA   NA   NA
#>  [2,] 1.0204022 2.4870672       NA   NA   NA
#>  [3,] 1.0223556 2.5823728       NA   NA   NA
#>  [4,] 1.2575105 1.1166087       NA   NA   NA
#>  [5,] 1.5845342 0.8018633 2.490267   NA   NA
#>  [6,] 1.0488350 1.3354488 1.791004   NA   NA
#>  [7,] 3.4548519 2.1210863 1.676795   NA   NA
#>  [8,] 1.2682114 1.4273731 3.282189   NA   NA
#>  [9,] 0.9868771 0.8848360 1.739470   NA   NA
#> [10,] 2.3788136 1.0574828 2.747735   NA   NA
#> 
#> $g
#>       [,1] [,2] [,3] [,4] [,5]
#>  [1,]    2    1    1    2    1
#>  [2,]    2    1    1    2    1
#>  [3,]    2    1    1    2    1
#>  [4,]    2    1    1    2    1
#>  [5,]    1    3    3    2    3
#>  [6,]    1    3    3    2    3
#>  [7,]    1    3    3    2    3
#>  [8,]    1    3    3    2    3
#>  [9,]    1    3    3    2    3
#> [10,]    1    3    3    2    3
#> 
#> $K
#>  [1] 2 2 2 2 3 3 3 3 3 3
#>