get_hierarchical_clusters: Perform modularity-based hierarchical clustering for a...

View source: R/colocboost_inference.R

get_hierarchical_clustersR Documentation

Perform modularity-based hierarchical clustering for a correlation matrix

Description

This function performs a modularity-based hierarchical clustering approach to identify clusters from a correlation matrix.

Usage

get_hierarchical_clusters(cormat, min_cluster_corr = 0.8)

Arguments

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.

Value

A list containing:

cluster

A binary matrix indicating the cluster membership of each variable.

Q_modularity

The modularity values for the identified clusters.

See Also

Other colocboost_utilities: get_cormat(), get_cos(), get_cos_purity(), get_cos_summary(), get_ucos_summary()

Examples

# 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


colocboost documentation built on June 8, 2025, 11:07 a.m.