This function creates silhouette indices and silhouette plots of
each cluster. The plot presents also the mean of the silhouette indices per
cluster.
Usage
sil(distdata, idmedoid, idcluster, title = "")
Arguments
distdata
A distance matrix (n x n) or dist object.
idmedoid
A vector of id medoids (seeDetails).
idcluster
A vector of cluster membership (seeDetails).
title
A title of the plot.
Value
Function returns a list with following components:
result is a data frame of the silhouette indices for all objects
plot is the silhouette plots of each cluster.
Details
The silhouette index of object i is calculated by
$$si(i)=\frac{b_i-a_i}{max(a_i, b_i)}$$
where \(a_i\) is the average distance of object i to all objects
within the cluster, and \(b_i\) is the average distance of object i
to all objects within the nearest cluster.
The idmedoid argument corresponds to the idcluster argument.
If the length of idmedoid is 3, for example, the idcluster has
to have 3 unique memberships, or it returns Error otherwise. The
length of the idcluster has also to be equal to n
(the number of objects).
References
P. J. Rousseeuw. 1987 Silhouettes: a graphical aid to
the interpretation and validation of cluster analysis.
Journal of Computational and Applied Mathematics, vol. 20, pp. 53-65