mcmc_RCBTL.Rd
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). The function has input parameters to permit drawing multiple MCMC chains, as well as thinning and burn-in.
mcmc_RCBTL(
Pi,
J,
a_gamma,
b_gamma,
lambda,
nu0 = NULL,
num_iters = 1000,
nu_reps = 2,
groupwise = FALSE,
chains = 4,
burn_prop = 0.5,
thin = 1,
seed = NULL,
normalize_omega = TRUE
)
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.
A numeric indicating the total number of objects being compared.
A numeric for the first hyperparameter (shape) in a Gamma prior on each worth parameter.
A numeric for the second hyperparameter (rate) in a Gamma prior on each worth parameter.
A numeric for the Poisson hyperparameter on the number of non-empty clusters in the partition of worth parameters.
A numeric vector for the initialization of worth parameters, omega, in the MCMC algorithm. Default to NULL
, indicating random initialization.
A numeric indicating the total number of outer MCMC iterations (i.e., the number of times the partition is updated in the Gibbs sampler).
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_iters
xnu_reps
samples from the posterior.
A boolean to indicate whether the observed rankings are complete/partial rankings (FALSE
; default) or groupwise comparisons (TRUE
).
A numeric indicating the total number of independent MCMC chains to be run.
A numeric between 0 and 1 indicating the proportion of MCMC samples in each chain to be removed as burn-in.
A numeric indicating that only every thin
-th sample should be retained, to save computational memory.
A numeric indicating the random seed that should be set before running the first MCMC chain.
A boolean indicating if each posterior draw of omega should be normalized post-hoc to sum to 1; removes a standard identifiability concern of BTL models.
A (chains
xnum_iters
/thin
)x(3J+3) matrix of posterior draws, one row per posterior sample of omega, nu, and g, with additional columns indicating the MCMC chain index, iteration index, and number of non-empty partition clusters K of each posterior sample.
Pi <- matrix(data=c(1,2,3,NA,NA,1,2,3,4,5),byrow=TRUE,nrow=2)
mcmc_RCBTL(Pi=Pi,J=5,a_gamma=5,b_gamma=3,lambda=2,num_iters=6,chains=2,seed=1)
#> [1] "Estimating chain 1 of 2."
#> [1] "Estimating chain 2 of 2."
#> chain iteration K omega1 omega2 omega3 omega4 omega5
#> 1 1 7 3 0.1777953 0.31750660 0.1777953 0.16345145 0.16345145
#> 2 1 8 3 0.2513852 0.18656516 0.2513852 0.15533222 0.15533222
#> 3 1 9 2 0.2590933 0.25909325 0.2590933 0.11136012 0.11136012
#> 4 1 10 2 0.2639907 0.26399069 0.2639907 0.10401396 0.10401396
#> 5 1 11 3 0.1542067 0.25029243 0.2502924 0.17260423 0.17260423
#> 6 1 12 3 0.3892696 0.17866193 0.1786619 0.12670328 0.12670328
#> 7 2 7 2 0.2636675 0.15755503 0.2636675 0.15755503 0.15755503
#> 8 2 8 2 0.2238598 0.18409344 0.2238598 0.18409344 0.18409344
#> 9 2 9 2 0.4111159 0.05925609 0.4111159 0.05925609 0.05925609
#> 10 2 10 2 0.3399780 0.10668136 0.3399780 0.10668136 0.10668136
#> 11 2 11 3 0.2145040 0.22085273 0.2145040 0.17506965 0.17506965
#> 12 2 12 3 0.2933620 0.26246218 0.2933620 0.07540692 0.07540692
#> nu1 nu2 nu3 nu4 nu5 G1 G2 G3 G4 G5
#> 1 1.6692163 2.9808851 1.534551 NA NA 1 2 1 3 3
#> 2 3.0905706 2.2936625 1.909680 NA NA 1 2 1 3 3
#> 3 0.8955763 2.0836702 NA NA NA 2 2 2 1 1
#> 4 1.0556267 2.6792136 NA NA NA 2 2 2 1 1
#> 5 1.4040969 1.2544368 2.036073 NA NA 2 3 3 1 1
#> 6 0.7405974 2.2753321 1.044303 NA NA 2 3 3 1 1
#> 7 1.3255255 2.2182595 NA NA NA 2 1 2 1 1
#> 8 0.8006794 0.9736358 NA NA NA 2 1 2 1 1
#> 9 0.5373506 3.7281119 NA NA NA 2 1 2 1 1
#> 10 0.7759975 2.4729913 NA NA NA 2 1 2 1 1
#> 11 1.6647344 1.3196326 1.616879 NA NA 3 1 3 2 2
#> 12 2.4788624 0.7121917 2.770700 NA NA 3 1 3 2 2