| kmeans.getk | R Documentation |
Estimate the optimal number of cluster of the K-means clustering method.
kmeans.getk(
d,
max = 9,
criterion = c("pseudo-F", "silhouette", "gap", "elbow"),
nstart = 10,
B = 100,
graph = FALSE,
seed = NULL
)
d |
The dataset ( |
max |
The largest number of clusters considered. Values from 2 to |
criterion |
How the number of clusters is chosen: |
nstart |
The number of random sets chosen for |
B |
The number of bootstrap samples used by |
graph |
A logical indicating whether or not a graphic should be plotted. |
seed |
A specified seed for random number generation. |
The number of clusters retained by the chosen criterion.
Tibshirani, R., Walther, G. and Hastie, T. (2001). Estimating the number of clusters in a data set via the gap statistic. Journal of the Royal Statistical Society: Series B, 63(2), 411-423.
pseudoF, KMEANS, kmeans,
silhouette, clusGap
require (datasets)
data (iris)
kmeans.getk (iris [, -5])
kmeans.getk (iris [, -5], criterion = "silhouette")
kmeans.getk (iris [, -5], criterion = "elbow")
# The gap statistic resamples, so it is much slower than the other three.
kmeans.getk (iris [, -5], criterion = "gap", B = 20, seed = 0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.