daisy {cluster}R Documentation

Dissimilarity Matrix Calculation

Description

Compute all the pairwise dissimilarities (distances) between observations in the dataset. The original variables may be of mixed types.

Usage

daisy(x, metric = c("euclidean","manhattan"), stand = FALSE, type = list())

Arguments

x numeric matrix or data frame. Dissimilarities will be computed between the rows of x. Columns of mode numeric (i.e. all columns when x is a matrix) will be recognized as interval scaled variables, columns of class factor will be recognized as nominal variables, and columns of class ordered will be recognized as ordinal variables. Other variable types should be specified with the type argument. Missing values (NAs) are allowed.
metric character string specifying the metric to be used. The currently available options are "euclidean" (the default) and "manhattan".
Euclidean distances are root sum-of-squares of differences, and manhattan distances are the sum of absolute differences.
If not all columns of x art face="Courier New,Courier" color="#666666">R, are recycled to have length the number of observations. If col.p has more than one value, using color = TRUE can be confusing because of a mix of point and ellipse colors.

References

Pison, G., Struyf, A. and Rousseeuw, P.J. (1999) Displaying a Clustering with CLUSPLOT, Computational Statistics and Data Analysis, 30, 381–392.
A version of this is available as technical report from http://www.agoras.ua.ac.be/abstract/Disclu99.htm

Kaufman, L. and Rousseeuw, P.J. (1990). Finding Groups in Data: An Introduction to Cluster Analysis. Wiley, New York.

Struyf, A., Hubert, M. and Rousseeuw, P.J. (1997). Integrating Robust Clustering Techniques in S-PLUS, Computational Statistics and Data Analysis, 26, 17-37.

See Also

princomp, cmdscale, pam, clara, daisy, par, identify, cov.mve, clusplot.partition.

Examples

## plotting votes.diss(dissimilarity) in a bivariate plot and
## partitioning into 2 clusters
data(votes.repub)
votes.diss <- daisy(votes.repub)
votes.clus <- pam(votes.diss, 2, diss = TRUE)$clustering
clusplot(votes.diss, votes.clus, diss = TRUE, shade = TRUE)
clusplot(votes.diss, votes.clus, diss = TRUE,
         col.p = votes.clus, labels = 4)# color points and label ellipses
clusplot(votes.diss, votes.clus, diss = TRUE, span = FALSE)# simple ellipses

if(interactive()) { #  uses identify() *interactively* :
  clusplot(votes.diss, votes.clus, diss = TRUE, shade = TRUE, labels = 1)
  clusplot(votes.diss, votes.clus, diss = TRUE, labels = 5)# ident. only points
}

## plotting iris (data frame) in a 2-dimensional plot and partitioning
## into 3 clusters.
data(iris)
iris.x <- iris[, 1:4]
cl3 <- pam(iris.x, 3)$clustering
op <- par(mfrow= c(2,2))
clusplot(iris.x, cl3, color = TRUE)
U <- par("usr")
## zoom in :
rect(0,-1, 2,1, border = "orange", lwd=2)
clusplot(iris.x, cl3, color = TRUE, xlim = c(0,2), ylim = c(-1,1))
box(col="orange",lwd=2); mtext("sub region", font = 4, cex = 2)
##  or zoom out :
clusplot(iris.x, cl3, color = TRUE, xlim = c(-4,4), ylim = c(-4,4))
mtext("`super' region", font = 4, cex = 2)
rect(U[1],U[3], U[2],U[4], lwd=2, lty = 3)

# reset graphics
par(op)

[Package cluster version 1.11.2 Index]
./usr/lib/R/library/cluster/html/clusplot.partition.html0000644000000000000000000001103510500170035022314 0ustar rootroot R: Bivariate Clusplot of a Partitioning Object
clusplot.partition {cluster}R Documentation

Bivariate Clusplot of a Partitioning Object

Description

Clusplot (Clustering Plot) method for an object of class partition.

Usage

## S3 method for class 'partition':
clusplot(x, main = NULL, dist = NULL, ...)

Arguments

x an object of class "partition", e.g. created by the functions pam, clara, or fanny.
main title for the plot; when NULL (by default), a title is constructed, using x$call.
dist when x does not have a diss nor a data component, e.g., for pam(dist(*), keep.diss=FALSE), dist must specify the dissimilarity for the clusplot.
... all optional arguments available for the clusplot.default function (except for the diss one) may also be supplied to this function. Graphical parameters (see