Description Usage Arguments Value Author(s) References Examples
View source: R/ClustComparePlot.R
A function that plots given gap statistics and finds the best k value using a user-specified method.
1 | plotGapStat(gapStat, method = "Tibs2001SEmax", color = "steelblue")
|
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". |
A plot of the gap statistics, with a vertical dashed line indicating the best k value.
Yuzi Li, rainal.li@mail.utoronto.ca
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
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.