Find optimal k of k-Medoid partitions using silhouette widths
optimal.k(x, nk = 10, plot = TRUE, cluster = TRUE, clara = FALSE, ...)
x | Numeric dataframe, matrix or vector |
---|---|
nk | Number of clusters to test (2:nk) |
plot | Plot cluster silhouettes(TRUE/FALSE) |
cluster | Create cluster object with optimal k |
clara | Use clara model for large data |
... | Additional arguments passed to clara |
Object of class clust "pam" or "clara"
Theodoridis, S. & K. Koutroumbas(2006) Pattern Recognition 3rd ed.
pam
for details on Partitioning Around Medoids (PAM)
clara
for details on Clustering Large Applications (clara)
Jeffrey S. Evans <jeffrey_evans<at>tnc.org>
#>#> #>#>#> #>x <- rbind(cbind(rnorm(10,0,0.5), rnorm(10,0,0.5)), cbind(rnorm(15,5,0.5), rnorm(15,5,0.5))) clust <- optimal.k(x, 20, plot=TRUE, cluster=TRUE)#># Extract multivariate and univariate mediods (class centers) clust$medoids#> [,1] [,2] #> [1,] -0.3863414 -0.4797485 #> [2,] 4.8249686 4.9026229#> [,1] #> [1,] 4.692233