This function calculates Kendall's tau distance between ranking(s) and a central permutation, pi0

kendall(rankings, pi0)

Arguments

rankings

A matrix of rankings, potentially with attribute "assignments" to signify separate reviewer assignments. One ranking per row.

pi0

A vector specifying the consensus (modal probability) ranking.

Value

A vector of the Kendall's tau distance between each ranking in rankings and pi0.

Examples

ranking1 <- c(2,1,3)
ranking2 <- matrix(c(2,1,3,1,2,3),byrow=TRUE,nrow=2)
ranking3 <- matrix(c(1,2,3,4,2,4,NA,NA),byrow=TRUE,nrow=2)
attr(ranking3,"assignments") <- matrix(c(TRUE,TRUE,TRUE,TRUE,
  FALSE,TRUE,FALSE,TRUE),byrow=TRUE,nrow=2)
kendall(ranking1,c(1,2,3))
#> [1] 1
kendall(ranking2,c(1,2,3))
#> [1] 1 0
kendall(ranking3,c(1,2,3,4))
#> [1] 0 0