Learn R Programming

SLBDD (version 0.0.4)

gap.clus: 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<U+00F1>a, D. (2019). Clustering time series by linear dependency. Statistics and Computing, 29(4):655<U+2013>676.

Examples

Run this code
# NOT RUN {
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)


# }

Run the code above in your browser using DataLab