Last data update: 2014.03.03

R: Gap statistic for clustering latent variables in 'moa-class'.
moGapR 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)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(mogsa)
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/mogsa/moGap.Rd_%03d_medium.png", width=480, height=480)
> ### Name: moGap
> ### Title: Gap statistic for clustering latent variables in 'moa-class'.
> ### Aliases: moGap
> ### Keywords: gap statistic moa
> 
> ### ** Examples
> 
> # see examples in code{mbpca}
> 
> 
> data("NCI60_4arrays")
> moa <- mbpca(NCI60_4arrays, ncomp = 10, k = "all", method = "globalScore", option = "lambda1", 
+              center=TRUE, scale=FALSE)
calculating component 1 ...
calculating component 2 ...
calculating component 3 ...
calculating component 4 ...
calculating component 5 ...
calculating component 6 ...
calculating component 7 ...
calculating component 8 ...
calculating component 9 ...
calculating component 10 ...
> gap <- moGap(moa, K.max = 12, cluster = "hcl")
> 
> genes <- moaCoef(moa)
> scr <- moaScore(moa)
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>