This function implements a Gibbs sampler via data augmentation for updating the unique worth parameters, nu, in Bayesian Rank-Clustered BTL models. For internal use only.

sample_nu(
  n = 1,
  Pi,
  I,
  J,
  nu,
  p,
  K,
  a_gamma,
  b_gamma,
  c_k0 = NULL,
  delta_irk0 = NULL,
  groupwise = FALSE
)

Arguments

n

A numeric indicating the number of posterior samples to draw.

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.

I

A numeric indicating the number of rows in Pi

J

A numeric indicating the total number of objects being compared.

nu

A vector indicating current values for nu in the Gibbs sampler.

p

A vector indicating current values for g in the Gibbs sampler.

K

A vector indicating current values for K in the Gibbs sampler.

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.

c_k0

A vector of constants, as calculated by the obtain_constants function.

delta_irk0

A matrix of constants, as calculated by the obtain_constants function.

groupwise

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

Value

A matrix containing updated values for nu for n posterior samples.