
Bk_plot(tree1, tree2, k, add_E = TRUE, rejection_line_asymptotic = TRUE, rejection_line_permutation = FALSE, R = 1000, k_permutation, conf.level = 0.95, p.adjust.methods = c("none", "bonferroni"), col_line_Bk = 1, col_line_asymptotic = 2, col_line_permutation = 4, warn = dendextend_options("warn"), main = "Bk plot", xlab = "k (number of clusters)", ylab = "Bk (Fowlkes-Mallows Index)", xlim, ylim = c(0, 1), try_cutree_hclust = TRUE, ...)
Fowlkes-Mallows index (see references) is an external evaluation method that is used to determine the similarity between two clusterings (clusters obtained after a clustering algorithm). This measure of similarity could be either between two hierarchical clusterings or a clustering and a benchmark classification. A higher the value for the Fowlkes-Mallows index indicates a greater similarity between the clusters and the benchmark classifications.
The default Bk plot comes with a line with dots (type "b") of the Bk values. Also with a fragmented (lty=2) line (of the same color) of the expected Bk line under H0, And a solid red line of the upper critical Bk values for rejection
FM_index
, Bk, Bk_permutations
## Not run:
#
# 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)
#
# Bk_plot(hc1, hc2, k = 2:20, xlim = c(2,149))
# Bk_plot(hc1, hc2)
#
# Bk_plot(hc1, hc2, k = 3)
# Bk_plot(hc1, hc2, k = 3:10)
# Bk_plot(hc1, hc2)
# Bk_plot(hc1, hc2,p.adjust.methods="bonferroni") # higher rejection lines
#
# # this one can take a bit of time:
# Bk_plot(hc1, hc2, rejection_line_permutation=TRUE,
# k_permutation = c(2,4,6,8,10,20,30,40,50), R= 100)
# # we can see that the permutation line is VERY close to the asymptotic line.
# # This is great since it means one can often use the asymptotic results
# # Without having to do many simulations.
#
# # works just as well for dendrograms:
# dend1 <- as.dendrogram(hc1)
# dend2 <- as.dendrogram(hc2)
# Bk_plot(dend1, dend2, k = 2:3, try_cutree_hclust = FALSE) # slower than hclust, but works...
# Bk_plot(hc1, dend2, k = 2:3, try_cutree_hclust = FALSE) # slower than hclust, but works...
# Bk_plot(dend1, dend1, k = 2:3, try_cutree_hclust = TRUE) # slower than hclust, but works...
# Bk_plot(hc1, hc1, k = 2:3) # slower than hclust, but works...
# # for some reason it can't turn dend2 back to hclust :(
# a= Bk_plot(hc1, hc2, k = 2:3, try_cutree_hclust = TRUE) # slower than hclust, but works...
#
# hc1_mixed <- as.hclust(sample(as.dendrogram(hc1)))
# Bk_plot(tree1=hc1, tree2=hc1_mixed,
# add_E=FALSE,
# rejection_line_permutation=TRUE, k_permutation = c(2,4,6,8,10,20,30,40,50), R= 100)
#
#
#
# ## End(Not run)
Run the code above in your browser using DataLab