mcmc_BTL.Rd
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. The function has input parameters to permit drawing multiple MCMC chains, as well as thinning and burn-in.
mcmc_BTL(
Pi,
J,
a_gamma,
b_gamma,
nu0 = NULL,
num_iters = 1000,
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 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 MCMC iterations.
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(J+2) matrix of posterior draws, one row per posterior sample of omega, with additional columns indicating the MCMC chain index and iteration index of each posterior sample.
Pi <- matrix(data=c(1,2,3,NA,NA,1,2,3,4,5),byrow=TRUE,nrow=2)
mcmc_BTL(Pi=Pi,J=5,a_gamma=5,b_gamma=3,num_iters=6,chains=2,seed=1)
#> [1] "Estimating chain 1 of 2."
#> [1] "Estimating chain 2 of 2."
#> chain iteration omega1 omega2 omega3 omega4 omega5
#> 1 1 4 0.3560190 0.1115476 0.2392734 0.2195547 0.07360522
#> 2 1 5 0.1234655 0.3105911 0.2502775 0.1852458 0.13042023
#> 3 1 6 0.1361384 0.1997596 0.2945877 0.1555556 0.21395875
#> 4 2 4 0.2134742 0.3569195 0.1404079 0.1427169 0.14648161
#> 5 2 5 0.1742432 0.3686610 0.1594318 0.2090950 0.08856901
#> 6 2 6 0.2058945 0.2079415 0.2152427 0.1316243 0.23929709