View source: R/gap.clus.R View source: R/GCCclus.R
gap.clus | R Documentation |
This function computes the gap and the number of groups using the gap statistics.
gap.clus(DistanceMatrix, Clusters, B)
DistanceMatrix |
Square matrix of GCC distances. |
Clusters |
Matrix of member labels. |
B |
Number of iterations for the bootstrap. |
A list containing:
- optim.k: number of groups.
- gap.values: gap values.
Alonso, A. M. and Peña, D. (2019). Clustering time series by linear dependency. Statistics and Computing, 29(4):655–676.
data(TaiwanAirBox032017) library(TSclust) z <- diff(as.matrix(TaiwanAirBox032017[1:50,1:8])) Macf <- as.matrix(diss(t(z), METHOD = "ACF", lag.max = 5)) sc1 <- hclust(as.dist(Macf), method = "complete") memb <- cutree(sc1, 1:8) ngroups <- gap.clus(Macf, memb, 100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.