if (FALSE) {
set.seed(23235)
ss <- TRUE # sample(1:150, 10 )
hc1 <- hclust(dist(iris[ss, -5]), "com")
hc2 <- hclust(dist(iris[ss, -5]), "single")
# tree1 <- as.treerogram(hc1)
# tree2 <- as.treerogram(hc2)
# cutree(tree1)
some_Bk <- Bk(hc1, hc2, k = 20)
some_Bk_permu <- Bk_permutations(hc1, hc2, k = 20)
# we can see that the Bk is much higher than the permutation Bks:
plot(
x = rep(1, 1000), y = some_Bk_permu[[1]],
main = "Bk distribution under H0",
ylim = c(0, 1)
)
points(1, y = some_Bk, pch = 19, col = 2)
}
Run the code above in your browser using DataLab