Please check its correctness. I assume there is a better, compact way to do that. But, i just follow the algorithm.
p = c(1/4,1/8,1/6,1/16,3/16,1/12,1/8)
mh<-matrix(nrow = 7,ncol = 7)
r<-1/7
for (i in 1:7) {
for (j in 1:7) {
if(i!=j){
mh[i,j]<-r*min(p[j]/p[i],1)
}
}
mh[i,i]<-1-sum(mh[i,],na.rm = TRUE)
}
mh
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7]
#> [1,] 0.5714286 0.07142857 0.0952381 0.03571429 0.1071429 0.04761905 0.07142857
#> [2,] 0.1428571 0.26190476 0.1428571 0.07142857 0.1428571 0.09523810 0.14285714
#> [3,] 0.1428571 0.10714286 0.3750000 0.05357143 0.1428571 0.07142857 0.10714286
#> [4,] 0.1428571 0.14285714 0.1428571 0.14285714 0.1428571 0.14285714 0.14285714
#> [5,] 0.1428571 0.09523810 0.1269841 0.04761905 0.4285714 0.06349206 0.09523810
#> [6,] 0.1428571 0.14285714 0.1428571 0.10714286 0.1428571 0.17857143 0.14285714
#> [7,] 0.1428571 0.14285714 0.1428571 0.07142857 0.1428571 0.09523810 0.26190476