This function calculates the density of ordinal comparison data (e.g., complete rankings, partial rankings, pairwise comparisons, or groupwise comparisons) based on an appropriate Bradley-Terry-Luce (BTL) model with object-specific worth parameters, omega.

dBTL(Pi, omega, log = FALSE, 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.

omega

A vector of non-negative object worth parameters.

log

A boolean to indicate whether the log density should be returned. Default to FALSE.

groupwise

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

Value

A numeric joint density of the observed rankings.

Examples

Pi <- matrix(data=c(1,2,3,NA,NA,1,2,3,4,5),byrow=TRUE,nrow=2)
dBTL(Pi=Pi,omega=c(10,8,6,4,2),log=TRUE,groupwise=FALSE)
#> [1] -5.821566
dBTL(Pi=Pi,omega=c(10,8,6,4,2),log=TRUE,groupwise=TRUE)
#> [1] -4.5486