compute_gapstat: Compute Gap statistic for clustered data

View source: R/utils_clustering.R

compute_gapstatR Documentation

Compute Gap statistic for clustered data

Description

Compute Gap statistic for clustered data

Usage

compute_gapstat(df, clusters, gap_B = 50, max_k = 14)

Arguments

df

the data used to compute clusters

clusters

output of compute_clusters() or fastcluster::hclust()

gap_B

number of bootstrap samples for cluster::clusGap() function. Default is 50.

max_k

maximum number of clusters to compute the statistic. Default is 14.

Value

a data frame with the Tab component of cluster::clusGap() results

Examples

data_to_cluster <- iris[c("Petal.Length", "Sepal.Length")]
dmat <- compute_dmat(data_to_cluster, "euclidean", TRUE)
clusters <- compute_clusters(dmat, "complete")
gap_results <- compute_gapstat(scale(data_to_cluster), clusters)
head(gap_results)

visxhclust documentation built on March 31, 2023, 7:30 p.m.