moGap {mogsa} | R Documentation

## Gap statistic for clustering latent variables in `moa-class`.

### Description

Gap statitistic is a measurement of goodness of clustering result. This is a convenient function to calculate the gap statistic of clustering "moa".

### Usage

    moGap(x, K.max, B = 100, cluster = c("kmeans", "hclust"), plot = TRUE,
      dist.method = "euclidean", dist.diag = FALSE, dist.upper = FALSE, dist.p = 2,
      hcl.method = "complete", hcl.members = NULL,
      km.iter.max = 10, km.nstart = 10,
      km.algorithm = c("Hartigan-Wong", "Lloyd", "Forgy", "MacQueen"), km.trace = FALSE)

### Arguments

`x` | An object of class `moa-class` returned by `mbpca`.
`K.max` | The maximum number of clusters to consider, passed to `clusGap`
`B` | The number of bootstrap, passed to `clusGap`
`cluster` | A charater string could be either "kmeans" or "hclust" to specify the clustering algorithm.
`plot` | Logical; whether return the gap statistic plot.
`dist.method` | Distance meaurement, passed to function `"dist"`.
`dist.diag` | Passed to function `"dist"`.
`dist.upper` | Passed to function `"dist"`.
`dist.p` | Passed to function `"dist"`.
`hcl.method` | Hierarchical clustering method, passed to `"hclust"`
`hcl.members` | Passed to `"hclust"`
`km.iter.max` | Maximum number of iteration in kmeans, passed to `"kmeans"`.
`km.nstart` | An integer to specify how many random sets should be chosen. passed to `"kmeans"`.
`km.algorithm` | Kmeans algorithm, passed to `"kmeans"`.
`km.trace` | See function `"kmeans"`.

### Value

It returns a list consists of five components:

"Tab", "n", "B", "FUNcluster" - see `clusGap`

"nClust" - the estimated number of clusters using different method, see `maxSE`

### Author(s)

Chen Meng

### References

Tibshirani, R., Walther, G. and Hastie, T. (2001). Estimating the number of data clusters via the Gap statistic. Journal of the Royal Statistical Society B, 63, 411-423.

Maechler, M., Rousseeuw, P., Struyf, A., Hubert, M., Hornik, K.(2015). cluster: Cluster Analysis Basics and Extensions. R package version 2.0.1.

### See Also

Function "clusGap" in "cluster" package Function "dist", "hclust", "kmeans"

### Examples

    # see examples in \code{\link{mbpca}}

    data("NCI60_4arrays")
    moa <- mbpca(NCI60_4arrays, ncomp = 10, k = "all", method = "globalScore", option = "lambda1",
                 center=TRUE, scale=FALSE)
    gap <- moGap(moa, K.max = 12, cluster = "hcl")

    genes <- moaCoef(moa)
    scr <- moaScore(moa)

    moa2 <- moa(NCI60_4arrays, proc.row="center_ssq1", w.data="inertia", w.row=NULL, statis=FALSE)
    gap2 <- moGap(moa, K.max = 12, cluster = "hcl")

[Package mogsa version 1.26.0 Index]