gap: GAP statistic clustering figure of merit

Description Usage Arguments Value Author(s) References Examples

View source: R/gap.r

Description

Calculates a goodness of clustering measure based on the average dispersion compared to a reference distribution.

Usage

1
gap(data = swiss,class = g, B = 500, cluster.func = myclus)

Arguments

data

The data matrix, with samples (observations) in rows and genes (variables)in columns

class

a vector descibing the cluster memberships of the rows of data

B

the number of bootstrap samples

cluster.func

a function taking the arguments data and k (number of clusters) and outputs cluster assignments as list elements cluster ( accessed by object$cluster ).

Value

The GAP statistic and the standard deviation

Author(s)

Per Broberg

References

Tishirani, R., Walther, G. and Hastie, T. (2000) Estimating the number of clusters in a dataset via the Gap statistic. Technical Report Stanford

Examples

1
2
3
4
library("MASS")
data(swiss)
cl <- myclus(data = swiss, k = 3)
gap(swiss,cl$cluster)

Example output

Loading required package: multtest
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, basename, cbind, colMeans, colSums, colnames,
    dirname, do.call, duplicated, eval, evalq, get, grep, grepl,
    intersect, is.unsorted, lapply, lengths, mapply, match, mget,
    order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind,
    rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply,
    union, unique, unsplit, which, which.max, which.min

Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

       Gap statistic one SE of simulation 
          0.50945786           0.09935434 

SAGx documentation built on Nov. 8, 2020, 8:18 p.m.