# Estimating off-diagonal block Kendall's taus
matrixCor = matrix(c(1 , 0.5, 0.3 ,0.3, 0.3,
0.5, 1, 0.3, 0.3, 0.3,
0.3, 0.3, 1, 0.5, 0.5,
0.3, 0.3, 0.5, 1, 0.5,
0.3, 0.3, 0.5, 0.5, 1), ncol = 5 , nrow = 5)
dataMatrix = mvtnorm::rmvnorm(n = 100, mean = rep(0, times = 5), sigma = matrixCor)
blockStructure = list(1:2, 3:5)
estKTMatrix = list()
estKTMatrix$all = KTMatrixEst(dataMatrix = dataMatrix,
blockStructure = blockStructure,
averaging = "all")
estKTMatrix$row = KTMatrixEst(dataMatrix = dataMatrix,
blockStructure = blockStructure,
averaging = "row")
estKTMatrix$diag = KTMatrixEst(dataMatrix = dataMatrix,
blockStructure = blockStructure,
averaging = "diag")
estKTMatrix$random = KTMatrixEst(dataMatrix = dataMatrix,
blockStructure = blockStructure,
averaging = "random", N = 2)
InterBlockCor = lapply(estKTMatrix, FUN = function(x) {sin(x[1,2] * pi / 2)})
# Estimation of the correlation between variables of the first group
# and of the second group
print(unlist(InterBlockCor))
# to be compared with the true value: 0.3.
Run the code above in your browser using DataLab