Computes the consensus between Ward's minimum variance and Complete-linkage (or Single-linkage) algorithms (i.e., the number of elements classified together by both algorithms).

consensus_cluster(k, cluster_ward, cluster_other)

Arguments

k

(int) a vector containing the number of clusters for Ward and for Complete-linkage (or Single-linkage) algorithms, respectively

cluster_ward

an object of class hclust for the Ward algorithm

cluster_other

an object of class hclust for the Complete-linkage (or Single-linkage) algorithm

Value

an object of class consensus_cluster with the following elements:

elements

list of the elements belonging to each cluster

;

a_star

contingency table of the clustering

;

max_consensus

maximum clustering consensus

.

References

Tellaroli P, Bazzi M., Donato M., Brazzale A. R., Draghici S. (2016). Cross-Clustering: A Partial Clustering Algorithm with Automatic Estimation of the Number of Clusters. PLoS ONE 11(3): e0152333. doi:10.1371/journal.pone.0152333

Author

Paola Tellaroli, <paola dot tellaroli at unipd dot it>;; Marco Bazzi, <bazzi at stat dot unipd dot it>; Michele Donato, <mdonato at stanford dot edu>.

Examples

library(CrossClustering)

data(toy)

### toy is transposed as we want to cluster samples (columns of the
### original matrix)
toy_dist <- t(toy) |>
  dist(method = "euclidean")

### Hierarchical clustering
cluster_ward <- toy_dist |>
  hclust(method = "ward.D")
cluster_other <- toy_dist |>
  hclust(method = "complete")


### consensus_cluster
consensus_cluster(
  c(3, 4),
  cluster_ward,
  cluster_other
)
#> $elements
#> $elements$cluster_1
#> [1] 1 2
#> 
#> $elements$cluster_2
#> [1] 3 4
#> 
#> $elements$cluster_3
#> [1] 5 6
#> 
#> 
#> $a_star
#>      [,1] [,2] [,3]
#> [1,]    2    0    0
#> [2,]    0    2    0
#> [3,]    0    0    2
#> 
#> $max_consensus
#> [1] 6
#>