help silhouette

Title

silhouette -- Silhouette width for cluster analysis, from distance matrices

Syntax

silhouette varname , DISTmat(string) IDvar(varname) [SILH(varname) *]

options

Required
distmat(matname) names the distance matrix

idvar(varname) identifies the variable that links the sort-order of the distance matrix to the sort-order of the data

Optional
silh(varname) a variable to which to save the silhouette widths

twoway_options options allowed with graph twoway

Description

silhouette calculates and graphs the silhouette width for
the cluster solution given by the grouping variable, using the pairwise
distance matrix given in the distmat option.

Remarks

Silhouette width is an indicator of cluster adequacy. It compares
for each case, the mean distance to other cases in the cluster in which
the case is, and the mean distance to the nearest neighbour
cluster. Silhouette widths less than zero indicate a case that fits poorly in its cluster.

The distance matrix can be generated from variables using the matrix dissimilarity command (see example).
However, if you have a pairwise distance matrix created otherwise (e.g., using sequence analysis) you can use that directly.

Because the order of the data and the order of the distance matrix
must coincide, the dataset must be sorted by idvar. It is the
user's responsibility that this variable defines the correct order.

References

Wikipedia on "Silhouette_(clustering)"

Peter J. Rousseeuw (1987). "Silhouettes: a Graphical Aid to the Interpretation and Validation of Cluster Analysis". Computational and Applied Mathematics 20: 53–65. doi:10.1016/0377-0427(87)90125-7.

Author

Brendan Halpin, brendan.halpin@ul.ie

Examples

Using NLSW88, clustering on variables:

. sysuse nlsw88

. sort idcode

. cluster wards ttl age wage

. cluster gen g4=groups(4)

. set matsize 3000

. matrix dissim dist = ttl age wage, L2squared

. silhouette g4, dist(dist) id(idcode)

Using SADI to generate a matrix of inter-sequence distances (an example of a non-standard way of generating distance matrices):

. sort id

. oma m1-m40, subs(sm) indel(1.5) len(40) pwd(om1)

. clustermat wards om1, add

. cluster gen g8=groups(8)

. silhouette g8, dist(om1) id(id)

See Also

cluster stop

calinski

dudahart

SADI