gap.clus {SLBDD} | R Documentation |
Gap statistics
Description
This function computes the gap and the number of groups using the gap statistics.
Usage
gap.clus(DistanceMatrix, Clusters, B)
Arguments
DistanceMatrix |
Square matrix of GCC distances. |
Clusters |
Matrix of member labels. |
B |
Number of iterations for the bootstrap. |
Value
A list containing:
- optim.k: number of groups.
- gap.values: gap values.
References
Alonso, A. M. and Peña, D. (2019). Clustering time series by linear dependency. Statistics and Computing, 29(4):655–676.
Examples
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)
[Package SLBDD version 0.0.4 Index]