View source: R/colocboost_inference.R
get_hierarchical_clusters | R Documentation |
This function performs a modularity-based hierarchical clustering approach to identify clusters from a correlation matrix.
get_hierarchical_clusters(cormat, min_cluster_corr = 0.8)
cormat |
A correlation matrix. |
min_cluster_corr |
The small correlation for the weights distributions across different iterations to be decided having only one cluster. Default is 0.8. |
A list containing:
cluster |
A binary matrix indicating the cluster membership of each variable. |
Q_modularity |
The modularity values for the identified clusters. |
Other colocboost_utilities:
get_cormat()
,
get_cos()
,
get_cos_purity()
,
get_cos_summary()
,
get_ucos_summary()
# Example usage
set.seed(1)
N <- 100
P <- 4
sigma <- matrix(0.2, nrow = P, ncol = P)
diag(sigma) <- 1
sigma[1:2, 1:2] <- 0.9
sigma[3:4, 3:4] <- 0.9
X <- MASS::mvrnorm(N, rep(0, P), sigma)
cormat <- get_cormat(X)
clusters <- get_hierarchical_clusters(cormat)
clusters$cluster
clusters$Q_modularity
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.