silhouette.partana {optpart} | R Documentation |
Produce a Silhouette Object From a Partana, Clustering, or Stride Object
Description
Extracts components from a partana
, clustering
, or stride
object,
and passes the values to the silhouette
function to
produce an object of class silhouette.
Usage
## S3 method for class 'partana'
silhouette(x, dist, ...)
## S3 method for class 'clustering'
silhouette(x, dist, ...)
## S3 method for class 'stride'
silhouette(x, dist, ...)
testsil(sil)
Arguments
x |
an object of class ‘partana’, ‘clustering’, or ‘stride’ |
dist |
an object of class dist |
... |
miscellaneous arguments to pass to function silhouette |
sil |
an object of class ‘silhouette’ |
Details
For ‘partana’ and ‘clustering’ objects the advantage over
calling silhouette
directly is that the row.names of the resulting
object are added to the results, as opposed to consecutive integers.
For objects of class ‘stride’ the function extracts the component
‘clustering’ for each level of a stride object, and calls function
silhouette
in library ‘cluster’
returniung the mean silhouette width for each case.
testsil
identifies ‘misfits’ in a partition, defined as plots with
a negative silhouette width, and prints them out in a sorted list.
Value
An object of class silhouette
Note
This is a a simple conversion routine to allow plotting a silhouette plot for an object of class partana.
Author(s)
David W. Roberts droberts@montana.edu
References
http://ecology.msu.montana.edu/labdsv/R
See Also
Examples
data(shoshveg) # produces a data frame of vegetation data,
#samples as rows, attributes as columns
dis.bc <- dsvdis(shoshveg,'bray/curtis') # produces a Bray/Curtis
# dissimilarity matrix
opt.5 <- optpart(5,dis.bc) # produces an optimal partitioning into
# 5 clusters
silhouette(opt.5,dis.bc) # calculates the silhouette values
## Not run: plot(silhouette(opt.5,dis.bc)) # produce silhouette
# plot on current device