plotGapStat: Plot gap statistics.

Description Usage Arguments Value Author(s) References Examples

View source: R/ClustComparePlot.R

Description

A function that plots given gap statistics and finds the best k value using a user-specified method.

Usage

1
plotGapStat(gapStat, method = "Tibs2001SEmax", color = "steelblue")

Arguments

gapStat

An object of class "clusGap" indicating the gap statistics to be plotted. This is usually output from comparePAM, compareEM, or cluster::clusGap.

method

A character string indicating the method used to determine best k. Default value is "Tibs2001SEmax". Must be one of "globalmax", "firstmax", "Tibs2001SEmax", "firstSEmax". Tibs2001SEmax is the method proposed by Tibshirani et al (2001): "the smallest k such that gap(k) >= gap(k+1) - s_k+1".

color

A character string indicating the color of line graph. Default value is "steelblue".

Value

A plot of the gap statistics, with a vertical dashed line indicating the best k value.

Author(s)

Yuzi Li, rainal.li@mail.utoronto.ca

References

Alboukadel Kassambara and Fabian Mundt (2020). factoextra: Extract and Visualize the Results of Multivariate Data Analyses. R package version 1.0.7. https://CRAN.R-project.org/package=factoextra

Examples

1
2
3
4
5
6
pam <- clustPAM(6, text = NwkTree2)
set.seed(5)
gapStat <- compareGap(distM = pam$distM, k.max = 10, method = "PAM")
gapStat$Tab
set.seed(NULL)
plotGapStat(gapStat)

rainali475/ClustPhy documentation built on Dec. 22, 2021, 12:03 p.m.